summaryrefslogtreecommitdiff
path: root/src/backend/parser/parser.c
diff options
context:
space:
mode:
authorPeter Eisentraut2002-04-20 21:56:15 +0000
committerPeter Eisentraut2002-04-20 21:56:15 +0000
commit32c6c99e0b0172e13dd761f3378b328d1e6a6dab (patch)
tree15614b13dcb3235008eadc7c52879892fe34a1cb /src/backend/parser/parser.c
parentff4281472a973e8610a5f8455e14dec9ea85936d (diff)
Scanner performance improvements
Use flex flags -CF. Pass the to-be-scanned string around as StringInfo type, to avoid querying the length repeatedly. Clean up some code and remove lex-compatibility cruft. Escape backslash sequences inline. Use flex-provided yy_scan_buffer() function to set up input, rather than using myinput().
Diffstat (limited to 'src/backend/parser/parser.c')
-rw-r--r--src/backend/parser/parser.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c
index f83d04e69cc..4eadbef5f44 100644
--- a/src/backend/parser/parser.c
+++ b/src/backend/parser/parser.c
@@ -14,7 +14,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.51 2001/11/05 17:46:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.52 2002/04/20 21:56:14 petere Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,12 +28,6 @@
#include "parser/parse_expr.h"
-#if defined(FLEX_SCANNER)
-extern void DeleteBuffer(void);
-#endif /* FLEX_SCANNER */
-
-char *parseString; /* the char* which holds the string to be
- * parsed */
List *parsetree; /* result of parsing is left here */
static int lookahead_token; /* one-token lookahead */
@@ -48,24 +42,20 @@ static bool have_lookahead; /* lookahead_token set? */
* Returns a list of raw (un-analyzed) parse trees.
*/
List *
-parser(char *str, Oid *typev, int nargs)
+parser(StringInfo str, Oid *typev, int nargs)
{
int yyresult;
- parseString = str;
parsetree = NIL; /* in case parser forgets to set it */
have_lookahead = false;
- scanner_init();
+ scanner_init(str);
parser_init(typev, nargs);
parse_expr_init();
yyresult = yyparse();
-#if defined(FLEX_SCANNER)
- DeleteBuffer();
-#endif /* FLEX_SCANNER */
-
+ scanner_finish();
clearerr(stdin);
if (yyresult) /* error */