mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +03:00
Rethink the idea of having plpgsql depend on parser/gram.h. Aside from the
fact that this is breaking the MSVC build, it's probably not really a good idea to expand the dependencies of gram.h any further than the core parser; for instance the value of SCONST might depend on which bison version you'd built with. Better to expose an additional call point in parser.c, so move what I had put into pl_funcs.c into parser.c. Also PGDLLIMPORT'ify the reference to standard_conforming_strings, per buildfarm results.
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.76 2009/01/01 17:23:46 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.77 2009/04/19 21:50:08 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -62,6 +62,36 @@ raw_parser(const char *str)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* pg_parse_string_token - get the value represented by a string literal
|
||||
*
|
||||
* Given the textual form of a SQL string literal, produce the represented
|
||||
* value as a palloc'd string. It is caller's responsibility that the
|
||||
* passed string does represent one single string literal.
|
||||
*
|
||||
* We export this function to avoid having plpgsql depend on internal details
|
||||
* of the core grammar (such as the token code assigned to SCONST). Note
|
||||
* that since the scanner isn't presently re-entrant, this cannot be used
|
||||
* during use of the main parser/scanner.
|
||||
*/
|
||||
char *
|
||||
pg_parse_string_token(const char *token)
|
||||
{
|
||||
int ctoken;
|
||||
|
||||
scanner_init(token);
|
||||
|
||||
ctoken = base_yylex();
|
||||
|
||||
if (ctoken != SCONST) /* caller error */
|
||||
elog(ERROR, "expected string constant, got token code %d", ctoken);
|
||||
|
||||
scanner_finish();
|
||||
|
||||
return base_yylval.str;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Intermediate filter between parser and base lexer (base_yylex in scan.l).
|
||||
*
|
||||
|
Reference in New Issue
Block a user