Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
462227dc
Commit
462227dc
authored
Oct 26, 2007
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid having backend-only code compiled into ecpg. Per Zdenek Kotala
parent
8164fb88
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
142 additions
and
9 deletions
+142
-9
src/interfaces/ecpg/preproc/Makefile
src/interfaces/ecpg/preproc/Makefile
+2
-5
src/interfaces/ecpg/preproc/parser.c
src/interfaces/ecpg/preproc/parser.c
+140
-0
src/interfaces/ecpg/preproc/parser/README
src/interfaces/ecpg/preproc/parser/README
+0
-1
src/interfaces/ecpg/preproc/parser/parse.h
src/interfaces/ecpg/preproc/parser/parse.h
+0
-3
No files found.
src/interfaces/ecpg/preproc/Makefile
View file @
462227dc
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
#
#
# Copyright (c) 1998-2007, PostgreSQL Global Development Group
# Copyright (c) 1998-2007, PostgreSQL Global Development Group
#
#
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.12
8 2007/08/22 08:20:58 meskes
Exp $
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.12
9 2007/10/26 14:17:53 tgl
Exp $
#
#
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
...
@@ -59,9 +59,6 @@ endif
...
@@ -59,9 +59,6 @@ endif
c_keywords.o keywords.o preproc.o parser.o
:
preproc.h
c_keywords.o keywords.o preproc.o parser.o
:
preproc.h
parser.c
:
$(top_srcdir)/src/backend/parser/parser.c
rm
-f
$@
&&
$(LN_S)
$<
.
distprep
:
$(srcdir)/preproc.c $(srcdir)/preproc.h $(srcdir)/pgc.c
distprep
:
$(srcdir)/preproc.c $(srcdir)/preproc.h $(srcdir)/pgc.c
install
:
all installdirs
install
:
all installdirs
...
@@ -74,7 +71,7 @@ uninstall:
...
@@ -74,7 +71,7 @@ uninstall:
rm
-f
'
$(DESTDIR)$(bindir)
/ecpg
$(X)
'
rm
-f
'
$(DESTDIR)$(bindir)
/ecpg
$(X)
'
clean distclean
:
clean distclean
:
rm
-f
*
.o ecpg
$(X)
parser.c
rm
-f
*
.o ecpg
$(X)
# garbage from partial builds
# garbage from partial builds
@rm
-f
y.tab.c
y.tab.h
@rm
-f
y.tab.c
y.tab.h
# garbage from development
# garbage from development
...
...
src/interfaces/ecpg/preproc/parser.c
0 → 100644
View file @
462227dc
/*-------------------------------------------------------------------------
*
* parser.c
* Main entry point/driver for PostgreSQL grammar
*
* Note that the grammar is not allowed to perform any table access
* (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
* analyze.c and related files.
*
*
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/parser.c,v 1.1 2007/10/26 14:17:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres_fe.h"
#include "extern.h"
#include "preproc.h"
static
bool
have_lookahead
;
/* is lookahead info valid? */
static
int
lookahead_token
;
/* one-token lookahead */
static
YYSTYPE
lookahead_yylval
;
/* yylval for lookahead token */
static
YYLTYPE
lookahead_yylloc
;
/* yylloc for lookahead token */
/*
* Intermediate filter between parser and base lexer (base_yylex in scan.l).
*
* The filter is needed because in some cases the standard SQL grammar
* requires more than one token lookahead. We reduce these cases to one-token
* lookahead by combining tokens here, in order to keep the grammar LALR(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. Furthermore it's not clear how to do it without re-introducing
* scanner backtrack, which would cost more performance than this filter
* layer does.
*/
int
filtered_base_yylex
(
void
)
{
int
cur_token
;
int
next_token
;
YYSTYPE
cur_yylval
;
YYLTYPE
cur_yylloc
;
/* Get next token --- we might already have it */
if
(
have_lookahead
)
{
cur_token
=
lookahead_token
;
base_yylval
=
lookahead_yylval
;
base_yylloc
=
lookahead_yylloc
;
have_lookahead
=
false
;
}
else
cur_token
=
base_yylex
();
/* Do we need to look ahead for a possible multiword token? */
switch
(
cur_token
)
{
case
NULLS_P
:
/*
* NULLS FIRST and NULLS LAST must be reduced to one token
*/
cur_yylval
=
base_yylval
;
cur_yylloc
=
base_yylloc
;
next_token
=
base_yylex
();
switch
(
next_token
)
{
case
FIRST_P
:
cur_token
=
NULLS_FIRST
;
break
;
case
LAST_P
:
cur_token
=
NULLS_LAST
;
break
;
default:
/* save the lookahead token for next time */
lookahead_token
=
next_token
;
lookahead_yylval
=
base_yylval
;
lookahead_yylloc
=
base_yylloc
;
have_lookahead
=
true
;
/* and back up the output info to cur_token */
base_yylval
=
cur_yylval
;
base_yylloc
=
cur_yylloc
;
break
;
}
break
;
case
WITH
:
/*
* WITH CASCADED, LOCAL, or CHECK must be reduced to one token
*
* XXX an alternative way is to recognize just WITH_TIME and put
* the ugliness into the datetime datatype productions instead of
* WITH CHECK OPTION. However that requires promoting WITH to a
* fully reserved word. If we ever have to do that anyway
* (perhaps for SQL99 recursive queries), come back and simplify
* this code.
*/
cur_yylval
=
base_yylval
;
cur_yylloc
=
base_yylloc
;
next_token
=
base_yylex
();
switch
(
next_token
)
{
case
CASCADED
:
cur_token
=
WITH_CASCADED
;
break
;
case
LOCAL
:
cur_token
=
WITH_LOCAL
;
break
;
case
CHECK
:
cur_token
=
WITH_CHECK
;
break
;
default:
/* save the lookahead token for next time */
lookahead_token
=
next_token
;
lookahead_yylval
=
base_yylval
;
lookahead_yylloc
=
base_yylloc
;
have_lookahead
=
true
;
/* and back up the output info to cur_token */
base_yylval
=
cur_yylval
;
base_yylloc
=
cur_yylloc
;
break
;
}
break
;
default:
break
;
}
return
cur_token
;
}
src/interfaces/ecpg/preproc/parser/README
deleted
100644 → 0
View file @
8164fb88
The parse.h file has to be in this directory to comply with the backend's source tree.
src/interfaces/ecpg/preproc/parser/parse.h
deleted
100644 → 0
View file @
8164fb88
#include "extern.h"
#include "preproc.h"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment