7
7
* (since we need to be able to do basic parsing even while inside an
8
8
* aborted transaction). Therefore, the data structures returned by
9
9
* the grammar are "raw" parsetrees that still need to be analyzed by
10
- * parse_analyze .
10
+ * analyze.c and related files .
11
11
*
12
12
*
13
13
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
14
14
* Portions Copyright (c) 1994, Regents of the University of California
15
15
*
16
16
* 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 $
18
18
*
19
19
*-------------------------------------------------------------------------
20
20
*/
21
21
22
22
#include "postgres.h"
23
23
24
- #include "nodes/parsenodes.h"
25
24
#include "parser/gramparse.h"
26
- #include "parser/parse.h"
27
25
#include "parser/parser.h"
28
- #include "parser/parse_expr.h"
29
26
30
27
31
28
List * parsetree ; /* result of parsing is left here */
32
29
33
- static int lookahead_token ; /* one-token lookahead */
34
- static bool have_lookahead ; /* lookahead_token set? */
35
-
36
30
37
31
/*
38
32
* raw_parser
@@ -46,12 +40,11 @@ raw_parser(const char *str)
46
40
int yyresult ;
47
41
48
42
parsetree = NIL ; /* in case grammar forgets to set it */
49
- have_lookahead = false;
50
43
51
44
scanner_init (str );
52
45
parser_init ();
53
46
54
- yyresult = yyparse ();
47
+ yyresult = base_yyparse ();
55
48
56
49
scanner_finish ();
57
50
@@ -60,48 +53,3 @@ raw_parser(const char *str)
60
53
61
54
return parsetree ;
62
55
}
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