Beispiel #1
0
        public virtual void Error(string msg)
        {
            NoViableAltException e = new NoViableAltException(string.Empty, 0, 0, input);

            _group.ErrorManager.GroupSyntaxError(ErrorType.SYNTAX_ERROR, SourceName, e, msg);
            Recover(input, null);
        }
    // $ANTLR end "MINUS"

    // $ANTLR start "NL"
    public void mNL() // throws RecognitionException [2]
    {
        try
        {
            // E:\\DEVELOP\\Visual Studio Projects\\Vsual Studio 2010\\GameEngineSlimDX\\GEngine\\ResourcesManagers\\FBXParser\\fbx.g:21:4: ( '\\r\\n' | '\\n' | '\\r' )
            int alt1  = 3;
            int LA1_0 = input.LA(1);

            if ((LA1_0 == '\r'))
            {
                int LA1_1 = input.LA(2);

                if ((LA1_1 == '\n'))
                {
                    alt1 = 1;
                }
                else
                {
                    alt1 = 3;
                }
            }
            else if ((LA1_0 == '\n'))
            {
                alt1 = 2;
            }
            else
            {
                NoViableAltException nvae_d1s0 =
                    new NoViableAltException("", 1, 0, input);

                throw nvae_d1s0;
            }
            switch (alt1)
            {
            case 1:
                // E:\\DEVELOP\\Visual Studio Projects\\Vsual Studio 2010\\GameEngineSlimDX\\GEngine\\ResourcesManagers\\FBXParser\\fbx.g:21:5: '\\r\\n'
            {
                Match("\r\n");
            }
            break;

            case 2:
                // E:\\DEVELOP\\Visual Studio Projects\\Vsual Studio 2010\\GameEngineSlimDX\\GEngine\\ResourcesManagers\\FBXParser\\fbx.g:22:3: '\\n'
            {
                Match('\n');
            }
            break;

            case 3:
                // E:\\DEVELOP\\Visual Studio Projects\\Vsual Studio 2010\\GameEngineSlimDX\\GEngine\\ResourcesManagers\\FBXParser\\fbx.g:23:3: '\\r'
            {
                Match('\r');
            }
            break;
            }
        }
        finally
        {
        }
    }
Beispiel #3
0
        protected internal int DFA8_SpecialStateTransition(DFA dfa, int s, IIntStream _input) //throws NoViableAltException
        {
            IIntStream input = _input;
            int        _s    = s;

            switch (s)
            {
            case 0:
                int LA8_18 = input.LA(1);

                s = -1;
                if (((LA8_18 >= '\u0000' && LA8_18 <= '\uFFFF')))
                {
                    s = 43;
                }

                else
                {
                    s = 42;
                }

                if (s >= 0)
                {
                    return(s);
                }
                break;
            }
            NoViableAltException nvae8 =
                new NoViableAltException(dfa.Description, 8, _s, input);

            dfa.Error(nvae8);
            throw nvae8;
        }
Beispiel #4
0
        /// <summary>
        /// These two functions prints a stack of rules for a failure.  It sounds really useful but it's mostly noise and didn't
        /// help me locate errors any quicker (mostly slower).  Feel free to comment out.
        /// From "The ANTLR Reference" pg. 247 (translated to C#)
        /// </summary>
        public override String GetErrorMessage(RecognitionException e, String[] tokenNames)
        {
            //IList stack = GetRuleInvocationStack(e, this.GetType().Name);
            IList <string> stack = GetRuleInvocationStack(e, this.GetType().Name);
            StringBuilder  sb    = new StringBuilder();

            sb.Append("\r\n");
            foreach (object o in stack)
            {
                sb.AppendFormat("{0}\r\n", o);
            }

            if (e is NoViableAltException)
            {
                NoViableAltException nvae = (NoViableAltException)e;
                sb.AppendFormat(" no viable alt; token = {0} (decision = {1} state {2}) decision=<<{3}>>\r\n",
                                e.Token.Text,
                                nvae.decisionNumber,
                                nvae.stateNumber,
                                nvae.grammarDecisionDescription);
            }
            else
            {
                sb.Append(base.GetErrorMessage(e, tokenNames));
            }

            return(sb.ToString());
        }
Beispiel #5
0
    /// <inheritdoc/>
    protected override void ReportNoViableAlternative(Parser recognizer, NoViableAltException e)
    {
        string msg = null;

        if (this.IsInsideRule <YarnSpinnerParser.If_statementContext>(recognizer) &&
            recognizer.RuleContext is YarnSpinnerParser.StatementContext &&
            e.StartToken.Type == YarnSpinnerLexer.COMMAND_START &&
            e.OffendingToken.Type == YarnSpinnerLexer.COMMAND_ELSE)
        {
            // We are inside an if statement, we're attempting to parse a
            // statement, and we got an '<<', 'else', and we weren't able
            // to match that. The programmer included an extra '<<else>>'.
            _ = this.GetEnclosingRule <YarnSpinnerParser.If_statementContext>(recognizer);

            msg = $"More than one <<else>> statement in an <<if>> statement isn't allowed";
        }
        else if (e.StartToken.Type == YarnSpinnerLexer.COMMAND_START &&
                 e.OffendingToken.Type == YarnSpinnerLexer.COMMAND_END)
        {
            // We saw a << immediately followed by a >>. The programmer
            // forgot to include command text.
            msg = $"Command text expected";
        }

        if (msg == null)
        {
            msg = $"Unexpected \"{e.OffendingToken.Text}\" while reading {this.GetFriendlyNameForRuleContext(recognizer.RuleContext, true)}";
        }

        recognizer.NotifyErrorListeners(e.OffendingToken, msg, e);
    }
Beispiel #6
0
        protected virtual string ErrorMessageForNoViableAlternative(NoViableAltException e, Antlr4.Runtime.Parser recognizer)
        {
            ITokenStream tokens = ((ITokenStream)recognizer.InputStream);
            string       input;

            if (tokens != null)
            {
                if (e.StartToken.Type == TokenConstants.Eof)
                {
                    input = "<end of file>";
                }
                else
                {
                    input = tokens.GetText(e.StartToken, e.OffendingToken);
                }
            }
            else
            {
                input = "<unknown input>";
            }
            string msg = "no viable alternative at input " + EscapeWSAndQuote(input);

            //TEMPORARY FIX until #554 is done
            if (input == "occurs")
            {
                msg = EscapeWSAndQuote(input) + " is not supported yet";
            }

            return(msg);
        }
Beispiel #7
0
    private void mADVICE_TYPE_ELEMENT()
    {
        Enter_ADVICE_TYPE_ELEMENT();
        EnterRule("ADVICE_TYPE_ELEMENT", 19);
        TraceIn("ADVICE_TYPE_ELEMENT", 19);
        try
        {
            int _type    = ADVICE_TYPE_ELEMENT;
            int _channel = DefaultTokenChannel;
            // UniAspect.g:142:2: ( 'before' | 'after' )
            int alt1 = 2;
            try { DebugEnterDecision(1, decisionCanBacktrack[1]);
                  int LA1_0 = input.LA(1);

                  if ((LA1_0 == 'b'))
                  {
                      alt1 = 1;
                  }
                  else if ((LA1_0 == 'a'))
                  {
                      alt1 = 2;
                  }
                  else
                  {
                      NoViableAltException nvae = new NoViableAltException("", 1, 0, input);

                      DebugRecognitionException(nvae);
                      throw nvae;
                  } } finally { DebugExitDecision(1); }
            switch (alt1)
            {
            case 1:
                DebugEnterAlt(1);
                // UniAspect.g:142:4: 'before'
                {
                    DebugLocation(142, 4);
                    Match("before");
                }
                break;

            case 2:
                DebugEnterAlt(2);
                // UniAspect.g:142:15: 'after'
                {
                    DebugLocation(142, 15);
                    Match("after");
                }
                break;
            }
            state.type    = _type;
            state.channel = _channel;
        }
        finally
        {
            TraceOut("ADVICE_TYPE_ELEMENT", 19);
            LeaveRule("ADVICE_TYPE_ELEMENT", 19);
            Leave_ADVICE_TYPE_ELEMENT();
        }
    }
Beispiel #8
0
        /** Ensure x is next character on the input stream */
        public virtual void Match(char x)
        {
            if (c != x)
            {
                NoViableAltException e = new NoViableAltException(string.Empty, 0, 0, input);
                errMgr.LexerError(input.SourceName, string.Format("expecting '{0}', found '{1}'", x, GetCharString(c)), templateToken, e);
            }

            Consume();
        }
