public override string Visit(ProgNode node, object obj)
        {
            StringBuilder builder = new StringBuilder();

            node.Children.ForEach(child => builder.Append(Visit(child)));
            return(builder.ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// Creates an AST from the given CST (<see cref="ParserRuleContext"/>).
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override ASTNode VisitProg(CLUBSParser.ProgContext context)
        {
            ProgNode node = new ProgNode(new SourcePosition(context.start));

            node.Children.Add(Visit(context.setupBlock));

            return(node);
        }
Esempio n. 3
0
 public abstract T Visit(ProgNode node, object obj);
 public override TypeNode Visit(ProgNode node, object obj)
 {
     node.Children.ForEach(x => Visit(x));
     return(null);
 }