Beispiel #1
0
        private void Generate(injectionParser.GotoContext context)
        {
            var label           = context.SYMBOL().GetText();
            var gotoInstruction = new GotoInstruction(context);

            gotos.Add(label, gotoInstruction);
            AddInstruction(gotoInstruction);
        }
        public override bool VisitGoto([NotNull] injectionParser.GotoContext context)
        {
            referencedLabels.Add(context);

            if (!string.IsNullOrEmpty(context.invalid?.Text))
            {
                messages.Add(new Message(context.Start.Line, context.Start.Column, context.Stop.Line, context.Stop.Column,
                                         MessageSeverity.Warning, MessageCodes.InvalidLabelName,
                                         $"Label name '{context.SYMBOL().GetText()}' is followed by invalid characters '{context.invalid?.Text}'. Remove them, they are ignored by Injection."));
            }

            return(base.VisitGoto(context));
        }
        public override bool VisitGoto([NotNull] injectionParser.GotoContext context)
        {
            referencedLabels.Add(context);

            return(base.VisitGoto(context));
        }
 public GotoInstruction(injectionParser.GotoContext gotoSyntax)
 {
     GotoSyntax = gotoSyntax;
     Statement  = (injectionParser.StatementContext)gotoSyntax.Parent;
 }