/** * Creates a new token with the given type, using the given position as location info. * * @param type the type if this token. Can be further specified by supplying a trigger. * @param pos the location of this token * @return a new token which can be filled with content and trigger infos */ public static Token create(TokenType type, Position pos) { Token result = new Token(); result.type = type; result.line = pos.getLine(); result.pos = pos.getPos(); return result; }
/** * Creates a new error for the given position with the given message. * <p> * If no position is available {@link Position#UNKNOWN} can be used * * @param pos the position where the error occurred * @param msg the message explaining the error * @return a new ParseError containing the error */ public static ParseError error(Position pos, String msg) { String message = msg; if (pos.getLine() > 0) { message = String.format("%3d:%2d: %s", pos.getLine(), pos.getPos(), msg); } return new ParseError(pos, message, Severity.ERROR); }
/** * Creates a new token with the given type, using the given position as location info. * * @param type the type if this token. Can be further specified by supplying a trigger. * @param pos the location of this token * @return a new token which can be filled with content and trigger infos */ public static Token create(TokenType type, Position pos) { Token result = new Token(); result.type = type; result.line = pos.getLine(); result.pos = pos.getPos(); return result; }
/** * Creates a new warning for the given position with the given message. * <p> * If no position is available {@link Position#UNKNOWN} can be used * * @param pos the position where the warning occurred * @param msg the message explaining the warning * @return a new ParseError containing the warning */ public static ParseError warning(Position pos, String msg) { String message = msg; if (pos.getLine() > 0) { message = String.format("%3d:%2d: %s", pos.getLine(), pos.getPos(), msg); } return new ParseError(pos, message, Severity.WARNING); }
/** * Creates a new warning for the given position with the given message. * <p> * If no position is available {@link Position#UNKNOWN} can be used * * @param pos the position where the warning occurred * @param msg the message explaining the warning * @return a new ParseError containing the warning */ public static ParseError warning(Position pos, String msg) { String message = msg; if (pos.getLine() > 0) { message = String.format("%3d:%2d: %s", pos.getLine(), pos.getPos(), msg); } return new ParseError(pos, message, Severity.WARNING); }
/** * Creates a new error for the given position with the given message. * <p> * If no position is available {@link Position#UNKNOWN} can be used * * @param pos the position where the error occurred * @param msg the message explaining the error * @return a new ParseError containing the error */ public static ParseError error(Position pos, String msg) { String message = msg; if (pos.getLine() > 0) { message = String.format("%3d:%2d: %s", pos.getLine(), pos.getPos(), msg); } return new ParseError(pos, message, Severity.ERROR); }