Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9812138

Browse files
committed
ecpg: avoid breaking the IDENT precedence level in two.
Careless string hacking caused parse.pl to transform gram.y's declaration %nonassoc IDENT PARTITION RANGE ROWS ... into %nonassoc IDENT %nonassoc CSTRING PARTITION RANGE ROWS ... It turns out that this has no semantic impact, because the generated preproc.c is exactly the same either way (if you inject a blank line to keep line numbers the same). Nonetheless, given the great emphasis that the commentary in gram.y places on keeping those other keywords at the same precedence level as IDENT, this seems like foolishly risking ecpg behaving differently from the core parser. Adjust the code so that CSTRING is added to the precedence line without breaking it into two lines. Discussion: https://postgr.es/m/2157151.1713540065@sss.pgh.pa.us
1 parent f244a2b commit 9812138

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/interfaces/ecpg/preproc/parse.pl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,10 @@ sub main
289289
# Accumulate the line in $str.
290290
$str = $str . ' ' . $a;
291291

292-
# HACK: insert our own %nonassoc line after IDENT.
293-
# XXX: this seems pretty wrong, IDENT is not last on its line!
292+
# Give our token CSTRING the same precedence as IDENT.
294293
if ($a eq 'IDENT' && $arr[0] eq '%nonassoc')
295294
{
296-
$str = $str . "\n%nonassoc CSTRING";
295+
$str = $str . " CSTRING";
297296
}
298297
}
299298
# Save the lightly-processed line in orig_tokens.

0 commit comments

Comments
 (0)