diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2024-10-14 16:13:48 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2024-10-14 16:13:56 -0400 |
commit | dbedc461b4e7a9cb4d6f5777174bdf180edb95fd (patch) | |
tree | 523a0ff0aec42ab66f5138f1248be8bd110fd83c /src/interfaces/ecpg/preproc/README.parser | |
parent | 143e3a1ab8dfd4de507900e2e3a584db89155467 (diff) | |
download | postgresql-dbedc461b4e7a9cb4d6f5777174bdf180edb95fd.tar.gz postgresql-dbedc461b4e7a9cb4d6f5777174bdf180edb95fd.zip |
ecpg: invent a saner syntax for ecpg.addons entries.
Put the rule type at the start not the end, and put spaces
between the constitutent token names instead of smashing them
into an illegible mess. This has no functional impact but
I think it makes the rules a great deal more readable.
Discussion: https://postgr.es/m/1185216.1724001216@sss.pgh.pa.us
Diffstat (limited to 'src/interfaces/ecpg/preproc/README.parser')
-rw-r--r-- | src/interfaces/ecpg/preproc/README.parser | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/interfaces/ecpg/preproc/README.parser b/src/interfaces/ecpg/preproc/README.parser index 378cb9344c4..85ecc803e09 100644 --- a/src/interfaces/ecpg/preproc/README.parser +++ b/src/interfaces/ecpg/preproc/README.parser @@ -40,19 +40,19 @@ continue to use the normal Bison notations.) ecpg.addons contains entries that begin with a line like - ECPG: concattokens ruletype + ECPG: ruletype tokenlist and typically have one or more following lines that are the code for a grammar action. Any line not starting with "ECPG:" is taken to be part of the code block for the preceding "ECPG:" line. -"concattokens" identifies which gram.y production this entry affects. -It is simply the target nonterminal and the tokens from the gram.y rule -concatenated together. For example, to modify the action for a gram.y -rule like this: +"tokenlist" identifies which gram.y production this entry affects. +It is simply a list of the target nonterminal and the input tokens +from the gram.y rule. For example, to modify the action for a +gram.y rule like this: target: tokenA tokenB tokenC {...} -"concattokens" would be "targettokenAtokenBtokenC". If we want to +"tokenlist" would be "target tokenA tokenB tokenC". If we want to modify a non-first alternative for a nonterminal, we still write the -nonterminal. For example, "concattokens" should be "targettokenDtokenE" +nonterminal. For example, "tokenlist" should be "target tokenD tokenE" to affect the second alternative in: target: tokenA tokenB tokenC {...} | tokenD tokenE {...} @@ -72,7 +72,7 @@ c) "rule" - the automatic action is emitted, but then the entry's code block is added verbatim afterwards. This typically is used to add new alternatives to a nonterminal of the core grammar. For example, given the entry: - ECPG: targettokenAtokenBtokenC rule + ECPG: rule target tokenA tokenB tokenC | tokenD tokenE { custom_action; } what will be emitted is target: tokenA tokenB tokenC { automatic_action; } |