File tree 6 files changed +23
-34
lines changed
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
12
12
13
13
override CPPFLAGS := -I. -I$(srcdir ) $(CPPFLAGS )
14
14
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 \
16
16
parse_agg.o parse_clause.o parse_coerce.o parse_collate.o parse_cte.o \
17
17
parse_expr.o parse_func.o parse_node.o parse_oper.o parse_param.o \
18
18
parse_relation.o parse_target.o parse_type.o parse_utilcmd.o scansup.o
19
19
20
20
include $(top_srcdir ) /src/backend/common.mk
21
21
22
22
23
- # scan is compiled as part of gram
24
- gram.o : scan.c
25
-
26
23
# Latest flex causes warnings in this file.
27
24
ifeq ($(GCC ) ,yes)
28
- gram .o : CFLAGS += -Wno-error
25
+ scan .o : CFLAGS += -Wno-error
29
26
endif
30
27
31
28
@@ -47,7 +44,7 @@ scan.c: FLEX_NO_BACKUP=yes
47
44
48
45
49
46
# 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
51
48
52
49
53
50
# 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)
14908
14908
{
14909
14909
yyext->parsetree = NIL; /* in case grammar forgets to set it */
14910
14910
}
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 {
2
2
/*-------------------------------------------------------------------------
3
3
*
4
4
* scan.l
5
5
* lexical scanner for PostgreSQL
6
6
*
7
7
* NOTE NOTE NOTE:
8
8
*
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 !
10
10
*
11
11
* The rules are designed so that the scanner never has to backtrack,
12
12
* in the sense that there is always a rule that can match the input
34
34
#include <ctype.h>
35
35
#include <unistd.h>
36
36
37
+ #include "parser/gramparse.h"
37
38
#include "parser/parser.h" /* only needed for GUC variables */
38
- #include " parser/scanner.h"
39
39
#include "parser/scansup.h"
40
40
#include "mb/pg_wchar.h"
41
+ }
41
42
42
-
43
+ %{
43
44
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
44
45
#undef fprintf
45
46
#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 \
26
26
27
27
override CFLAGS += $(PTHREAD_CFLAGS ) -DECPG_COMPILE
28
28
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 \
30
30
keywords.o c_keywords.o ecpg_keywords.o kwlookup.o ../ecpglib/typename.o descriptor.o variable.o \
31
31
$(WIN32RES )
32
32
@@ -44,17 +44,14 @@ ecpg: $(OBJS) | submake-libpgport
44
44
../ecpglib/typename.o : ../ecpglib/typename.c
45
45
$(MAKE ) -C $(dir $@ ) $(notdir $@ )
46
46
47
- # pgc is compiled as part of preproc
48
- preproc.o : pgc.c
49
-
50
47
preproc.h : preproc.c ;
51
48
preproc.c : BISONFLAGS += -d
52
49
53
50
preproc.y : ../../../backend/parser/gram.y parse.pl ecpg.addons ecpg.header ecpg.tokens ecpg.trailer ecpg.type
54
51
$(PERL ) $(srcdir ) /parse.pl $(srcdir ) < $< > $@
55
52
$(PERL ) $(srcdir ) /check_rules.pl $(srcdir ) $<
56
53
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
58
55
59
56
kwlookup.c : % : $(top_srcdir ) /src/backend/parser/%
60
57
rm -f $@ && $(LN_S ) $< .
Original file line number Diff line number Diff line change @@ -1916,11 +1916,3 @@ void parser_init(void)
1916
1916
{
1917
1917
/* This function is empty. It only exists for compatibility with the backend parser right now. */
1918
1918
}
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 {
2
2
/*-------------------------------------------------------------------------
3
3
*
4
4
* pgc.l
23
23
#include <limits.h>
24
24
25
25
#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
+ }
26
37
38
+ %{
27
39
extern YYSTYPE yylval;
28
40
29
41
static int xcdepth = 0 ; /* depth of nesting in slash-star comments */
You can’t perform that action at this time.
0 commit comments