Пример #1
0
        public Token getNextToken()
        {
            char yy_lookahead;
            int  yy_anchor            = YY_NO_ANCHOR;
            int  yy_state             = yy_state_dtrans[yy_lexical_state];
            int  yy_next_state        = YY_NO_STATE;
            int  yy_last_accept_state = YY_NO_STATE;
            bool yy_initial           = true;
            int  yy_this_accept;

            yy_mark_start();
            yy_this_accept = yy_acpt[yy_state];
            if (YY_NOT_ACCEPT != yy_this_accept)
            {
                yy_last_accept_state = yy_state;
                yy_mark_end();
            }

            // begin_str

            while (true)
            {
                if (yy_initial && yy_at_bol)
                {
                    yy_lookahead = (char)YY_BOL;
                }
                else
                {
                    yy_lookahead = yy_advance();
                }

                yy_next_state = yy_nxt[yy_rmap[yy_state], yy_cmap[yy_lookahead]];

                // state_str

                if (YY_EOF == yy_lookahead && yy_initial)
                {
                    // EOF_Test()

                    if (commentStart != -1)
                    {
                        currentToken = new Token(commentStart, yychar + yytext().Length, TokenType.BadCharacter);
                        return(currentToken);
                    }

                    currentToken = new Token(yychar, yychar + yytext().Length, TokenType.Eof);
                    return(currentToken);
                }

                if (YY_F != yy_next_state)
                {
                    yy_state       = yy_next_state;
                    yy_initial     = false;
                    yy_this_accept = yy_acpt[yy_state];
                    if (YY_NOT_ACCEPT != yy_this_accept)
                    {
                        yy_last_accept_state = yy_state;
                        yy_mark_end();
                    }
                }
                else
                {
                    if (YY_NO_STATE == yy_last_accept_state)
                    {
                        throw new ApplicationException("Lexical Error: Unmatched Input.");
                    }
                    else
                    {
                        yy_anchor = yy_acpt[yy_last_accept_state];
                        if (0 != (YY_END & yy_anchor))
                        {
                            yy_move_end();
                        }

                        yy_to_mark();
                        if (yy_last_accept_state < 0)
                        {
                            if (yy_last_accept_state < 42) // spec.accept_list.Count
                            {
                                yy_error(YY_E_INTERNAL, false);
                            }
                        }
                        else
                        {
                            AcceptMethod m = accept_dispatch[yy_last_accept_state];
                            if (m != null)
                            {
                                Token tmp = m(); // spec.type_name
                                if (tmp != null)
                                {
                                    return(tmp);
                                }
                            }
                        }

                        yy_initial           = true;
                        yy_state             = yy_state_dtrans[yy_lexical_state];
                        yy_next_state        = YY_NO_STATE;
                        yy_last_accept_state = YY_NO_STATE;
                        yy_mark_start();
                        yy_this_accept = yy_acpt[yy_state];
                        if (YY_NOT_ACCEPT != yy_this_accept)
                        {
                            yy_last_accept_state = yy_state;
                            yy_mark_end();
                        }
                    }
                }
            }

            #endregion
        }
Пример #2
0
 Token Accept_30()
 {
     currentToken = new Token(yychar, yychar + yytext().Length, TokenType.Number);
     return(currentToken);
 }
Пример #3
0
 Token Accept_34()
 {
     currentToken = new Token(yychar, yychar + yytext().Length, TokenType.BadCharacter);
     return(currentToken);
 }
Пример #4
0
 Token Accept_27()
 {
     currentToken = new Token(yychar, yychar + yytext().Length, TokenType.String);
     return(currentToken);
 }
Пример #5
0
 Token Accept_8()
 {
     currentToken = new Token(yychar, yychar + yytext().Length, TokenType.SinglelineComment);
     return(currentToken);
 }
Пример #6
0
 Token Accept_6()
 {
     currentToken = new Token(yychar, yychar + yytext().Length, TokenType.Whitespace);
     return(currentToken);
 }
Пример #7
0
 Token Accept_4()
 {
     currentToken = new Token(yychar, yychar + yytext().Length, TokenType.Identifier);
     return(currentToken);
 }
Пример #8
0
 void userInit()
 {
     currentToken = null;
     commentDepth = -1;
     commentStart = -1;
 }