Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4b39aa3

Browse files
committed
Re-implement psql's input scanning to use a flex-generated lexer, as per
recent discussion. The lexer is used for both SQL command text andbackslash commands. The purpose of this change is to make it easier totrack the behavior of the backend's SQL lexer --- essentially identicalflex rules are now used by psql. Also, this cleans up a lot of verysquirrelly code in mainloop.c and command.c. The flex code is somewhatbulkier than the removed code, but should be lots easier to maintain.
1 parent737f1cd commit4b39aa3

File tree

8 files changed

+1804
-837
lines changed

8 files changed

+1804
-837
lines changed

‎src/bin/psql/.cvsignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
psqlscan.c
12
sql_help.h

‎src/bin/psql/Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.38 2003/11/29 19:52:06 pgsql Exp $
8+
# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.39 2004/02/19 19:40:08 tgl Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -19,7 +19,10 @@ override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) -DFRONTEND
1919

2020
OBJS=command.o common.o help.o input.o stringutils.o mainloop.o copy.o\
2121
startup.o prompt.o variables.o large_obj.o print.o describe.o\
22-
tab-complete.o mbprint.o
22+
psqlscan.o tab-complete.o mbprint.o
23+
24+
FLEXFLAGS = -Cfe
25+
2326

2427
all: submake-libpq submake-libpgport psql
2528

@@ -36,6 +39,13 @@ $(srcdir)/sql_help.h:
3639
@echo"*** Perl is needed to build psql help."
3740
endif
3841

42+
$(srcdir)/psqlscan.c: psqlscan.l
43+
ifdefFLEX
44+
$(FLEX) $(FLEXFLAGS) -o'$@' $<
45+
else
46+
@$(missing) flex $< $@
47+
endif
48+
3949
distprep:$(srcdir)/sql_help.h
4050

4151
install: all installdirs
@@ -47,8 +57,9 @@ installdirs:
4757
uninstall:
4858
rm -f$(DESTDIR)$(bindir)/psql$(X)
4959

60+
# psqlscan.c is in the distribution tarball, so is not cleaned here
5061
cleandistclean:
5162
rm -f psql$(X)$(OBJS)
5263

5364
maintainer-clean: distclean
54-
rm -f$(srcdir)/sql_help.h
65+
rm -f$(srcdir)/sql_help.h$(srcdir)/psqlscan.c

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp