mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +03:00
Tweak the core scanner so that it can be used by plpgsql too.
Changes: Pass in the keyword lookup array instead of having it be hardwired. (This incidentally allows elimination of some duplicate coding in ecpg.) Re-order the token declarations in gram.y so that non-keyword tokens have numbers that won't change when keywords are added or removed. Add ".." and ":=" to the set of tokens recognized by scan.l. (Since these combinations are nowhere legal in core SQL, this does not change anything except the precise wording of the error you get when you write this.)
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.80 2009/07/13 02:02:20 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.81 2009/07/14 20:24:10 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -39,7 +39,7 @@ raw_parser(const char *str)
|
||||
int yyresult;
|
||||
|
||||
/* initialize the flex scanner */
|
||||
yyscanner = scanner_init(str, &yyextra);
|
||||
yyscanner = scanner_init(str, &yyextra, ScanKeywords, NumScanKeywords);
|
||||
|
||||
/* filtered_base_yylex() only needs this much initialization */
|
||||
yyextra.have_lookahead = false;
|
||||
@ -79,7 +79,7 @@ pg_parse_string_token(const char *token)
|
||||
YYSTYPE yylval;
|
||||
YYLTYPE yylloc;
|
||||
|
||||
yyscanner = scanner_init(token, &yyextra);
|
||||
yyscanner = scanner_init(token, &yyextra, ScanKeywords, NumScanKeywords);
|
||||
|
||||
ctoken = base_yylex(&yylval, &yylloc, yyscanner);
|
||||
|
||||
|
Reference in New Issue
Block a user