postgresql/src
Tom Lane d37b816dc9 Adopt a more compact, less error-prone notation for tab completion code.
Replace tests like

    else if (pg_strcasecmp(prev4_wd, "CREATE") == 0 &&
             pg_strcasecmp(prev3_wd, "TRIGGER") == 0 &&
             (pg_strcasecmp(prev_wd, "BEFORE") == 0 ||
              pg_strcasecmp(prev_wd, "AFTER") == 0))

with new notation like this:

    else if (TailMatches4("CREATE", "TRIGGER", MatchAny, "BEFORE|AFTER"))

In addition, provide some macros COMPLETE_WITH_LISTn() to reduce the amount
of clutter needed to specify a small number of predetermined completion
alternatives.

This makes the code substantially more compact: tab-complete.c gets over a
thousand lines shorter in this patch, despite the addition of a couple of
hundred lines of infrastructure for the new notations.  The new way of
specifying match rules seems a whole lot more readable and less
error-prone, too.

There's a lot more that could be done now to make matching faster and more
reliable; for example I suspect that most of the TailMatches() rules should
now be Matches() rules.  That would allow them to be skipped after a single
integer comparison if there aren't the right number of words on the line,
and it would reduce the risk of unintended matches.  But for now, (mostly)
refrain from reworking any match rules in favor of just converting what
we've got into the new notation.

Thomas Munro, reviewed by Michael Paquier, some adjustments by me
2015-12-19 16:03:14 -05:00
..
backend Revert 9246af6799 because 2015-12-18 21:35:22 +03:00
bin Adopt a more compact, less error-prone notation for tab completion code. 2015-12-19 16:03:14 -05:00
common
include Revert 9246af6799 because 2015-12-18 21:35:22 +03:00
interfaces Fix out-of-memory error handling in ParameterDescription message processing. 2015-12-14 18:19:10 +02:00
makefiles
pl Instruct Coverity using an assertion. 2015-12-05 03:04:17 -05:00
port Adopt the GNU convention for handling tar-archive members exceeding 8GB. 2015-11-21 20:21:31 -05:00
template Remove some remains from Alpha support removal 2015-10-29 16:40:14 -04:00
test Revert 9246af6799 because 2015-12-18 21:35:22 +03:00
timezone Update time zone data files to tzdata release 2015g. 2015-10-02 19:15:39 -04:00
tools Use just one standalone-backend session for initdb's post-bootstrap steps. 2015-12-17 19:38:21 -05:00
tutorial
.gitignore
bcc32.mak
DEVELOPERS
Makefile
Makefile.global.in Make prove_installcheck remove the old log directory, if any. 2015-10-11 20:36:07 -04:00
Makefile.shlib
nls-global.mk
win32.mak