/** * Create a new token from the given prototype. Any argument besides the prototype is optional and * will be ignored if its value is <code>null</code>. */ protected CommonToken createToken(CommonToken prototype, String text, Integer charPosInLine, Integer channel, Integer start, Integer stop, Integer type) { if (prototype == null) throw new IllegalArgumentException("Prototype may not be null."); CommonToken result = new CommonToken(prototype); if (text != null) result.setText(text); if (charPosInLine != null) result.setCharPositionInLine(charPosInLine.intValue()); if (channel != null) result.setChannel(channel.intValue()); if (start != null) result.setStartIndex(start.intValue()); if (stop != null) result.setStopIndex(stop.intValue()); if (type != null) result.setType(type.intValue()); return result; }
private Token newToken(int type, String text, boolean hidden) { CommonToken token = new CommonToken(type, text); if (hidden) { token.setChannel(Token.HIDDEN_CHANNEL); } token.setStartIndex(yychar); token.setStopIndex(yychar + yylength() - 1); token.setLine(getLine()); token.setCharPositionInLine(getColumn()); return token; }
private Token newToken(int type, String text, boolean hidden) { CommonToken token = new CommonToken(type, text); if (hidden) { token.setChannel(Token.HIDDEN_CHANNEL); } token.setStartIndex(yychar); token.setStopIndex(yychar + yylength() - 1); token.setLine(getLine()); token.setCharPositionInLine(getColumn()); return token; }
private Token newToken(int type, String text, boolean hidden) { CommonToken token = new CommonToken(type, text); if (hidden) { token.setChannel(Token.HIDDEN_CHANNEL); } token.setStartIndex(yychar); token.setStopIndex(yychar + yylength() - 1); token.setLine(getLine()); token.setCharPositionInLine(getColumn()); return token; }
private Token newToken(int type, String text, boolean hidden) { CommonToken token = new CommonToken(type, text); if (hidden) { token.setChannel(Token.HIDDEN_CHANNEL); } token.setStartIndex(yychar); token.setStopIndex(yychar + yylength() - 1); token.setLine(getLine()); token.setCharPositionInLine(getColumn()); return token; }