public Constructor(ParsingData parser, ConstructorNode constructorNode)
        {
            AccessLevel = constructorNode.AccessLevel;
            BlockNode   = constructorNode.BlockNode;

            Parameters = ParameterDefineNode.GetParameters(parser, constructorNode.Parameters);
        }
 public void RegisterParameters(ParsingData parser)
 {
     if (TypeString != null)
     {
         Type = parser.GetDefinedType(TypeString, Node.Location);
     }
     Parameters = ParameterDefineNode.GetParameters(parser, ParameterNodes);
 }
        public ForEachNode(DeltinScriptParser.ForeachContext context, BuildAstVisitor visitor) : base(new Location(visitor.file, Range.GetRange(context)))
        {
            Array    = visitor.Visit(context.expr());
            Variable = new ParameterDefineNode(context.parameter_define(), visitor);
            Block    = (BlockNode)visitor.VisitBlock(context.block());

            Repeaters = 1;
            if (context.number() != null)
            {
                Repeaters = int.Parse(context.number().GetText());
            }
        }
        public ConstructorNode(DeltinScriptParser.ConstructorContext context, BuildAstVisitor visitor) : base(new Location(visitor.file, Range.GetRange(context)))
        {
            Name = context.PART().GetText();

            Parameters = new ParameterDefineNode[context.setParameters().parameter_define().Length];
            for (int i = 0; i < Parameters.Length; i++)
            {
                Parameters[i] = new ParameterDefineNode(context.setParameters().parameter_define(i), visitor);
            }

            AccessLevel = AccessLevel.Private;
            if (context.accessor() != null)
            {
                AccessLevel = (AccessLevel)Enum.Parse(typeof(AccessLevel), context.accessor().GetText(), true);
            }

            BlockNode = (BlockNode)visitor.VisitBlock(context.block());
        }
        public MacroNode(DeltinScriptParser.MacroContext context, BuildAstVisitor visitor) : base(new Location(visitor.file, DocRange.GetRange(context)))
        {
            Name          = context.name.Text;
            Documentation = GetDocumentation(context.DOCUMENTATION());

            Parameters = new ParameterDefineNode[context.setParameters().parameter_define().Length];
            for (int i = 0; i < Parameters.Length; i++)
            {
                Parameters[i] = new ParameterDefineNode(context.setParameters().parameter_define(i), visitor);
            }

            AccessLevel = AccessLevel.Private;
            if (context.accessor() != null)
            {
                AccessLevel = (AccessLevel)Enum.Parse(typeof(AccessLevel), context.accessor().GetText(), true);
            }

            Expression = visitor.VisitExpr(context.expr());
        }
        public UserMethodNode(DeltinScriptParser.User_methodContext context, BuildAstVisitor visitor) : base(new Location(visitor.file, Range.GetRange(context)))
        {
            Name = context.name.Text;
            Type = context.type?.Text;

            Parameters = new ParameterDefineNode[context.setParameters().parameter_define().Length];
            for (int i = 0; i < Parameters.Length; i++)
            {
                Parameters[i] = new ParameterDefineNode(context.setParameters().parameter_define(i), visitor);
            }

            Block         = (BlockNode)visitor.VisitBlock(context.block());
            IsRecursive   = context.RECURSIVE() != null;
            Documentation = string.Join("\n\r", context.DOCUMENTATION().Select(doc => doc.GetText().TrimEnd().TrimStart('#', ' ')));

            AccessLevel = AccessLevel.Private;
            if (context.accessor() != null)
            {
                AccessLevel = (AccessLevel)Enum.Parse(typeof(AccessLevel), context.accessor().GetText(), true);
            }
        }