public bool Visit(FieldSectionNode node)
        {
            node.IdentsType.Accept(this);
            foreach (var ident in node.Idents)
            {
                CheckIdentifierDuplicateInScope(ident.Token);
                _symStack.AddVariable(true, ident.ToString(), node.IdentsType.SymType);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public AstPrinterNode Visit(FieldSectionNode node)
        {
            var printer = new AstPrinterNode(node.ToString());

            foreach (var ident in node.Idents)
            {
                printer.AddChild(ident.Accept(this));
            }

            printer.AddChild(node.IdentsType.Accept(this));
            return(printer);
        }
Ejemplo n.º 3
0
        public void ParentNodeOfType()
        {
            VarSectionNode varSectionNode =
                (VarSectionNode)Parse("var Foo: record Bar: Integer; end;", RuleType.VarSection);
            RecordTypeNode recordNode =
                (RecordTypeNode)varSectionNode.VarListNode.Items[0].TypeNode;
            VisibilitySectionNode visibilitySectionNode =
                recordNode.ContentListNode.Items[0];
            FieldSectionNode fieldSectionNode =
                (FieldSectionNode)visibilitySectionNode.ContentListNode.Items[0];
            FieldDeclNode barFieldNode =
                fieldSectionNode.FieldListNode.Items[0];
            Token barNameNode = barFieldNode.NameListNode.Items[0].ItemNode;

            Assert.That(barNameNode.ParentNodeOfType <FieldDeclNode>(), Is.SameAs(barFieldNode));
            Assert.That(barNameNode.ParentNodeOfType <FieldSectionNode>(), Is.SameAs(fieldSectionNode));
            Assert.That(barNameNode.ParentNodeOfType <VisibilitySectionNode>(), Is.SameAs(visibilitySectionNode));
            Assert.That(barNameNode.ParentNodeOfType <RecordTypeNode>(), Is.SameAs(recordNode));
            Assert.That(barNameNode.ParentNodeOfType <VarSectionNode>(), Is.SameAs(varSectionNode));
        }
Ejemplo n.º 4
0
 public virtual void VisitFieldSectionNode(FieldSectionNode node)
 {
     Visit(node.ClassKeywordNode);
     Visit(node.VarKeywordNode);
     Visit(node.FieldListNode);
 }
Ejemplo n.º 5
0
 public virtual void VisitFieldSectionNode(FieldSectionNode node)
 {
     Visit(node.ClassKeywordNode);
     Visit(node.VarKeywordNode);
     Visit(node.FieldListNode);
 }