pl_scan.c
来自「postgresql8.3.4源码,开源数据库」· C语言 代码 · 共 2,225 行 · 第 1/5 页
C
2,225 行
#line 160 "scan.l"{ return K_STRICT; } YY_BREAKcase 50:YY_RULE_SETUP#line 161 "scan.l"{ return K_THEN; } YY_BREAKcase 51:YY_RULE_SETUP#line 162 "scan.l"{ return K_TO; } YY_BREAKcase 52:YY_RULE_SETUP#line 163 "scan.l"{ return K_TYPE; } YY_BREAKcase 53:YY_RULE_SETUP#line 164 "scan.l"{ return K_WARNING; } YY_BREAKcase 54:YY_RULE_SETUP#line 165 "scan.l"{ return K_WHEN; } YY_BREAKcase 55:YY_RULE_SETUP#line 166 "scan.l"{ return K_WHILE; } YY_BREAKcase 56:YY_RULE_SETUP#line 168 "scan.l"{ return O_OPTION; } YY_BREAKcase 57:YY_RULE_SETUP#line 169 "scan.l"{ return O_DUMP; } YY_BREAK/* ---------- * Special word rules * * We set plpgsql_error_lineno in each rule so that errors reported * in the pl_comp.c subroutines will point to the right place. * ---------- */case 58:YY_RULE_SETUP#line 179 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_word(yytext); } YY_BREAKcase 59:YY_RULE_SETUP#line 182 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_dblword(yytext); } YY_BREAKcase 60:YY_RULE_SETUP#line 185 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_tripword(yytext); } YY_BREAKcase 61:YY_RULE_SETUP#line 188 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_wordtype(yytext); } YY_BREAKcase 62:YY_RULE_SETUP#line 191 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_dblwordtype(yytext); } YY_BREAKcase 63:YY_RULE_SETUP#line 194 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_tripwordtype(yytext); } YY_BREAKcase 64:YY_RULE_SETUP#line 197 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_wordrowtype(yytext); } YY_BREAKcase 65:YY_RULE_SETUP#line 200 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_dblwordrowtype(yytext); } YY_BREAKcase 66:YY_RULE_SETUP#line 203 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_word(yytext); } YY_BREAKcase 67:YY_RULE_SETUP#line 206 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_dblword(yytext); } YY_BREAKcase 68:YY_RULE_SETUP#line 209 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_tripword(yytext); } YY_BREAKcase 69:YY_RULE_SETUP#line 212 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_wordtype(yytext); } YY_BREAKcase 70:YY_RULE_SETUP#line 215 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_dblwordtype(yytext); } YY_BREAKcase 71:YY_RULE_SETUP#line 218 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_tripwordtype(yytext); } YY_BREAKcase 72:YY_RULE_SETUP#line 221 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_wordrowtype(yytext); } YY_BREAKcase 73:YY_RULE_SETUP#line 224 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); return plpgsql_parse_dblwordrowtype(yytext); } YY_BREAKcase 74:YY_RULE_SETUP#line 228 "scan.l"{ return T_NUMBER; } YY_BREAKcase 75:YY_RULE_SETUP#line 230 "scan.l"{ plpgsql_error_lineno = plpgsql_scanner_lineno(); ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("unterminated quoted identifier"))); } YY_BREAK/* ---------- * Ignore whitespaces but remember this happened * ---------- */case 76:YY_RULE_SETUP#line 241 "scan.l"{ plpgsql_SpaceScanned = true; } YY_BREAK/* ---------- * Eat up comments * ---------- */case 77:YY_RULE_SETUP#line 247 "scan.l"; YY_BREAKcase 78:YY_RULE_SETUP#line 249 "scan.l"{ start_lineno = plpgsql_scanner_lineno(); BEGIN(IN_COMMENT); } YY_BREAKcase 79:YY_RULE_SETUP#line 252 "scan.l"{ BEGIN(INITIAL); plpgsql_SpaceScanned = true; } YY_BREAKcase 80:YY_RULE_SETUP#line 253 "scan.l"; YY_BREAKcase 81:YY_RULE_SETUP#line 254 "scan.l"; YY_BREAKcase YY_STATE_EOF(IN_COMMENT):#line 255 "scan.l"{ plpgsql_error_lineno = start_lineno; ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("unterminated comment"))); } YY_BREAK/* ---------- * Collect anything inside of ''s and return one STRING token * * Hacking yytext/yyleng here lets us avoid using yymore(), which is * a win for performance. It's safe because we know the underlying * input buffer is not changing. * ---------- */case 82:YY_RULE_SETUP#line 270 "scan.l"{ start_lineno = plpgsql_scanner_lineno(); start_charpos = yytext; BEGIN(IN_STRING); } YY_BREAKcase 83:YY_RULE_SETUP#line 275 "scan.l"{ /* for now, treat the same as a regular literal */ start_lineno = plpgsql_scanner_lineno(); start_charpos = yytext; BEGIN(IN_STRING); } YY_BREAKcase 84:YY_RULE_SETUP#line 281 "scan.l"{ } YY_BREAKcase 85:YY_RULE_SETUP#line 282 "scan.l"{ /* can only happen with \ at EOF */ } YY_BREAKcase 86:YY_RULE_SETUP#line 283 "scan.l"{ } YY_BREAKcase 87:YY_RULE_SETUP#line 284 "scan.l"{ /* tell plpgsql_get_string_value it's not a dollar quote */ dolqlen = 0; /* adjust yytext/yyleng to describe whole string token */ yyleng += (yytext - start_charpos); yytext = start_charpos; BEGIN(INITIAL); return T_STRING; } YY_BREAKcase 88:YY_RULE_SETUP#line 293 "scan.l"{ } YY_BREAKcase YY_STATE_EOF(IN_STRING):#line 294 "scan.l"{ plpgsql_error_lineno = start_lineno; ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("unterminated string"))); } YY_BREAKcase 89:YY_RULE_SETUP#line 301 "scan.l"{ start_lineno = plpgsql_scanner_lineno(); start_charpos = yytext; dolqstart = pstrdup(yytext); BEGIN(IN_DOLLARQUOTE); } YY_BREAKcase 90:YY_RULE_SETUP#line 307 "scan.l"{ if (strcmp(yytext, dolqstart) == 0) { pfree(dolqstart); /* tell plpgsql_get_string_value it is a dollar quote */ dolqlen = yyleng; /* adjust yytext/yyleng to describe whole string token */ yyleng += (yytext - start_charpos); yytext = start_charpos; BEGIN(INITIAL); return T_STRING; } else { /* * When we fail to match $...$ to dolqstart, transfer * the $... part to the output, but put back the final * $ for rescanning. Consider $delim$...$junk$delim$ */ yyless(yyleng-1); } } YY_BREAKcase 91:YY_RULE_SETUP#line 329 "scan.l"{ } YY_BREAKcase 92:YY_RULE_SETUP#line 330 "scan.l"{ /* needed for $ inside the quoted text */ } YY_BREAKcase YY_STATE_EOF(IN_DOLLARQUOTE):#line 331 "scan.l"{ plpgsql_error_lineno = start_lineno; ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("unterminated dollar-quoted string"))); } YY_BREAK/* ---------- * Any unmatched character is returned as is * ---------- */case 93:YY_RULE_SETUP#line 342 "scan.l"{ return yytext[0]; } YY_BREAKcase 94:YY_RULE_SETUP#line 344 "scan.l"YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK#line 1701 "pl_scan.c"case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_c_buf_p; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* Note: because we've taken care in
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?