File tree Expand file tree Collapse file tree 6 files changed +23
-34
lines changed Expand file tree Collapse file tree 6 files changed +23
-34
lines changed Original file line number Diff line number Diff line change @@ -12,20 +12,17 @@ include $(top_builddir)/src/Makefile.global
1212
1313override CPPFLAGS := -I. -I$(srcdir ) $(CPPFLAGS )
1414
15- OBJS = analyze.o gram.o keywords.o kwlookup.o parser.o \
15+ OBJS = analyze.o gram.o scan.o keywords.o kwlookup.o parser.o \
1616 parse_agg.o parse_clause.o parse_coerce.o parse_collate.o parse_cte.o \
1717 parse_expr.o parse_func.o parse_node.o parse_oper.o parse_param.o \
1818 parse_relation.o parse_target.o parse_type.o parse_utilcmd.o scansup.o
1919
2020include $(top_srcdir ) /src/backend/common.mk
2121
2222
23- # scan is compiled as part of gram
24- gram.o : scan.c
25-
2623# Latest flex causes warnings in this file.
2724ifeq ($(GCC ) ,yes)
28- gram .o : CFLAGS += -Wno-error
25+ scan .o : CFLAGS += -Wno-error
2926endif
3027
3128
@@ -47,7 +44,7 @@ scan.c: FLEX_NO_BACKUP=yes
4744
4845
4946# Force these dependencies to be known even without dependency info built:
50- gram.o keywords.o parser.o : gram.h
47+ gram.o scan.o keywords.o parser.o : gram.h
5148
5249
5350# gram.c, gram.h, and scan.c are in the distribution tarball, so they
Original file line number Diff line number Diff line change @@ -14908,13 +14908,3 @@ parser_init(base_yy_extra_type *yyext)
1490814908{
1490914909 yyext->parsetree = NIL; /* in case grammar forgets to set it */
1491014910}
14911-
14912- /*
14913- * Must undefine this stuff before including scan.c, since it has different
14914- * definitions for these macros.
14915- */
14916- #undef yyerror
14917- #undef yylval
14918- #undef yylloc
14919-
14920- #include "scan.c"
Original file line number Diff line number Diff line change 1- %{
1+ %top {
22/*-------------------------------------------------------------------------
33 *
44 * scan.l
55 * lexical scanner for PostgreSQL
66 *
77 * NOTE NOTE NOTE:
88 *
9- * The rules in this file must be kept in sync with psql's lexer!! !
9+ * The rules in this file must be kept in sync with psql's psqlscan.l !
1010 *
1111 * The rules are designed so that the scanner never has to backtrack,
1212 * in the sense that there is always a rule that can match the input
3434#include <ctype.h>
3535#include <unistd.h>
3636
37+ #include "parser/gramparse.h"
3738#include "parser/parser.h" /* only needed for GUC variables */
38- #include " parser/scanner.h"
3939#include "parser/scansup.h"
4040#include "mb/pg_wchar.h"
41+ }
4142
42-
43+ %{
4344/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
4445#undef fprintf
4546#define fprintf (file, fmt, msg ) fprintf_to_ereport(fmt, msg)
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ override CPPFLAGS := -I../include -I$(top_srcdir)/src/interfaces/ecpg/include \
2626
2727override CFLAGS += $(PTHREAD_CFLAGS ) -DECPG_COMPILE
2828
29- OBJS = preproc.o type.o ecpg.o output.o parser.o \
29+ OBJS = preproc.o pgc.o type.o ecpg.o output.o parser.o \
3030 keywords.o c_keywords.o ecpg_keywords.o kwlookup.o ../ecpglib/typename.o descriptor.o variable.o \
3131 $(WIN32RES )
3232
@@ -44,17 +44,14 @@ ecpg: $(OBJS) | submake-libpgport
4444../ecpglib/typename.o : ../ecpglib/typename.c
4545 $(MAKE ) -C $(dir $@ ) $(notdir $@ )
4646
47- # pgc is compiled as part of preproc
48- preproc.o : pgc.c
49-
5047preproc.h : preproc.c ;
5148preproc.c : BISONFLAGS += -d
5249
5350preproc.y : ../../../backend/parser/gram.y parse.pl ecpg.addons ecpg.header ecpg.tokens ecpg.trailer ecpg.type
5451 $(PERL ) $(srcdir ) /parse.pl $(srcdir ) < $< > $@
5552 $(PERL ) $(srcdir ) /check_rules.pl $(srcdir ) $<
5653
57- ecpg_keywords.o c_keywords.o keywords.o preproc.o parser.o : preproc.h
54+ ecpg_keywords.o c_keywords.o keywords.o preproc.o pgc.o parser.o : preproc.h
5855
5956kwlookup.c : % : $(top_srcdir ) /src/backend/parser/%
6057 rm -f $@ && $(LN_S ) $< .
Original file line number Diff line number Diff line change @@ -1916,11 +1916,3 @@ void parser_init(void)
19161916{
19171917 /* This function is empty. It only exists for compatibility with the backend parser right now. */
19181918}
1919-
1920- /*
1921- * Must undefine base_yylex before including pgc.c, since we want it
1922- * to create the function base_yylex not filtered_base_yylex.
1923- */
1924- #undef base_yylex
1925-
1926- #include "pgc.c"
Original file line number Diff line number Diff line change 1- %{
1+ %top {
22/*-------------------------------------------------------------------------
33 *
44 * pgc.l
2323#include <limits.h>
2424
2525#include "extern.h"
26+ #include "preproc.h"
27+
28+ /*
29+ * Change symbol names as expected by preproc.l. It'd be better to do this
30+ * with %option prefix="base_yy", but that affects some other names that
31+ * various files expect *not* to be prefixed with "base_". Cleaning it up
32+ * is not worth the trouble right now.
33+ */
34+ #define yylex base_yylex
35+ #define yylval base_yylval
36+ }
2637
38+ %{
2739extern YYSTYPE yylval;
2840
2941static int xcdepth = 0 ; /* depth of nesting in slash-star comments */
You can’t perform that action at this time.
0 commit comments