| 900 | */ |
| 901 | |
| 902 | int MYSQLlex(YYSTYPE *yylval, THD *thd) |
| 903 | { |
| 904 | Lex_input_stream *lip= & thd->m_parser_state->m_lip; |
| 905 | int token; |
| 906 | |
| 907 | if (lip->lookahead_token >= 0) |
| 908 | { |
| 909 | /* |
| 910 | The next token was already parsed in advance, |
| 911 | return it. |
| 912 | */ |
| 913 | token= lip->lookahead_token; |
| 914 | lip->lookahead_token= -1; |
| 915 | *yylval= *(lip->lookahead_yylval); |
| 916 | lip->lookahead_yylval= NULL; |
| 917 | lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, token, yylval); |
| 918 | return token; |
| 919 | } |
| 920 | |
| 921 | token= lex_one_token(yylval, thd); |
| 922 | |
| 923 | switch(token) { |
| 924 | case WITH: |
| 925 | /* |
| 926 | Parsing 'WITH' 'ROLLUP' or 'WITH' 'CUBE' requires 2 look ups, |
| 927 | which makes the grammar LALR(2). |
| 928 | Replace by a single 'WITH_ROLLUP' or 'WITH_CUBE' token, |
| 929 | to transform the grammar into a LALR(1) grammar, |
| 930 | which sql_yacc.yy can process. |
| 931 | */ |
| 932 | token= lex_one_token(yylval, thd); |
| 933 | switch(token) { |
| 934 | case CUBE_SYM: |
| 935 | lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, WITH_CUBE_SYM, |
| 936 | yylval); |
| 937 | return WITH_CUBE_SYM; |
| 938 | case ROLLUP_SYM: |
| 939 | lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, WITH_ROLLUP_SYM, |
| 940 | yylval); |
| 941 | return WITH_ROLLUP_SYM; |
| 942 | default: |
| 943 | /* |
| 944 | Save the token following 'WITH' |
| 945 | */ |
| 946 | lip->lookahead_yylval= lip->yylval; |
| 947 | lip->yylval= NULL; |
| 948 | lip->lookahead_token= token; |
| 949 | lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, WITH, yylval); |
| 950 | return WITH; |
| 951 | } |
| 952 | break; |
| 953 | default: |
| 954 | break; |
| 955 | } |
| 956 | |
| 957 | lip->m_digest_psi= MYSQL_ADD_TOKEN(lip->m_digest_psi, token, yylval); |
| 958 | return token; |
| 959 | } |
nothing calls this directly
no test coverage detected