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)); }
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)); }
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)); }
/// <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) { }