Example #1
0
        public override ASTNode VisitPrototypeDef([NotNull] DaedalusParser.PrototypeDefContext prototypeDefContext)
        {
            NameNode nameNode = new NameNode(GetLocation(prototypeDefContext.nameNode()), prototypeDefContext.nameNode().GetText());

            DaedalusParser.ParentReferenceContext parentReferenceContext         = prototypeDefContext.parentReference();
            InheritanceParentReferenceNode        inheritanceParentReferenceNode = new InheritanceParentReferenceNode(parentReferenceContext.GetText(), GetLocation(parentReferenceContext));

            _inheritanceReferenceNodes.Add(inheritanceParentReferenceNode);
            List <StatementNode> statementNodes = GetStatementNodes(prototypeDefContext.statementBlock());

            return(new PrototypeDefinitionNode(GetLocation(prototypeDefContext), nameNode, inheritanceParentReferenceNode, statementNodes));
        }
Example #2
0
        public override ASTNode VisitInstanceDef([NotNull] DaedalusParser.InstanceDefContext instanceDefContext)
        {
            NameNode nameNode = new NameNode(GetLocation(instanceDefContext.nameNode()), instanceDefContext.nameNode().GetText());

            DaedalusParser.ParentReferenceContext parentReferenceContext         = instanceDefContext.parentReference();
            InheritanceParentReferenceNode        inheritanceParentReferenceNode = new InheritanceParentReferenceNode(parentReferenceContext.GetText(), GetLocation(parentReferenceContext));

            _inheritanceReferenceNodes.Add(inheritanceParentReferenceNode);
            List <StatementNode> statementNodes = GetStatementNodes(instanceDefContext.statementBlock());

            return(new InstanceDefinitionNode(GetLocation(instanceDefContext), nameNode, inheritanceParentReferenceNode, statementNodes, definedWithoutBody: false));
        }
Example #3
0
        private InstanceDeclarationsTemporaryNode GetInstanceDeclarationsTemporaryNode(DaedalusParser.InstanceDeclContext instanceDeclContext)
        {
            DaedalusParser.ParentReferenceContext parentReferenceContext         = instanceDeclContext.parentReference();
            InheritanceParentReferenceNode        inheritanceParentReferenceNode = new InheritanceParentReferenceNode(parentReferenceContext.GetText(), GetLocation(parentReferenceContext));

            _inheritanceReferenceNodes.Add(inheritanceParentReferenceNode);

            List <DeclarationNode> instanceDeclarationNodes = new List <DeclarationNode>();

            foreach (DaedalusParser.NameNodeContext nameNodeContext in instanceDeclContext.nameNode())
            {
                NameNode nameNode = new NameNode(GetLocation(nameNodeContext), nameNodeContext.GetText());
                instanceDeclarationNodes.Add(new InstanceDefinitionNode(GetLocation(instanceDeclContext), nameNode, inheritanceParentReferenceNode, new List <StatementNode>(), definedWithoutBody: true));
            }

            return(new InstanceDeclarationsTemporaryNode(GetLocation(instanceDeclContext), instanceDeclarationNodes));
        }
Example #4
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="DaedalusParser.parentReference"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitParentReference([NotNull] DaedalusParser.ParentReferenceContext context)
 {
     return(VisitChildren(context));
 }
 /// <summary>
 /// Exit a parse tree produced by <see cref="DaedalusParser.parentReference"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitParentReference([NotNull] DaedalusParser.ParentReferenceContext context)
 {
 }