postgresql/src/interfaces/ecpg/preproc
Magnus Hagander 9f2e211386 Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
..
po Translation update 2010-05-13 15:56:43 +00:00
.cvsignore Enable script to generate preproc.y in build process. 2008-11-14 17:11:40 +00:00
Makefile Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
README.parser Remove extra newlines at end and beginning of files, add missing newlines 2010-08-19 05:57:36 +00:00
c_keywords.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
check_rules.pl Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
descriptor.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
ecpg.addons Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
ecpg.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
ecpg.header Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
ecpg.tokens Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
ecpg.trailer Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
ecpg.type Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
ecpg_keywords.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
extern.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
keywords.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
nls.mk Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
output.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
parse.pl Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
parser.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
pgc.l Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
type.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
type.h Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
variable.c Remove cvs keywords from all files. 2010-09-20 22:08:53 +02: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.