use of com.google.auto.value.processor.escapevelocity.TokenNode.MacroDefinitionTokenNode in project auto by google.
the class Reparser method parseTokenNode.
private Node parseTokenNode() {
TokenNode tokenNode = (TokenNode) currentNode();
nextNode();
if (tokenNode instanceof CommentTokenNode) {
return emptyNode(tokenNode.lineNumber);
} else if (tokenNode instanceof IfTokenNode) {
return parseIfOrElseIf((IfTokenNode) tokenNode);
} else if (tokenNode instanceof ForEachTokenNode) {
return parseForEach((ForEachTokenNode) tokenNode);
} else if (tokenNode instanceof MacroDefinitionTokenNode) {
return parseMacroDefinition((MacroDefinitionTokenNode) tokenNode);
} else {
throw new IllegalArgumentException("Unexpected token: " + tokenNode.name() + " on line " + tokenNode.lineNumber);
}
}
use of com.google.auto.value.processor.escapevelocity.TokenNode.MacroDefinitionTokenNode in project auto by google.
the class Reparser method parseMacroDefinition.
private Node parseMacroDefinition(MacroDefinitionTokenNode macroDefinition) {
Node body = parseTo(END_SET, macroDefinition);
// Skip #end
nextNode();
if (!macros.containsKey(macroDefinition.name)) {
Macro macro = new Macro(macroDefinition.lineNumber, macroDefinition.name, macroDefinition.parameterNames, body);
macros.put(macroDefinition.name, macro);
}
return emptyNode(macroDefinition.lineNumber);
}
Aggregations