Example #1
0
 private short yylex()
 {
     CqlLexer.Token token = null;
     token = _lexer.yylex();
     if (null == token)
     {
         return(0);
     }
     _lexer.AdvanceIPos();
     yylval = token.Value;
     return(token.TokenId);
 }
Example #2
0
        /// <summary>
        /// Internal entry point
        /// </summary>
        private void internalParseEntryPoint()
        {
            _lexer = new CqlLexer(Query, ParserOptions);
#if ENTITYSQL_PARSER_YYDEBUG
            CqlLexer.Token tk = lexer.yylex();
            while (null != tk)
            {
                Console.WriteLine("{0} := {1}", tk.TokenId, lexer.yytext());
                tk = lexer.yylex();
            }
#endif
            yyparse();
        }
Example #3
0
        internal CqlLexer.Token yylex()
        {
            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();
            }
            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]];
                if (YY_EOF == yy_lookahead && yy_initial)
                {
                    return(null);
                }
                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 System.Data.EntitySqlException(EntitySqlException.GetGenericErrorMessage(_query, yychar));
                    }
                    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 < 85)
                            {
                                yy_error(YY_E_INTERNAL, false);
                            }
                        }
                        else
                        {
                            AcceptMethod m = accept_dispatch[yy_last_accept_state];
                            if (m != null)
                            {
                                CqlLexer.Token tmp = m();
                                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();
                        }
                    }
                }
            }
        }