Exemple #1
0
        public override bool VisitLabelStatement(LSLParser.LabelStatementContext context)
        {
            if (context == null || context.label_name == null)
            {
                throw LSLCodeValidatorInternalException.VisitContextInvalidState("VisitLabelStatement", true);
            }


            if (_scopingManager.LabelPreDefinedAnywhere(context.label_name.Text))
            {
                GenSyntaxError().RedefinedLabel(new LSLSourceCodeRange(context), context.label_name.Text);
                return(false);
            }


            var ctx = new LSLLabelStatementNode(context);

            var statementIndexInfo = _statementIndexStack.Peek();

            ctx.ParentScopeId = statementIndexInfo.ScopeId;

            ctx.StatementIndex = statementIndexInfo.Index;

            _scopingManager.PreDefineLabel(context.label_name.Text, ctx);


            return(base.VisitLabelStatement(context));
        }
        internal LSLLabelStatementNode(LSLParser.LabelStatementContext context)
        {
            LabelName = context.label_name.Text;

            SourceRange = new LSLSourceCodeRange(context);

            SourceRangeLabelName   = new LSLSourceCodeRange(context.label_name);
            SourceRangeLabelPrefix = new LSLSourceCodeRange(context.label_prefix);
            SourceRangeSemicolon   = new LSLSourceCodeRange(context.semi_colon);

            SourceRangesAvailable = true;
        }
Exemple #3
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="LSLParser.labelStatement"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitLabelStatement([NotNull] LSLParser.LabelStatementContext context)
 {
 }
 /// <summary>
 /// Visit a parse tree produced by <see cref="LSLParser.labelStatement"/>.
 /// <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 VisitLabelStatement([NotNull] LSLParser.LabelStatementContext context)
 {
     return(VisitChildren(context));
 }