Example #1
0
 public virtual void VisitRecordTypeNode(RecordTypeNode node)
 {
     Visit(node.RecordKeywordNode);
     Visit(node.ContentListNode);
     Visit(node.VariantSectionNode);
     Visit(node.EndKeywordNode);
 }
Example #2
0
        public override void VisitVariantSectionNode(VariantSectionNode node)
        {
            RecordTypeNode   record          = node.ParentNodeOfType <RecordTypeNode>();
            ITypeDeclaration typeDeclaration = record.ParentNodeOfType <ITypeDeclaration>();

            AddHit(node,
                   AstNode.ToCode(typeDeclaration.FirstNameNode, record.RecordKeywordNode) + " ... " +
                   AstNode.ToCode(node.CaseKeywordNode, node.OfKeywordNode));
            base.VisitVariantSectionNode(node);
        }
Example #3
0
        public AstPrinterNode Visit(RecordTypeNode node)
        {
            var printer = new AstPrinterNode(node.ToString());

            foreach (var field in node.FieldsList)
            {
                printer.AddChild(field.Accept(this));
            }

            return(printer);
        }
        public bool Visit(RecordTypeNode node)
        {
            _symStack.Push();
            foreach (var field in node.FieldsList)
            {
                field.Accept(this);
            }

            node.SymbolTable = _symStack.Pop();
            node.SymType     = new SymRecordType(node.SymbolTable);
            return(true);
        }
Example #5
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));
        }
Example #6
0
 public virtual void VisitRecordTypeNode(RecordTypeNode node)
 {
     Visit(node.RecordKeywordNode);
     Visit(node.ContentListNode);
     Visit(node.VariantSectionNode);
     Visit(node.EndKeywordNode);
 }