postgresql/src/interfaces/ecpg/preproc
Tom Lane 96b6c82c9d Revert "Add DECLARE STATEMENT support to ECPG."
This reverts commit bd7c95f0c1,
along with assorted follow-on fixes.  There are some questions
about the definition and implementation of that statement, and
we don't have time to resolve them before v13 release.  Rather
than ship the feature and then have backwards-compatibility
concerns constraining any redesign, let's remove it for now
and try again later.

Discussion: https://postgr.es/m/TY2PR01MB2443EC8286995378AEB7D9F8F5B10@TY2PR01MB2443.jpnprd01.prod.outlook.com
2019-09-20 12:47:37 -04:00
..
po Translation updates 2019-06-17 15:30:20 +02:00
.gitignore Replace the data structure used for keyword lookup. 2019-01-06 17:02:57 -05:00
Makefile Fix inconsistencies in the code 2019-07-08 13:15:09 +09:00
README.parser Move parse2.pl to parse.pl 2011-06-14 07:34:00 +03:00
c_keywords.c Use perfect hashing, instead of binary search, for keyword lookup. 2019-01-09 19:47:46 -05:00
c_kwlist.h Use perfect hashing, instead of binary search, for keyword lookup. 2019-01-09 19:47:46 -05:00
check_rules.pl Initial pgperltidy run for v12. 2019-05-22 13:36:19 -04:00
descriptor.c Rename ecpg's various "extern.h" files to have distinct names. 2018-12-01 16:34:00 -05:00
ecpg.addons Revert "Add DECLARE STATEMENT support to ECPG." 2019-09-20 12:47:37 -04:00
ecpg.c Revert "Add DECLARE STATEMENT support to ECPG." 2019-09-20 12:47:37 -04:00
ecpg.header Revert "Add DECLARE STATEMENT support to ECPG." 2019-09-20 12:47:37 -04:00
ecpg.tokens SQL procedures 2017-11-30 11:03:20 -05:00
ecpg.trailer Revert "Add DECLARE STATEMENT support to ECPG." 2019-09-20 12:47:37 -04:00
ecpg.type Revert "Add DECLARE STATEMENT support to ECPG." 2019-09-20 12:47:37 -04:00
ecpg_keywords.c Replace the data structure used for keyword lookup. 2019-01-06 17:02:57 -05:00
ecpg_kwlist.h Use perfect hashing, instead of binary search, for keyword lookup. 2019-01-09 19:47:46 -05:00
keywords.c Replace the data structure used for keyword lookup. 2019-01-06 17:02:57 -05:00
nls.mk Translation updates 2018-05-21 12:29:52 -04:00
output.c Revert "Add DECLARE STATEMENT support to ECPG." 2019-09-20 12:47:37 -04:00
parse.pl Initial pgperltidy run for v12. 2019-05-22 13:36:19 -04:00
parser.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
pgc.l Fix C++ incompatibilities in ecpg/preproc/ header files. 2019-05-31 12:38:53 -04:00
preproc_extern.h Revert "Add DECLARE STATEMENT support to ECPG." 2019-09-20 12:47:37 -04:00
type.c Fix double-word typos 2019-06-13 10:03:56 -04:00
type.h Revert "Add DECLARE STATEMENT support to ECPG." 2019-09-20 12:47:37 -04:00
variable.c Add bytea datatype to ECPG. 2019-02-18 10:20:31 +01:00

README.parser

ECPG modifies and extends the core grammar in a way that
1) every token in ECPG is <str> type. New tokens are
   defined in ecpg.tokens, types are defined in ecpg.type
2) most tokens from the core grammar are simply converted
   to literals concatenated together to form the SQL string
   passed to the server, this is done by parse.pl.
3) some rules need side-effects, actions are either added
   or completely overridden (compared to the basic token
   concatenation) for them, these are defined in ecpg.addons,
   the rules for ecpg.addons are explained below.
4) new grammar rules are needed for ECPG metacommands.
   These are in ecpg.trailer.
5) ecpg.header contains common functions, etc. used by
   actions for grammar rules.

In "ecpg.addons", every modified rule follows this pattern:
       ECPG: dumpedtokens postfix
where "dumpedtokens" is simply tokens from core gram.y's
rules concatenated together. e.g. if gram.y has this:
       ruleA: tokenA tokenB tokenC {...}
then "dumpedtokens" is "ruleAtokenAtokenBtokenC".
"postfix" above can be:
a) "block" - the automatic rule created by parse.pl is completely
    overridden, the code block has to be written completely as
    it were in a plain bison grammar
b) "rule" - the automatic rule is extended on, so new syntaxes
    are accepted for "ruleA". E.g.:
      ECPG: ruleAtokenAtokenBtokenC rule
          | tokenD tokenE { action_code; }
          ...
    It will be substituted with:
      ruleA: <original syntax forms and actions up to and including
                    "tokenA tokenB tokenC">
             | tokenD tokenE { action_code; }
             ...
c) "addon" - the automatic action for the rule (SQL syntax constructed
    from the tokens concatenated together) is prepended with a new
    action code part. This code part is written as is's already inside
    the { ... }

Multiple "addon" or "block" lines may appear together with the
new code block if the code block is common for those rules.