Class AstHelper


  • public class AstHelper
    extends Object
    Provide methods to help building AST's
    • Constructor Detail

      • AstHelper

        public AstHelper()
    • 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 of visit returns null making it possible to override it only for interesting nodes.
        Type Parameters:
        V - the visitor's type
        Parameters:
        visitor - the visitor implementation
        node - the current parse tree node
        parent - 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