From df2ba9189d479efce7f37c61ed1b15d93767145e Mon Sep 17 00:00:00 2001 From: François Pottier Date: Wed, 7 Oct 2015 10:34:10 +0200 Subject: 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. --- cparser/pre_parser.mly | 7 ++----- 1 file 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: -- cgit