Beispiel #9
0
 private static string GetMessage(RecognitionException re)
 {
     return(re switch
     {
         FailedPredicateException fpe => fpe.Message,
         InputMismatchException ime => ime.Message,
         LexerNoViableAltException nve1 =>
         $"No Viable Alternative - '{nve1.OffendingToken.Text}' not recognized.",
         NoViableAltException nve2 =>
         $"No Viable Alternative - '{nve2.OffendingToken.Text}' was unexpected.",
         _ => throw new ArgumentOutOfRangeException(nameof(re))
     });
Beispiel #10
0
 public override void ReportError(Parser recognizer, RecognitionException e)
 {
     if (e is NoViableAltException)
     {
         NoViableAltException noViableAltException = (NoViableAltException)e;
         recognizer.NotifyErrorListeners(string.Format("syntax error at position {0}: {1}", noViableAltException.StartToken.Column, noViableAltException.StartToken.Text + e.OffendingToken.Text));
     }
     else
     {
         base.ReportError(recognizer, e);
     }
 }
    // $ANTLR end "NUMBER"

    // $ANTLR start "LETTER"
    public void mLETTER() // throws RecognitionException [2]
    {
        try
        {
            // E:\\DEVELOP\\Visual Studio Projects\\Vsual Studio 2010\\GameEngineSlimDX\\GEngine\\ResourcesManagers\\FBXParser\\fbx.g:37:8: ( ( 'a' .. 'z' ) | ( 'A' .. 'Z' ) )
            int alt10  = 2;
            int LA10_0 = input.LA(1);

            if (((LA10_0 >= 'a' && LA10_0 <= 'z')))
            {
                alt10 = 1;
            }
            else if (((LA10_0 >= 'A' && LA10_0 <= 'Z')))
            {
                alt10 = 2;
            }
            else
            {
                NoViableAltException nvae_d10s0 =
                    new NoViableAltException("", 10, 0, input);

                throw nvae_d10s0;
            }
            switch (alt10)
            {
            case 1:
                // E:\\DEVELOP\\Visual Studio Projects\\Vsual Studio 2010\\GameEngineSlimDX\\GEngine\\ResourcesManagers\\FBXParser\\fbx.g:37:9: ( 'a' .. 'z' )
            {
                // E:\\DEVELOP\\Visual Studio Projects\\Vsual Studio 2010\\GameEngineSlimDX\\GEngine\\ResourcesManagers\\FBXParser\\fbx.g:37:9: ( 'a' .. 'z' )
                // E:\\DEVELOP\\Visual Studio Projects\\Vsual Studio 2010\\GameEngineSlimDX\\GEngine\\ResourcesManagers\\FBXParser\\fbx.g:37:10: 'a' .. 'z'
                {
                    MatchRange('a', 'z');
                }
            }
            break;

            case 2:
                // E:\\DEVELOP\\Visual Studio Projects\\Vsual Studio 2010\\GameEngineSlimDX\\GEngine\\ResourcesManagers\\FBXParser\\fbx.g:37:20: ( 'A' .. 'Z' )
            {
                // E:\\DEVELOP\\Visual Studio Projects\\Vsual Studio 2010\\GameEngineSlimDX\\GEngine\\ResourcesManagers\\FBXParser\\fbx.g:37:20: ( 'A' .. 'Z' )
                // E:\\DEVELOP\\Visual Studio Projects\\Vsual Studio 2010\\GameEngineSlimDX\\GEngine\\ResourcesManagers\\FBXParser\\fbx.g:37:21: 'A' .. 'Z'
                {
                    MatchRange('A', 'Z');
                }
            }
            break;
            }
        }
        finally
        {
        }
    }
Beispiel #12
0
    private int SpecialStateTransition2(DFA dfa, int s, IIntStream _input)
    {
        IIntStream input = _input;
        int        _s    = s;

        switch (s)
        {
        case 0:
            int LA2_8 = input.LA(1);

            s = -1;
            if (((LA2_8 >= '\u0000' && LA2_8 <= '\b') || (LA2_8 >= '\u000B' && LA2_8 <= '\f') || (LA2_8 >= '\u000E' && LA2_8 <= '\u001F') || (LA2_8 >= '!' && LA2_8 <= '\'') || (LA2_8 >= '*' && LA2_8 <= '\uFFFF')))
            {
                s = 6;
            }

            else
            {
                s = 10;
            }

            if (s >= 0)
            {
                return(s);
            }
            break;

        case 1:
            int LA2_9 = input.LA(1);

            s = -1;
            if (((LA2_9 >= '\u0000' && LA2_9 <= '\b') || (LA2_9 >= '\u000B' && LA2_9 <= '\f') || (LA2_9 >= '\u000E' && LA2_9 <= '\u001F') || (LA2_9 >= '!' && LA2_9 <= '\'') || (LA2_9 >= '*' && LA2_9 <= '\uFFFF')))
            {
                s = 6;
            }

            else
            {
                s = 11;
            }

            if (s >= 0)
            {
                return(s);
            }
            break;
        }
        NoViableAltException nvae = new NoViableAltException(dfa.Description, 2, _s, input);

        dfa.Error(nvae);
        throw nvae;
    }
Beispiel #13
0
        /// <summary>
        /// Listens to some parser errors
        /// </summary>
        /// <param name="recognizer"></param>
        /// <param name="offendingSymbol"></param>
        /// <param name="line"></param>
        /// <param name="charPositionInLine"></param>
        /// <param name="msg"></param>
        /// <param name="e"></param>
        public void SyntaxError(IRecognizer recognizer, IToken offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
        {
            string message = "";

            if (e == null)
            {
                message = String.Format("Unexpected token '{0}' detected.", offendingSymbol.Text);
            }
            else if (e is NoViableAltException)
            {
                NoViableAltException noViableAltException = (NoViableAltException)e;
                message = String.Format("No viable alternative for '{1}' at input '{0}' followed by '{2}'", noViableAltException.StartToken.Text, offendingSymbol.Text, offendingSymbol.TokenSource.NextToken().Text);

                // set the line where the problem begins as the affected line
                line = noViableAltException.StartToken.Line;
            }
            else if (e is InputMismatchException)
            {
                InputMismatchException noViableAltException = (InputMismatchException)e;

                // prepare a list of suggested alternatives of the given tokens

                string expectedTokens = "(no suggestions)";

                if (noViableAltException.GetExpectedTokens().Count > 0)
                {
                    List <string> listOfExpectedTokens = new List <string>();

                    foreach (var i in noViableAltException.GetExpectedTokens().ToArray())
                    {
                        try
                        {
                            string tokenName = SyneryParser.DefaultVocabulary.GetDisplayName(i);

                            if (tokenName != null)
                            {
                                listOfExpectedTokens.Add(tokenName);
                            }
                        }
                        catch (Exception) { /* do nothing */ }
                    }

                    expectedTokens = String.Join(" or ", listOfExpectedTokens);
                }

                message = String.Format("Mismatched input '{0}'. Expected tokens {1}", offendingSymbol.Text, expectedTokens);
            }

            _ValidationResult.AddMessage(ValidationResultMessageCategoryEnum.Error, message, line, charPositionInLine, null);
        }
Beispiel #14
0
        override public bool Matches(string rule, RecognitionException ex)
        {
            if (!base.Matches(rule, ex))
            {
                return(false);
            }

            NoViableAltException nva = ex as NoViableAltException;

            if (nva == null)
            {
                return(false);
            }

            return(Token == nva.token.Type);
        }
 public override string GetErrorMessage(
     RecognitionException e,
     string[] tokenNames)
 {
     if (e is NoViableAltException)
     {
         NoViableAltException nvae = (e as NoViableAltException);
         if (errKeywords.ContainsKey(nvae.GrammarDecisionDescription))
         {
             /* Returns previous implementation format plus expected rule */
             return(string.Format("no viable alternative at input {0}. Expected {1}.",
                                  this.GetTokenErrorDisplay(e.Token), (e as NoViableAltException).GrammarDecisionDescription));
         }
     }
     return(base.GetErrorMessage(e, tokenNames));
 }
Beispiel #16
0
        protected override void ReportMissingToken([NotNull] Parser recognizer)
        {
            if (InErrorRecoveryMode(recognizer))
            {
                return;
            }
            BeginErrorCondition(recognizer);
            IToken               t         = recognizer.CurrentToken;
            IntervalSet          expecting = GetExpectedTokens(recognizer);
            string               msg       = "Expected {f:Red}<" + expecting.ToString(recognizer.Vocabulary).Trim('\'') + ">{r} at '{f:Red}" + GetTokenErrorDisplay(t).Trim('\'') + "{r}'";
            NoViableAltException e         = new NoViableAltException(recognizer)
            {
                HelpLink = "505"
            };

            NotifyErrorListeners(recognizer, msg, e);
        }
Beispiel #17
0
        public override string GetErrorMessage(RecognitionException e, string[] tokenNames)
        {
            string msg = null;

            if (e is MismatchedTokenException)
            {
                MismatchedTokenException mte = (MismatchedTokenException)e;
                msg = "mismatched character " + GetCharErrorDisplay(e.c) + " expecting " + GetCharErrorDisplay(mte.expecting);
            }
            else if (e is NoViableAltException)
            {
                NoViableAltException nvae = (NoViableAltException)e;
                // for development, can add "decision=<<"+nvae.grammarDecisionDescription+">>"
                // and "(decision="+nvae.decisionNumber+") and
                // "state "+nvae.stateNumber
                msg = "no viable alternative at character " + GetCharErrorDisplay(e.c);
            }
            else if (e is EarlyExitException)
            {
                EarlyExitException eee = (EarlyExitException)e;
                // for development, can add "(decision="+eee.decisionNumber+")"
                msg = "required (...)+ loop did not match anything at character " + GetCharErrorDisplay(e.c);
            }
            else if (e is MismatchedNotSetException)
            {
                MismatchedNotSetException mse = (MismatchedNotSetException)e;
                msg = "mismatched character " + GetCharErrorDisplay(e.c) + " expecting set " + mse.expecting;
            }
            else if (e is MismatchedSetException)
            {
                MismatchedSetException mse = (MismatchedSetException)e;
                msg = "mismatched character " + GetCharErrorDisplay(e.c) + " expecting set " + mse.expecting;
            }
            else if (e is MismatchedRangeException)
            {
                MismatchedRangeException mre = (MismatchedRangeException)e;
                msg = "mismatched character " + GetCharErrorDisplay(e.c) + " expecting set " +
                      GetCharErrorDisplay(mre.a) + ".." + GetCharErrorDisplay(mre.b);
            }
            else
            {
                msg = base.GetErrorMessage(e, tokenNames);
            }
            return(msg);
        }
Beispiel #18
0
        private IToken MatchEscape()
        {
            startCharIndex          = input.Index;
            startCharPositionInLine = input.CharPositionInLine;
            Consume(); // kill \\
            if (c == 'u')
            {
                return(MatchUnicode());
            }

            string text;

            switch (c)
            {
            case '\\':
                ConsumeLineBreak();
                return(SkipToken);

            case 'n':
                text = "\n";
                break;

            case 't':
                text = "\t";
                break;

            case ' ':
                text = " ";
                break;

            default:
                NoViableAltException e = new NoViableAltException(string.Empty, 0, 0, input);
                errMgr.LexerError(input.SourceName, string.Format("invalid escaped char: '{0}'", GetCharString(c)), templateToken, e);
                Consume();
                Match(delimiterStopChar);
                return(SkipToken);
            }

            Consume();
            IToken t = NewToken(TEXT, text, input.CharPositionInLine - 2);

            Match(delimiterStopChar);
            return(t);
        }
Beispiel #19
0
        private IToken MatchUnicode()
        {
            Consume();
            char[] chars = new char[4];
            if (!IsUnicodeLetter(c))
            {
                NoViableAltException e = new NoViableAltException(string.Empty, 0, 0, input);
                errMgr.LexerError(input.SourceName, string.Format("invalid unicode char: '{0}'", GetCharString(c)), templateToken, e);
            }

            chars[0] = c;
            Consume();
            if (!IsUnicodeLetter(c))
            {
                NoViableAltException e = new NoViableAltException(string.Empty, 0, 0, input);
                errMgr.LexerError(input.SourceName, string.Format("invalid unicode char: '{0}'", GetCharString(c)), templateToken, e);
            }

            chars[1] = c;
            Consume();
            if (!IsUnicodeLetter(c))
            {
                NoViableAltException e = new NoViableAltException(string.Empty, 0, 0, input);
                errMgr.LexerError(input.SourceName, string.Format("invalid unicode char: '{0}'", GetCharString(c)), templateToken, e);
            }

            chars[2] = c;
            Consume();
            if (!IsUnicodeLetter(c))
            {
                NoViableAltException e = new NoViableAltException(string.Empty, 0, 0, input);
                errMgr.LexerError(input.SourceName, string.Format("invalid unicode char: '{0}'", GetCharString(c)), templateToken, e);
            }

            chars[3] = c;
            // ESCAPE kills >
            char   uc = (char)int.Parse(new string(chars), NumberStyles.HexNumber);
            IToken t  = NewToken(TEXT, uc.ToString(), input.CharPositionInLine - 6);

            Consume();
            Match(delimiterStopChar);
            return(t);
        }
Beispiel #20
0
        /// <summary>
        /// Generates a human-readable error message for the given error.
        /// </summary>
        /// <param name="e">The error.</param>
        /// <param name="tokenNames">The names of the tokens in the current language.</param>
        /// <returns>A human-readable error message for the given error.</returns>
        public override string GetErrorMessage(RecognitionException e, string[] tokenNames)
        {
            string msg = null;

            if (e is MismatchedTokenException)
            {
                MismatchedTokenException mte = (MismatchedTokenException)e;
                msg = String.Format("Unexpected character: '{0}'. Expecting '{1}'.", GetCharErrorDisplay(e.Character), GetCharErrorDisplay(mte.Expecting));
            }
            else if (e is NoViableAltException)
            {
                NoViableAltException nvae = (NoViableAltException)e;
                msg = String.Format("Unexpected character: '{0}'.", GetCharErrorDisplay(e.Character));
            }
            else if (e is EarlyExitException)
            {
                EarlyExitException eee = (EarlyExitException)e;
                msg = String.Format("Unexpected character: '{0}'.", GetCharErrorDisplay(e.Character));
                //msg = "required (...)+ loop did not match anything at character " + GetCharErrorDisplay(e.Character);
            }
            else if (e is MismatchedNotSetException)
            {
                MismatchedNotSetException mse = (MismatchedNotSetException)e;
                msg = String.Format("Unexpected character: '{0}'. Expecting one of {1}.", GetCharErrorDisplay(e.Character), mse.Expecting);
            }
            else if (e is MismatchedSetException)
            {
                MismatchedSetException mse = (MismatchedSetException)e;
                msg = String.Format("Unexpected character: '{0}'. Expecting one of {1}.", GetCharErrorDisplay(e.Character), mse.Expecting);
            }
            else if (e is MismatchedRangeException)
            {
                MismatchedRangeException mre = (MismatchedRangeException)e;
                msg = String.Format("Unexpected character: '{0}'. Expecting one of '{1}..{2}'.", GetCharErrorDisplay(e.Character), GetCharErrorDisplay(mre.A), GetCharErrorDisplay(mre.B));
            }
            else
            {
                msg = base.GetErrorMessage(e, tokenNames);
            }
            return(msg);
        }
Beispiel #21
0
    // $ANTLR end "WS"

    override public void mTokens() // throws RecognitionException
    {
        // D:\\Szkolenia\\Artykuł ProgramistaMag - DSL\\Code\\DSLSamples\\HelloWorld\\Simple.g:1:10: ( ID | WS )
        int alt3  = 2;
        int LA3_0 = input.LA(1);

        if (((LA3_0 >= 'A' && LA3_0 <= 'Z') || (LA3_0 >= 'a' && LA3_0 <= 'z')))
        {
            alt3 = 1;
        }
        else if (((LA3_0 >= '\t' && LA3_0 <= '\n') || LA3_0 == '\r' || LA3_0 == ' '))
        {
            alt3 = 2;
        }
        else
        {
            NoViableAltException nvae_d3s0 =
                new NoViableAltException("", 3, 0, input);

            throw nvae_d3s0;
        }
        switch (alt3)
        {
        case 1:
            // D:\\Szkolenia\\Artykuł ProgramistaMag - DSL\\Code\\DSLSamples\\HelloWorld\\Simple.g:1:10: ID
        {
            mID();
        }
        break;

        case 2:
            // D:\\Szkolenia\\Artykuł ProgramistaMag - DSL\\Code\\DSLSamples\\HelloWorld\\Simple.g:1:13: WS
        {
            mWS();
        }
        break;
        }
    }
Beispiel #22
0
        private IToken ESCAPE()
        {
            consume(); // kill \\
            IToken t = null;

            switch (c)
            {
            case '\\':
                LINEBREAK();
                return(SKIP);

            case 'n':
                t = newToken(TEXT, "\n", input.CharPositionInLine - 2);
                break;

            case 't':
                t = newToken(TEXT, "\t", input.CharPositionInLine - 2);
                break;

            case ' ':
                t = newToken(TEXT, " ", input.CharPositionInLine - 2);
                break;

            case 'u':
                t = UNICODE();
                break;

            default:
                t = SKIP;
                NoViableAltException e = new NoViableAltException(string.Empty, 0, 0, input);
                errMgr.LexerError(input.SourceName, string.Format("invalid escaped char: '{0}'", GetCharString(c)), templateToken, e);
                break;
            }
            consume();
            match(delimiterStopChar);
            return(t);
        }
Beispiel #23
0
        protected override void ReportNoViableAlternative(Parser recognizer, NoViableAltException e)
        {
            ITokenStream tokens = ((ITokenStream)recognizer.InputStream);
            string       input;

            if (tokens != null)
            {
                if (e.StartToken.Type == TokenConstants.EOF)
                {
                    input = "<EOF>";
                }
                else
                {
                    input = tokens.GetText(e.StartToken, e.OffendingToken);
                }
            }
            else
            {
                input = "<unknown input>";
            }
            string msg = "无法决定采用哪一条匹配路径 " + EscapeWSAndQuote(input);

            NotifyErrorListeners(recognizer, msg, e);
        }
 public override void Error(NoViableAltException nvae)
 {
     DebugRecognitionException(nvae);
 }
    private void mTYPE()
    {
        EnterRule_TYPE();
        EnterRule("TYPE", 5);
        TraceIn("TYPE", 5);
        try
        {
            int _type    = TYPE;
            int _channel = DefaultTokenChannel;
            // FuncProtoToShim.g:35:6: ( ( 'integer' | 'float' | 'key' | 'vector' | 'rotation' | 'string' | 'list' ) )
            DebugEnterAlt(1);
            // FuncProtoToShim.g:35:8: ( 'integer' | 'float' | 'key' | 'vector' | 'rotation' | 'string' | 'list' )
            {
                DebugLocation(35, 8);
                // FuncProtoToShim.g:35:8: ( 'integer' | 'float' | 'key' | 'vector' | 'rotation' | 'string' | 'list' )
                int alt2 = 7;
                try { DebugEnterSubRule(2);
                      try { DebugEnterDecision(2, false);
                            switch (input.LA(1))
                            {
                            case 'i':
                            {
                                alt2 = 1;
                            }
                            break;

                            case 'f':
                            {
                                alt2 = 2;
                            }
                            break;

                            case 'k':
                            {
                                alt2 = 3;
                            }
                            break;

                            case 'v':
                            {
                                alt2 = 4;
                            }
                            break;

                            case 'r':
                            {
                                alt2 = 5;
                            }
                            break;

                            case 's':
                            {
                                alt2 = 6;
                            }
                            break;

                            case 'l':
                            {
                                alt2 = 7;
                            }
                            break;

                            default:
                            {
                                NoViableAltException nvae = new NoViableAltException("", 2, 0, input);
                                DebugRecognitionException(nvae);
                                throw nvae;
                            }
                            }
                      } finally { DebugExitDecision(2); }
                      switch (alt2)
                      {
                      case 1:
                          DebugEnterAlt(1);
                          // FuncProtoToShim.g:35:9: 'integer'
                          {
                              DebugLocation(35, 9);
                              Match("integer");
                          }
                          break;

                      case 2:
                          DebugEnterAlt(2);
                          // FuncProtoToShim.g:35:19: 'float'
                          {
                              DebugLocation(35, 19);
                              Match("float");
                          }
                          break;

                      case 3:
                          DebugEnterAlt(3);
                          // FuncProtoToShim.g:35:27: 'key'
                          {
                              DebugLocation(35, 27);
                              Match("key");
                          }
                          break;

                      case 4:
                          DebugEnterAlt(4);
                          // FuncProtoToShim.g:35:33: 'vector'
                          {
                              DebugLocation(35, 33);
                              Match("vector");
                          }
                          break;

                      case 5:
                          DebugEnterAlt(5);
                          // FuncProtoToShim.g:35:42: 'rotation'
                          {
                              DebugLocation(35, 42);
                              Match("rotation");
                          }
                          break;

                      case 6:
                          DebugEnterAlt(6);
                          // FuncProtoToShim.g:35:53: 'string'
                          {
                              DebugLocation(35, 53);
                              Match("string");
                          }
                          break;

                      case 7:
                          DebugEnterAlt(7);
                          // FuncProtoToShim.g:35:62: 'list'
                          {
                              DebugLocation(35, 62);
                              Match("list");
                          }
                          break;
                      }
                } finally { DebugExitSubRule(2); }
            }

            state.type    = _type;
            state.channel = _channel;
        }
        finally
        {
            TraceOut("TYPE", 5);
            LeaveRule("TYPE", 5);
            LeaveRule_TYPE();
        }
    }
Beispiel #26
0
        protected virtual IToken NextTokenInside()
        {
            while (true)
            {
                switch (c)
                {
                case ' ':
                case '\t':
                case '\n':
                case '\r':
                    Consume();
                    return(SkipToken);

                case '.':
                    Consume();
                    if (input.LA(1) == '.' && input.LA(2) == '.')
                    {
                        Consume();
                        Match('.');
                        return(NewToken(ELLIPSIS));
                    }
                    return(NewToken(DOT));

                case ',':
                    Consume();
                    return(NewToken(COMMA));

                case ':':
                    Consume();
                    return(NewToken(COLON));

                case ';':
                    Consume();
                    return(NewToken(SEMI));

                case '(':
                    Consume();
                    return(NewToken(LPAREN));

                case ')':
                    Consume();
                    return(NewToken(RPAREN));

                case '[':
                    Consume();
                    return(NewToken(LBRACK));

                case ']':
                    Consume();
                    return(NewToken(RBRACK));

                case '=':
                    Consume();
                    return(NewToken(EQUALS));

                case '!':
                    Consume();
                    return(NewToken(BANG));

                case '@':
                    Consume();
                    if (c == 'e' && input.LA(2) == 'n' && input.LA(3) == 'd')
                    {
                        Consume();
                        Consume();
                        Consume();
                        return(NewToken(REGION_END));
                    }
                    return(NewToken(AT));

                case '"':
                    return(MatchString());

                case '&':
                    Consume();
                    Match('&');
                    return(NewToken(AND)); // &&

                case '|':
                    Consume();
                    Match('|');
                    return(NewToken(OR)); // ||

                case '{':
                    return(MatchSubTemplate());

                default:
                    if (c == delimiterStopChar)
                    {
                        Consume();
                        scanningInsideExpr = false;
                        return(NewToken(RDELIM));
                    }

                    if (IsIDStartLetter(c))
                    {
                        IToken id = MatchIdentifier();
                        switch (id.Text ?? string.Empty)
                        {
                        case "if":
                            return(NewToken(IF));

                        case "endif":
                            return(NewToken(ENDIF));

                        case "else":
                            return(NewToken(ELSE));

                        case "elseif":
                            return(NewToken(ELSEIF));

                        case "super":
                            return(NewToken(SUPER));

                        case "true":
                            return(NewToken(TRUE));

                        case "false":
                            return(NewToken(FALSE));

                        default:
                            return(id);
                        }
                    }

                    RecognitionException re = new NoViableAltException(string.Empty, 0, 0, input);
                    re.Line = startLine;
                    re.CharPositionInLine = startCharPositionInLine;
                    errMgr.LexerError(input.SourceName, string.Format("invalid character '{0}'", GetCharString(c)), templateToken, re);
                    if (c == EOF)
                    {
                        return(NewToken(EOF_TYPE));
                    }

                    Consume();
                    break;
                }
            }
        }
    private void proposicion()
    {
        EnterRule_proposicion();
        EnterRule("proposicion", 3);
        TraceIn("proposicion", 3);
        try { DebugEnterRule(GrammarFileName, "proposicion");
              DebugLocation(10, 1);
              if (RuleLevel == 0)
              {
                  DebugListener.Commence();
              }
              IncRuleLevel();
              try
              {
                  // C:\\Users\\dany_\\Desktop\\antlr2020.g:11:2: ( ( instruccion | directiva ) ( '\\n' )? )
                  DebugEnterAlt(1);
                  // C:\\Users\\dany_\\Desktop\\antlr2020.g:11:4: ( instruccion | directiva ) ( '\\n' )?
                  {
                      DebugLocation(11, 4);
                      // C:\\Users\\dany_\\Desktop\\antlr2020.g:11:4: ( instruccion | directiva )
                      int alt2 = 2;
                      try { DebugEnterSubRule(2);
                            try { DebugEnterDecision(2, decisionCanBacktrack[2]);
                                  int LA2_0 = input.LA(1);

                                  if ((LA2_0 == NOMBRE))
                                  {
                                      int LA2_1 = input.LA(2);

                                      if ((LA2_1 == TIPODIRECTIVA))
                                      {
                                          alt2 = 2;
                                      }
                                      else if ((LA2_1 == OPERACION))
                                      {
                                          alt2 = 1;
                                      }
                                      else
                                      {
                                          NoViableAltException nvae = new NoViableAltException("", 2, 1, input);
                                          DebugRecognitionException(nvae);
                                          throw nvae;
                                      }
                                  }
                                  else if ((LA2_0 == OPERACION))
                                  {
                                      alt2 = 1;
                                  }
                                  else
                                  {
                                      NoViableAltException nvae = new NoViableAltException("", 2, 0, input);
                                      DebugRecognitionException(nvae);
                                      throw nvae;
                                  } } finally { DebugExitDecision(2); }
                            switch (alt2)
                            {
                            case 1:
                                DebugEnterAlt(1);
                                // C:\\Users\\dany_\\Desktop\\antlr2020.g:11:5: instruccion
                                {
                                    DebugLocation(11, 5);
                                    PushFollow(Follow._instruccion_in_proposicion66);
                                    instruccion();
                                    PopFollow();
                                }
                                break;

                            case 2:
                                DebugEnterAlt(2);
                                // C:\\Users\\dany_\\Desktop\\antlr2020.g:11:17: directiva
                                {
                                    DebugLocation(11, 17);
                                    PushFollow(Follow._directiva_in_proposicion68);
                                    directiva();
                                    PopFollow();
                                }
                                break;
                            }
                      } finally { DebugExitSubRule(2); }

                      DebugLocation(11, 27);
                      // C:\\Users\\dany_\\Desktop\\antlr2020.g:11:27: ( '\\n' )?
                      int alt3 = 2;
                      try { DebugEnterSubRule(3);
                            try { DebugEnterDecision(3, decisionCanBacktrack[3]);
                                  int LA3_0 = input.LA(1);

                                  if ((LA3_0 == 17))
                                  {
                                      alt3 = 1;
                                  }
                            } finally { DebugExitDecision(3); }
                            switch (alt3)
                            {
                            case 1:
                                DebugEnterAlt(1);
                                // C:\\Users\\dany_\\Desktop\\antlr2020.g:11:27: '\\n'
                                {
                                    DebugLocation(11, 27);
                                    Match(input, 17, Follow._17_in_proposicion70);
                                }
                                break;
                            }
                      } finally { DebugExitSubRule(3); }
                  }
              }
              catch (RecognitionException re)
              {
                  ReportError(re);
                  Recover(input, re);
              }
              finally
              {
                  TraceOut("proposicion", 3);
                  LeaveRule("proposicion", 3);
                  LeaveRule_proposicion();
              }
              DebugLocation(12, 1); } finally { DebugExitRule(GrammarFileName, "proposicion"); }
        DecRuleLevel();
        if (RuleLevel == 0)
        {
            DebugListener.Terminate();
        }
        return;
    }
Beispiel #28
0
    // $ANTLR start "qualified_name"
    // ..\\Plugin.postgre\\AntlrParser\\PostgreSQL.g:30:1: qualified_name returns [NameWithSchema result] : ( (schema= id DOT name= id ) | (name= id ) );
    public PostgreSQLParser.qualified_name_return qualified_name() // throws RecognitionException [1]
    {
        PostgreSQLParser.qualified_name_return retval = new PostgreSQLParser.qualified_name_return();
        retval.Start = input.LT(1);

        object root_0 = null;

        IToken DOT15 = null;

        PostgreSQLParser.id_return schema = default(PostgreSQLParser.id_return);

        PostgreSQLParser.id_return name = default(PostgreSQLParser.id_return);


        object DOT15_tree = null;

        try
        {
            // ..\\Plugin.postgre\\AntlrParser\\PostgreSQL.g:31:2: ( (schema= id DOT name= id ) | (name= id ) )
            int alt6  = 2;
            int LA6_0 = input.LA(1);

            if (((LA6_0 >= T_IDENT && LA6_0 <= T_QUOTED_IDENT)))
            {
                int LA6_1 = input.LA(2);

                if (((LA6_1 >= USING && LA6_1 <= LPAREN)))
                {
                    alt6 = 2;
                }
                else if ((LA6_1 == DOT))
                {
                    alt6 = 1;
                }
                else
                {
                    NoViableAltException nvae_d6s1 =
                        new NoViableAltException("", 6, 1, input);

                    throw nvae_d6s1;
                }
            }
            else
            {
                NoViableAltException nvae_d6s0 =
                    new NoViableAltException("", 6, 0, input);

                throw nvae_d6s0;
            }
            switch (alt6)
            {
            case 1:
                // ..\\Plugin.postgre\\AntlrParser\\PostgreSQL.g:31:4: (schema= id DOT name= id )
            {
                root_0 = (object)adaptor.GetNilNode();

                // ..\\Plugin.postgre\\AntlrParser\\PostgreSQL.g:31:4: (schema= id DOT name= id )
                // ..\\Plugin.postgre\\AntlrParser\\PostgreSQL.g:31:5: schema= id DOT name= id
                {
                    PushFollow(FOLLOW_id_in_qualified_name166);
                    schema = id();
                    state.followingStackPointer--;

                    adaptor.AddChild(root_0, schema.Tree);
                    DOT15      = (IToken)Match(input, DOT, FOLLOW_DOT_in_qualified_name168);
                    DOT15_tree = (object)adaptor.Create(DOT15);
                    adaptor.AddChild(root_0, DOT15_tree);

                    PushFollow(FOLLOW_id_in_qualified_name172);
                    name = id();
                    state.followingStackPointer--;

                    adaptor.AddChild(root_0, name.Tree);
                    retval.result = new NameWithSchema(UnquoteName(((schema != null) ? input.ToString((IToken)(schema.Start), (IToken)(schema.Stop)) : null)), UnquoteName(((name != null) ? input.ToString((IToken)(name.Start), (IToken)(name.Stop)) : null)));
                }
            }
            break;

            case 2:
                // ..\\Plugin.postgre\\AntlrParser\\PostgreSQL.g:32:6: (name= id )
            {
                root_0 = (object)adaptor.GetNilNode();

                // ..\\Plugin.postgre\\AntlrParser\\PostgreSQL.g:32:6: (name= id )
                // ..\\Plugin.postgre\\AntlrParser\\PostgreSQL.g:32:7: name= id
                {
                    PushFollow(FOLLOW_id_in_qualified_name188);
                    name = id();
                    state.followingStackPointer--;

                    adaptor.AddChild(root_0, name.Tree);
                    retval.result = new NameWithSchema(UnquoteName(((name != null) ? input.ToString((IToken)(name.Start), (IToken)(name.Stop)) : null)));
                }
            }
            break;
            }
            retval.Stop = input.LT(-1);

            retval.Tree = (object)adaptor.RulePostProcessing(root_0);
            adaptor.SetTokenBoundaries(retval.Tree, (IToken)retval.Start, (IToken)retval.Stop);
        }
        catch (RecognitionException re)
        {
            ReportError(re);
            Recover(input, re);
            // Conversion of the second argument necessary, but harmless
            retval.Tree = (object)adaptor.ErrorNode(input, (IToken)retval.Start, input.LT(-1), re);
        }
        finally
        {
        }
        return(retval);
    }
    // $ANTLR end "WS"

    public override void mTokens()
    {
        // C:\\Users\\dany_\\Desktop\\prueba.g:1:8: ( PARENI | PAREND | MAS | MENOS | POR | INT | ENTRE | NEWLINE | WS )
        int alt3 = 9;

        try { DebugEnterDecision(3, decisionCanBacktrack[3]);
              switch (input.LA(1))
              {
              case '(':
              {
                  alt3 = 1;
              }
              break;

              case ')':
              {
                  alt3 = 2;
              }
              break;

              case '+':
              {
                  alt3 = 3;
              }
              break;

              case '-':
              {
                  alt3 = 4;
              }
              break;

              case '*':
              {
                  alt3 = 5;
              }
              break;

              case '0':
              case '1':
              case '2':
              case '3':
              case '4':
              case '5':
              case '6':
              case '7':
              case '8':
              case '9':
              {
                  alt3 = 6;
              }
              break;

              case '/':
              {
                  alt3 = 7;
              }
              break;

              case '\n':
              {
                  int LA3_8 = input.LA(2);

                  if (((LA3_8 >= '\t' && LA3_8 <= '\n') || LA3_8 == '\r' || LA3_8 == ' '))
                  {
                      alt3 = 9;
                  }
                  else
                  {
                      alt3 = 8;
                  }
              }
              break;

              case '\t':
              case '\r':
              case ' ':
              {
                  alt3 = 9;
              }
              break;

              default:
              {
                  NoViableAltException nvae = new NoViableAltException("", 3, 0, input);
                  DebugRecognitionException(nvae);
                  throw nvae;
              }
              }
        } finally { DebugExitDecision(3); }
        switch (alt3)
        {
        case 1:
            DebugEnterAlt(1);
            // C:\\Users\\dany_\\Desktop\\prueba.g:1:10: PARENI
            {
                DebugLocation(1, 10);
                mPARENI();
            }
            break;

        case 2:
            DebugEnterAlt(2);
            // C:\\Users\\dany_\\Desktop\\prueba.g:1:17: PAREND
            {
                DebugLocation(1, 17);
                mPAREND();
            }
            break;

        case 3:
            DebugEnterAlt(3);
            // C:\\Users\\dany_\\Desktop\\prueba.g:1:24: MAS
            {
                DebugLocation(1, 24);
                mMAS();
            }
            break;

        case 4:
            DebugEnterAlt(4);
            // C:\\Users\\dany_\\Desktop\\prueba.g:1:28: MENOS
            {
                DebugLocation(1, 28);
                mMENOS();
            }
            break;

        case 5:
            DebugEnterAlt(5);
            // C:\\Users\\dany_\\Desktop\\prueba.g:1:34: POR
            {
                DebugLocation(1, 34);
                mPOR();
            }
            break;

        case 6:
            DebugEnterAlt(6);
            // C:\\Users\\dany_\\Desktop\\prueba.g:1:38: INT
            {
                DebugLocation(1, 38);
                mINT();
            }
            break;

        case 7:
            DebugEnterAlt(7);
            // C:\\Users\\dany_\\Desktop\\prueba.g:1:42: ENTRE
            {
                DebugLocation(1, 42);
                mENTRE();
            }
            break;

        case 8:
            DebugEnterAlt(8);
            // C:\\Users\\dany_\\Desktop\\prueba.g:1:48: NEWLINE
            {
                DebugLocation(1, 48);
                mNEWLINE();
            }
            break;

        case 9:
            DebugEnterAlt(9);
            // C:\\Users\\dany_\\Desktop\\prueba.g:1:56: WS
            {
                DebugLocation(1, 56);
                mWS();
            }
            break;
        }
    }
Beispiel #30
0
        // $ANTLR end "CLOSEBRACKET"

        public override void mTokens()
        {
            // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:8: ( T__9 | T__10 | T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | DIGIT | SPACE | COMMA | OPENBRACKET | CLOSEBRACKET )
            int alt1 = 17;

            try { DebugEnterDecision(1, decisionCanBacktrack[1]);
                  switch (input.LA(1))
                  {
                  case 'A':
                  {
                      alt1 = 1;
                  }
                  break;

                  case 'D':
                  {
                      alt1 = 2;
                  }
                  break;

                  case 'F':
                  {
                      int LA1_2 = input.LA(2);

                      if ((LA1_2 == 'i'))
                      {
                          int LA1_3 = input.LA(3);

                          if ((LA1_3 == 'l'))
                          {
                              int LA1_4 = input.LA(4);

                              if ((LA1_4 == 'e'))
                              {
                                  int LA1_5 = input.LA(5);

                                  if ((LA1_5 == 'E'))
                                  {
                                      alt1 = 3;
                                  }
                                  else if ((LA1_5 == 'N'))
                                  {
                                      alt1 = 4;
                                  }
                                  else
                                  {
                                      NoViableAltException nvae = new NoViableAltException("", 1, 23, input, 5);
                                      DebugRecognitionException(nvae);
                                      throw nvae;
                                  }
                              }
                              else
                              {
                                  NoViableAltException nvae = new NoViableAltException("", 1, 18, input, 4);
                                  DebugRecognitionException(nvae);
                                  throw nvae;
                              }
                          }
                          else
                          {
                              NoViableAltException nvae = new NoViableAltException("", 1, 13, input, 3);
                              DebugRecognitionException(nvae);
                              throw nvae;
                          }
                      }
                      else
                      {
                          NoViableAltException nvae = new NoViableAltException("", 1, 3, input, 2);
                          DebugRecognitionException(nvae);
                          throw nvae;
                      }
                  }
                  break;

                  case 'L':
                  {
                      int LA1_2 = input.LA(2);

                      if ((LA1_2 == 'e'))
                      {
                          int LA1_3 = input.LA(3);

                          if ((LA1_3 == 'f'))
                          {
                              alt1 = 5;
                          }
                          else if ((LA1_3 == 'n'))
                          {
                              alt1 = 6;
                          }
                          else
                          {
                              NoViableAltException nvae = new NoViableAltException("", 1, 14, input, 3);
                              DebugRecognitionException(nvae);
                              throw nvae;
                          }
                      }
                      else if ((LA1_2 == 'o'))
                      {
                          alt1 = 7;
                      }
                      else
                      {
                          NoViableAltException nvae = new NoViableAltException("", 1, 4, input, 2);
                          DebugRecognitionException(nvae);
                          throw nvae;
                      }
                  }
                  break;

                  case 'P':
                  {
                      alt1 = 8;
                  }
                  break;

                  case 'R':
                  {
                      int LA1_2 = input.LA(2);

                      if ((LA1_2 == 'e'))
                      {
                          int LA1_3 = input.LA(3);

                          if ((LA1_3 == 'm'))
                          {
                              alt1 = 9;
                          }
                          else if ((LA1_3 == 'v'))
                          {
                              alt1 = 10;
                          }
                          else
                          {
                              NoViableAltException nvae = new NoViableAltException("", 1, 16, input, 3);
                              DebugRecognitionException(nvae);
                              throw nvae;
                          }
                      }
                      else if ((LA1_2 == 'i'))
                      {
                          alt1 = 11;
                      }
                      else
                      {
                          NoViableAltException nvae = new NoViableAltException("", 1, 6, input, 2);
                          DebugRecognitionException(nvae);
                          throw nvae;
                      }
                  }
                  break;

                  case 'U':
                  {
                      alt1 = 12;
                  }
                  break;

                  case '0':
                  case '1':
                  case '2':
                  case '3':
                  case '4':
                  case '5':
                  case '6':
                  case '7':
                  case '8':
                  case '9':
                  {
                      alt1 = 13;
                  }
                  break;

                  case ' ':
                  {
                      alt1 = 14;
                  }
                  break;

                  case ',':
                  {
                      alt1 = 15;
                  }
                  break;

                  case '(':
                  {
                      alt1 = 16;
                  }
                  break;

                  case ')':
                  {
                      alt1 = 17;
                  }
                  break;

                  default:
                  {
                      NoViableAltException nvae = new NoViableAltException("", 1, 0, input, 1);
                      DebugRecognitionException(nvae);
                      throw nvae;
                  }
                  }
            } finally { DebugExitDecision(1); }
            switch (alt1)
            {
            case 1:
                DebugEnterAlt(1);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:10: T__9
                {
                    DebugLocation(1, 10);
                    mT__9();
                }
                break;

            case 2:
                DebugEnterAlt(2);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:15: T__10
                {
                    DebugLocation(1, 15);
                    mT__10();
                }
                break;

            case 3:
                DebugEnterAlt(3);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:21: T__11
                {
                    DebugLocation(1, 21);
                    mT__11();
                }
                break;

            case 4:
                DebugEnterAlt(4);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:27: T__12
                {
                    DebugLocation(1, 27);
                    mT__12();
                }
                break;

            case 5:
                DebugEnterAlt(5);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:33: T__13
                {
                    DebugLocation(1, 33);
                    mT__13();
                }
                break;

            case 6:
                DebugEnterAlt(6);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:39: T__14
                {
                    DebugLocation(1, 39);
                    mT__14();
                }
                break;

            case 7:
                DebugEnterAlt(7);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:45: T__15
                {
                    DebugLocation(1, 45);
                    mT__15();
                }
                break;

            case 8:
                DebugEnterAlt(8);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:51: T__16
                {
                    DebugLocation(1, 51);
                    mT__16();
                }
                break;

            case 9:
                DebugEnterAlt(9);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:57: T__17
                {
                    DebugLocation(1, 57);
                    mT__17();
                }
                break;

            case 10:
                DebugEnterAlt(10);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:63: T__18
                {
                    DebugLocation(1, 63);
                    mT__18();
                }
                break;

            case 11:
                DebugEnterAlt(11);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:69: T__19
                {
                    DebugLocation(1, 69);
                    mT__19();
                }
                break;

            case 12:
                DebugEnterAlt(12);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:75: T__20
                {
                    DebugLocation(1, 75);
                    mT__20();
                }
                break;

            case 13:
                DebugEnterAlt(13);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:81: DIGIT
                {
                    DebugLocation(1, 81);
                    mDIGIT();
                }
                break;

            case 14:
                DebugEnterAlt(14);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:87: SPACE
                {
                    DebugLocation(1, 87);
                    mSPACE();
                }
                break;

            case 15:
                DebugEnterAlt(15);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:93: COMMA
                {
                    DebugLocation(1, 93);
                    mCOMMA();
                }
                break;

            case 16:
                DebugEnterAlt(16);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:99: OPENBRACKET
                {
                    DebugLocation(1, 99);
                    mOPENBRACKET();
                }
                break;

            case 17:
                DebugEnterAlt(17);
                // D:\\Patrick\\FigLeaf\\fig-leaf\\FigLeaf.Core\\FigLeafPasswordRule.g:1:111: CLOSEBRACKET
                {
                    DebugLocation(1, 111);
                    mCLOSEBRACKET();
                }
                break;
            }
        }
Beispiel #31
0
 /** Used for debugging in adaptivePredict around execATN but I cut
  *  it out for clarity now that alg. works well. We can leave this
  *  "dead" code for a bit.
  */
 public void DumpDeadEndConfigs(NoViableAltException nvae)
 {
     Console.Error.WriteLine("dead end configs: ");
     foreach (ATNConfig c in nvae.DeadEndConfigs.configs)
     {
         String trans = "no edges";
         if (c.state.NumberOfTransitions > 0)
         {
             Transition t = c.state.Transition(0);
             if (t is AtomTransition)
             {
                 AtomTransition at = (AtomTransition)t;
                 trans = "Atom " + GetTokenName(at.token);
             }
             else if (t is SetTransition)
             {
                 SetTransition st = (SetTransition)t;
                 bool not = st is NotSetTransition;
                 trans = (not ? "~" : "") + "Set " + st.set.ToString();
             }
         }
         Console.Error.WriteLine(c.ToString(parser, true) + ":" + trans);
     }
 }