/** * 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 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 token with the given type, using the Char a initial trigger and content. * * @param type the type if this token. The supplied Char will be used as initial part of the trigger to further * specify the token * @param ch first character of the content and trigger of this token. Also specifies the position of the token. * @return a new token which is initialized with the given Char */ public static Token createAndFill(TokenType type, Char ch) { Token result = new Token(); result.type = type; result.line = ch.getLine(); result.pos = ch.getPos(); result.contents = ch.getStringValue(); result.trigger = ch.getStringValue(); result.source = ch.toString(); return result; }
/** * Creates a new token with the given type, using the Char a initial trigger and content. * * @param type the type if this token. The supplied Char will be used as initial part of the trigger to further * specify the token * @param ch first character of the content and trigger of this token. Also specifies the position of the token. * @return a new token which is initialized with the given Char */ public static Token createAndFill(TokenType type, Char ch) { Token result = new Token(); result.type = type; result.line = ch.getLine(); result.pos = ch.getPos(); result.contents = ch.getStringValue(); result.trigger = ch.getStringValue(); result.source = ch.toString(); return result; }