Package it.twenfir.antlr.ast
Class AstHelper
- java.lang.Object
-
- it.twenfir.antlr.ast.AstHelper
-
public class AstHelper extends Object
Provide methods to help building AST's
-
-
Constructor Summary
Constructors Constructor Description AstHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Location
location(org.antlr.v4.runtime.ParserRuleContext context)
Create a Location instance from an ANTLR rule context.static <V extends org.antlr.v4.runtime.tree.ParseTreeVisitor<? extends AstNode>>
voidvisitChildren(V visitor, org.antlr.v4.runtime.tree.RuleNode node, AstNode parent)
Visit children of an ANTLR parse tree node and add them as children of the current AST node.
-
-
-
Method Detail
-
visitChildren
public static <V extends org.antlr.v4.runtime.tree.ParseTreeVisitor<? extends AstNode>> void visitChildren(V visitor, org.antlr.v4.runtime.tree.RuleNode node, AstNode parent)
Visit children of an ANTLR parse tree node and add them as children of the current AST node. Assumes that the default implementation ofvisit
returns null making it possible to override it only for interesting nodes.- Type Parameters:
V
- the visitor's type- Parameters:
visitor
- the visitor implementationnode
- the current parse tree nodeparent
- the AST node to which children will be added
-
location
public static Location location(org.antlr.v4.runtime.ParserRuleContext context)
Create a Location instance from an ANTLR rule context.- Parameters:
context
- the current ANTLR context- Returns:
- the newly created instance
-
-