77 * (since we need to be able to do basic parsing even while inside an
88 * aborted transaction). Therefore, the data structures returned by
99 * the grammar are "raw" parsetrees that still need to be analyzed by
10- * parse_analyze .
10+ * analyze.c and related files .
1111 *
1212 *
1313 * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
1414 * Portions Copyright (c) 1994, Regents of the University of California
1515 *
1616 * IDENTIFICATION
17- * $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.64 2006/03/05 15:58:34 momjian Exp $
17+ * $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.65 2006/03/07 01:00:17 tgl Exp $
1818 *
1919 *-------------------------------------------------------------------------
2020 */
2121
2222#include "postgres.h"
2323
24- #include "nodes/parsenodes.h"
2524#include "parser/gramparse.h"
26- #include "parser/parse.h"
2725#include "parser/parser.h"
28- #include "parser/parse_expr.h"
2926
3027
3128List * parsetree ; /* result of parsing is left here */
3229
33- static int lookahead_token ; /* one-token lookahead */
34- static bool have_lookahead ; /* lookahead_token set? */
35-
3630
3731/*
3832 * raw_parser
@@ -46,12 +40,11 @@ raw_parser(const char *str)
4640 int yyresult ;
4741
4842 parsetree = NIL ; /* in case grammar forgets to set it */
49- have_lookahead = false;
5043
5144 scanner_init (str );
5245 parser_init ();
5346
54- yyresult = yyparse ();
47+ yyresult = base_yyparse ();
5548
5649 scanner_finish ();
5750
@@ -60,48 +53,3 @@ raw_parser(const char *str)
6053
6154 return parsetree ;
6255}
63-
64-
65- /*
66- * Intermediate filter between parser and base lexer (base_yylex in scan.l).
67- *
68- * The filter is needed because in some cases SQL92 requires more than one
69- * token lookahead. We reduce these cases to one-token lookahead by combining
70- * tokens here, in order to keep the grammar LR(1).
71- *
72- * Using a filter is simpler than trying to recognize multiword tokens
73- * directly in scan.l, because we'd have to allow for comments between the
74- * words ...
75- */
76- int
77- yylex (void )
78- {
79- int cur_token ;
80-
81- /* Get next token --- we might already have it */
82- if (have_lookahead )
83- {
84- cur_token = lookahead_token ;
85- have_lookahead = false;
86- }
87- else
88- cur_token = base_yylex ();
89-
90- /* Do we need to look ahead for a possible multiword token? */
91- switch (cur_token )
92- {
93- case UNION :
94- /* UNION JOIN must be reduced to a single UNIONJOIN token */
95- lookahead_token = base_yylex ();
96- if (lookahead_token == JOIN )
97- cur_token = UNIONJOIN ;
98- else
99- have_lookahead = true;
100- break ;
101-
102- default :
103- break ;
104- }
105-
106- return cur_token ;
107- }
0 commit comments