/** * Reads and returns a special id. * * @return the parsed special id as Token */ protected Token fetchSpecialId() { Token result = Token.create(Token.TokenType.SPECIAL_ID, input.current()); result.addToTrigger(input.consume()); while (isIdentifierChar(input.current())) { result.addToContent(input.consume()); } return handleKeywords(result); }
/** * Reads and returns a special id. * * @return the parsed special id as Token */ protected Token fetchSpecialId() { Token result = Token.create(Token.TokenType.SPECIAL_ID, input.current()); result.addToTrigger(input.consume()); while (isIdentifierChar(input.current())) { result.addToContent(input.consume()); } return handleKeywords(result); }
/** * Reads and returns an identifier * * @return the parsed identifier as Token */ protected Token fetchId() { Token result = Token.create(Token.TokenType.ID, input.current()); result.addToContent(input.consume()); while (isIdentifierChar(input.current())) { result.addToContent(input.consume()); } if (!input.current().isEndOfInput() && specialIdTerminators.contains(input.current().getValue())) { Token specialId = Token.create(Token.TokenType.SPECIAL_ID, result); specialId.setTrigger(input.current().getStringValue()); specialId.setContent(result.getContents()); specialId.setSource(result.getContents()); specialId.addToSource(input.current()); input.consume(); return handleKeywords(specialId); } return handleKeywords(result); }
/** * Reads and returns an identifier * * @return the parsed identifier as Token */ protected Token fetchId() { Token result = Token.create(Token.TokenType.ID, input.current()); result.addToContent(input.consume()); while (isIdentifierChar(input.current())) { result.addToContent(input.consume()); } if (!input.current().isEndOfInput() && specialIdTerminators.contains(input.current().getValue())) { Token specialId = Token.create(Token.TokenType.SPECIAL_ID, result); specialId.setTrigger(input.current().getStringValue()); specialId.setContent(result.getContents()); specialId.setSource(result.getContents()); specialId.addToSource(input.current()); input.consume(); return handleKeywords(specialId); } return handleKeywords(result); }