Skip to content

Commit ef8b3b0

Browse files
author
Michael Meskes
committed
Fix ecpg parsing of sizeof().
The last fix used the wrong non-terminal to define valid types.
1 parent 559d535 commit ef8b3b0

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/interfaces/ecpg/preproc/ecpg.trailer

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1856,20 +1856,20 @@ DeallocateStmt: DEALLOCATE prepared_name { $$ = $2; }
18561856
| DEALLOCATE PREPARE ALL { $$ = mm_strdup("all"); }
18571857
;
18581858

1859-
Iresult: Iconst { $$ = $1; }
1860-
| '(' Iresult ')' { $$ = cat_str(3, mm_strdup("("), $2, mm_strdup(")")); }
1861-
| Iresult '+' Iresult { $$ = cat_str(3, $1, mm_strdup("+"), $3); }
1862-
| Iresult '-' Iresult { $$ = cat_str(3, $1, mm_strdup("-"), $3); }
1863-
| Iresult '*' Iresult { $$ = cat_str(3, $1, mm_strdup("*"), $3); }
1864-
| Iresult '/' Iresult { $$ = cat_str(3, $1, mm_strdup("/"), $3); }
1865-
| Iresult '%' Iresult { $$ = cat_str(3, $1, mm_strdup("%"), $3); }
1866-
| ecpg_sconst { $$ = $1; }
1867-
| ColId { $$ = $1; }
1868-
| ColId '(' ColId ')' { if (pg_strcasecmp($1, "sizeof") != 0)
1869-
mmerror(PARSE_ERROR, ET_ERROR, "operator not allowed in variable definition");
1870-
else
1871-
$$ = cat_str(4,$1, mm_strdup("("), $3, mm_strdup(")"));
1872-
}
1859+
Iresult: Iconst { $$ = $1; }
1860+
| '(' Iresult ')' { $$ = cat_str(3, mm_strdup("("), $2, mm_strdup(")")); }
1861+
| Iresult '+' Iresult { $$ = cat_str(3, $1, mm_strdup("+"), $3); }
1862+
| Iresult '-' Iresult { $$ = cat_str(3, $1, mm_strdup("-"), $3); }
1863+
| Iresult '*' Iresult { $$ = cat_str(3, $1, mm_strdup("*"), $3); }
1864+
| Iresult '/' Iresult { $$ = cat_str(3, $1, mm_strdup("/"), $3); }
1865+
| Iresult '%' Iresult { $$ = cat_str(3, $1, mm_strdup("%"), $3); }
1866+
| ecpg_sconst { $$ = $1; }
1867+
| ColId { $$ = $1; }
1868+
| ColId '(' var_type ')' { if (pg_strcasecmp($1, "sizeof") != 0)
1869+
mmerror(PARSE_ERROR, ET_ERROR, "operator not allowed in variable definition");
1870+
else
1871+
$$ = cat_str(4, $1, mm_strdup("("), $3.type_str, mm_strdup(")"));
1872+
}
18731873
;
18741874

18751875
execute_rest: /* EMPTY */ { $$ = EMPTY; }

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy