aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/pre_parser.mly
diff options
context:
space:
mode:
authorFrançois Pottier <francois.pottier@inria.fr>2015-10-07 10:34:10 +0200
committerFrançois Pottier <francois.pottier@inria.fr>2015-10-07 10:34:10 +0200
commitdf2ba9189d479efce7f37c61ed1b15d93767145e (patch)
treeb8a16f71fe8783b4d58ab2a911914922b93f6549 /cparser/pre_parser.mly
parent7b62517ea6cf0d132099d9a921950f97704e3b9c (diff)
downloadcompcert-kvx-df2ba9189d479efce7f37c61ed1b15d93767145e.tar.gz
compcert-kvx-df2ba9189d479efce7f37c61ed1b15d93767145e.zip
Factorized two productions (and two error productions) in [struct_or_union_specifier].
The old version was strictly equivalent to using [ioption(other_identifier)]. The new version uses [option(other_identifier)] instead, that is, [other_identifier?]. Technically, this means that [set_id_type i OtherId] is called slightly earlier (at the opening brace, instead of at the closing brace), but this does not make any difference, since the re-classification of identifiers affects only the second parsing phase.
Diffstat (limited to 'cparser/pre_parser.mly')
-rw-r--r--cparser/pre_parser.mly7
1 files changed, 2 insertions, 5 deletions
diff --git a/cparser/pre_parser.mly b/cparser/pre_parser.mly
index 0d1e8fee..8cc92581 100644
--- a/cparser/pre_parser.mly
+++ b/cparser/pre_parser.mly
@@ -408,13 +408,10 @@ type_specifier_no_typedef_name:
{}
struct_or_union_specifier:
-| struct_or_union attribute_specifier_list LBRACE struct_declaration_list RBRACE
-| struct_or_union attribute_specifier_list other_identifier LBRACE struct_declaration_list RBRACE
+| struct_or_union attribute_specifier_list other_identifier? LBRACE struct_declaration_list RBRACE
| struct_or_union attribute_specifier_list other_identifier
{}
-| struct_or_union attribute_specifier_list LBRACE struct_declaration_list error
- { unclosed "{" "}" $startpos($3) $endpos }
-| struct_or_union attribute_specifier_list general_identifier LBRACE struct_declaration_list error
+| struct_or_union attribute_specifier_list other_identifier? LBRACE struct_declaration_list error
{ unclosed "{" "}" $startpos($4) $endpos }
struct_or_union: