private void AppendToAST(ElementBase newChild) { if (_childrenStack.Any()) { Queue<ElementBase> siblings = _childrenStack.Peek(); siblings.Enqueue(newChild); } else { //this is the last one, it should be Form _astRootNode = (Form)newChild; } }
public void Visit(Form node) { node.Block.Accept(this); }
public override void ExitFormBlock(QLParser.FormBlockContext context) { IList<ElementBase> children = GetChildren(); if (children.Count() != 2) { _astBuilderExceptions.Add(new ParserError("initial form block should have two children", SourceLocation.CreateFor(context))); } Form form = new Form( (Identifier)children[0], (Block)children[1], SourceLocation.CreateFor(context) ); AppendToAST(form); }