예제 #1
0
 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;
     }
 }
예제 #2
0
 public void Visit(Form node)
 {
     node.Block.Accept(this);
 }
예제 #3
0
        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);
        }