aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/Makefile7
-rw-r--r--src/backend/parser/gram.y25
-rw-r--r--src/backend/parser/parser.c58
-rw-r--r--src/backend/parser/scan.l4
4 files changed, 10 insertions, 84 deletions
diff --git a/src/backend/parser/Makefile b/src/backend/parser/Makefile
index da5ac26ed67..553fda257e1 100644
--- a/src/backend/parser/Makefile
+++ b/src/backend/parser/Makefile
@@ -2,7 +2,7 @@
#
# Makefile for parser
#
-# $PostgreSQL: pgsql/src/backend/parser/Makefile,v 1.42 2003/11/29 19:51:51 pgsql Exp $
+# $PostgreSQL: pgsql/src/backend/parser/Makefile,v 1.43 2006/03/07 01:00:17 tgl Exp $
#
#-------------------------------------------------------------------------
@@ -57,8 +57,7 @@ endif
# Force these dependencies to be known even without dependency info built:
-
-gram.o keywords.o parser.o: $(srcdir)/parse.h
+gram.o keywords.o: $(srcdir)/parse.h
# gram.c, parse.h, and scan.c are in the distribution tarball, so they
@@ -66,4 +65,4 @@ gram.o keywords.o parser.o: $(srcdir)/parse.h
clean:
rm -f SUBSYS.o $(OBJS)
# And the garbage that might have been left behind by partial build:
- @rm -f y.tab.c y.tab.h lex.yy.c
+ @rm -f y.tab.h y.tab.c y.output lex.yy.c
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 135f2272def..c86a6888f20 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.533 2006/03/05 15:58:32 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.534 2006/03/07 01:00:16 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -95,6 +95,7 @@ static void doNegateFloat(Value *v);
%}
+%name-prefix="base_yy"
%union
{
@@ -418,12 +419,6 @@ static void doNegateFloat(Value *v);
ZONE
-/* The grammar thinks these are keywords, but they are not in the keywords.c
- * list and so can never be entered directly. The filter in parser.c
- * creates these tokens when required.
- */
-%token UNIONJOIN
-
/* Special token types, not actually keywords - see the "lex" file */
%token <str> IDENT FCONST SCONST BCONST XCONST Op
%token <ival> ICONST PARAM
@@ -464,7 +459,7 @@ static void doNegateFloat(Value *v);
* They wouldn't be given a precedence at all, were it not that we need
* left-associativity among the JOIN rules themselves.
*/
-%left JOIN UNIONJOIN CROSS LEFT FULL RIGHT INNER_P NATURAL
+%left JOIN CROSS LEFT FULL RIGHT INNER_P NATURAL
%%
/*
@@ -5774,20 +5769,6 @@ joined_table:
n->quals = NULL;
$$ = n;
}
- | table_ref UNIONJOIN table_ref
- {
- /* UNION JOIN is made into 1 token to avoid shift/reduce
- * conflict against regular UNION keyword.
- */
- JoinExpr *n = makeNode(JoinExpr);
- n->jointype = JOIN_UNION;
- n->isNatural = FALSE;
- n->larg = $1;
- n->rarg = $3;
- n->using = NIL;
- n->quals = NULL;
- $$ = n;
- }
| table_ref join_type JOIN table_ref join_qual
{
JoinExpr *n = makeNode(JoinExpr);
diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c
index 4b5d12c0bf4..6c331ad338d 100644
--- a/src/backend/parser/parser.c
+++ b/src/backend/parser/parser.c
@@ -7,32 +7,26 @@
* (since we need to be able to do basic parsing even while inside an
* aborted transaction). Therefore, the data structures returned by
* the grammar are "raw" parsetrees that still need to be analyzed by
- * parse_analyze.
+ * analyze.c and related files.
*
*
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.64 2006/03/05 15:58:34 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.65 2006/03/07 01:00:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
-#include "nodes/parsenodes.h"
#include "parser/gramparse.h"
-#include "parser/parse.h"
#include "parser/parser.h"
-#include "parser/parse_expr.h"
List *parsetree; /* result of parsing is left here */
-static int lookahead_token; /* one-token lookahead */
-static bool have_lookahead; /* lookahead_token set? */
-
/*
* raw_parser
@@ -46,12 +40,11 @@ raw_parser(const char *str)
int yyresult;
parsetree = NIL; /* in case grammar forgets to set it */
- have_lookahead = false;
scanner_init(str);
parser_init();
- yyresult = yyparse();
+ yyresult = base_yyparse();
scanner_finish();
@@ -60,48 +53,3 @@ raw_parser(const char *str)
return parsetree;
}
-
-
-/*
- * Intermediate filter between parser and base lexer (base_yylex in scan.l).
- *
- * The filter is needed because in some cases SQL92 requires more than one
- * token lookahead. We reduce these cases to one-token lookahead by combining
- * tokens here, in order to keep the grammar LR(1).
- *
- * Using a filter is simpler than trying to recognize multiword tokens
- * directly in scan.l, because we'd have to allow for comments between the
- * words ...
- */
-int
-yylex(void)
-{
- int cur_token;
-
- /* Get next token --- we might already have it */
- if (have_lookahead)
- {
- cur_token = lookahead_token;
- have_lookahead = false;
- }
- else
- cur_token = base_yylex();
-
- /* Do we need to look ahead for a possible multiword token? */
- switch (cur_token)
- {
- case UNION:
- /* UNION JOIN must be reduced to a single UNIONJOIN token */
- lookahead_token = base_yylex();
- if (lookahead_token == JOIN)
- cur_token = UNIONJOIN;
- else
- have_lookahead = true;
- break;
-
- default:
- break;
- }
-
- return cur_token;
-}
diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l
index e277920ee20..3d63cb73c8a 100644
--- a/src/backend/parser/scan.l
+++ b/src/backend/parser/scan.l
@@ -24,7 +24,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.131 2006/03/06 19:49:20 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.132 2006/03/07 01:00:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,8 +45,6 @@
#undef fprintf
#define fprintf(file, fmt, msg) ereport(ERROR, (errmsg_internal("%s", msg)))
-extern YYSTYPE yylval;
-
static int xcdepth = 0; /* depth of nesting in slash-star comments */
static char *dolqstart; /* current $foo$ quote start string */