public static ParseStatus syntaxError(Integer tokenNumber, List<Token> tokens, String err) { ParseStatus status = new ParseStatus(); status.columnNumber = -1; status.tokenNumber = tokenNumber; status.pointSet = new EmptyPointSet(); if (tokenNumber < tokens.size()) { Token token = tokens.get(tokenNumber); status.errMsg = "Syntax error with token (" + token.getText() + ") near column " + token.getStart() + ": " + err; } else { Token token = tokens.get(tokenNumber - 1); status.errMsg = "Unexpected end of input after token (" + token.getText() + ") near column " + token.getStart() + ": context - " + err; } return status; }
public static ParseStatus nextPosition(int pos) { ParseStatus status = new ParseStatus(); status.tokenNumber = pos; return status; }