Example #1
0
        public override bool VisitCompilationUnit(LSLParser.CompilationUnitContext context)
        {
            if (context == null)
            {
                throw LSLCodeValidatorInternalException.VisitContextInvalidState("VisitCompilationUnit", true);
            }


            var defaultStateRule = context.defaultState();

            if (defaultStateRule == null)
            {
                GenSyntaxError().MissingDefaultState();
            }
            else
            {
                Visit(defaultStateRule);
            }

            foreach (var func in context.functionDeclaration())
            {
                Visit(func);
            }

            foreach (var state in context.definedState())
            {
                Visit(state);
            }

            return(true);
        }
        private LSLFunctionAndStateDefinitionPrePass DoFunctionAndStateDefinitionPrePass(
            LSLParser.CompilationUnitContext context)
        {
            var r = new LSLFunctionAndStateDefinitionPrePass(this, ValidatorStrategies);

            r.Visit(context);
            return(r);
        }
Example #3
0
        /// <exception cref="ArgumentNullException"><paramref name="context" /> is <c>null</c>.</exception>
        internal LSLCompilationUnitNode(LSLParser.CompilationUnitContext context, IReadOnlyGenericArray <LSLComment> comments)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            SourceRange = new LSLSourceCodeRange(context);

            SourceRangesAvailable = true;

            _comments = comments;
        }
 public ILSLTreePreePass EnterCompilationUnit(LSLParser.CompilationUnitContext context)
 {
     return(DoFunctionAndStateDefinitionPrePass(context));
 }
Example #5
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="LSLParser.compilationUnit"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitCompilationUnit([NotNull] LSLParser.CompilationUnitContext context)
 {
 }
Example #6
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="LSLParser.compilationUnit"/>.
 /// <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 VisitCompilationUnit([NotNull] LSLParser.CompilationUnitContext context)
 {
     return(VisitChildren(context));
 }