Пример #1
0
        public override void EnterLabeledStmt(GoParser.LabeledStmtContext context)
        {
            // labeledStmt
            //     : IDENTIFIER ':' statement

            PushBlock();
            m_labels.Add(SanitizedIdentifier(context.IDENTIFIER().GetText()), false);

            // Check labeled continue in for loop
            // Check labeled break in for loop, select and switch
        }
Пример #2
0
        public override void ExitLabeledStmt(GoParser.LabeledStmtContext context)
        {
            // labeledStmt
            //     : IDENTIFIER ':' statement

            string label     = SanitizedIdentifier(context.IDENTIFIER().GetText());
            string statement = PopBlock(false);

            m_targetFile.Append($"{label}:{CheckForCommentsRight(context)}");

            if (!WroteLineFeed)
            {
                m_targetFile.AppendLine();
            }

            m_targetFile.Append(statement);
        }
Пример #3
0
        public override void EnterLabeledStmt(GoParser.LabeledStmtContext context)
        {
            // labeledStmt
            //     : IDENTIFIER ':' statement

            PushBlock();

            string label = SanitizedIdentifier(context.IDENTIFIER()?.GetText());

            if (!string.IsNullOrEmpty(label) && !m_labels.ContainsKey(label))
            {
                m_labels.Add(label, false);
            }

            // Check labeled continue in for loop
            // Check labeled break in for loop, select and switch
        }