diff options
author | François Pottier <francois.pottier@inria.fr> | 2015-10-07 10:14:05 +0200 |
---|---|---|
committer | François Pottier <francois.pottier@inria.fr> | 2015-10-07 10:25:04 +0200 |
commit | 7b62517ea6cf0d132099d9a921950f97704e3b9c (patch) | |
tree | 1d4dc6d2a30bf3703f48a56b01d30514d6980ff9 /cparser | |
parent | 7c4dd1467e62229689fe15656f4405f617edca1d (diff) | |
download | compcert-7b62517ea6cf0d132099d9a921950f97704e3b9c.tar.gz compcert-7b62517ea6cf0d132099d9a921950f97704e3b9c.zip |
For clarity, removed several redundant calls to [set_id_type].
A TYPEDEF_NAME is already classified as a [TypedefId] by the lexer,
and similarly, a VAR_NAME is already classified as a [VarId].
Thus, the removed calls had no effect.
The remaining calls to [set_id_type] are useful, as they can re-classify a token.
Diffstat (limited to 'cparser')
-rw-r--r-- | cparser/pre_parser.mly | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/cparser/pre_parser.mly b/cparser/pre_parser.mly index c036caeb..0d1e8fee 100644 --- a/cparser/pre_parser.mly +++ b/cparser/pre_parser.mly @@ -150,8 +150,7 @@ declare_typename(nt): (* Actual grammar *) primary_expression: -| i = VAR_NAME - { set_id_type i VarId } +| VAR_NAME | CONSTANT | string_literals_list | LPAREN expression RPAREN @@ -378,8 +377,7 @@ declaration_specifiers_no_typedef_name: The first field is a named t, while the second is unnamed of type t. *) declaration_specifiers: -| ioption(declaration_specifiers_no_type) i = TYPEDEF_NAME declaration_specifiers_no_type? - { set_id_type i TypedefId } +| ioption(declaration_specifiers_no_type) TYPEDEF_NAME declaration_specifiers_no_type? | ioption(declaration_specifiers_no_type) type_specifier_no_typedef_name declaration_specifiers_no_typedef_name? {} @@ -387,9 +385,8 @@ declaration_specifiers: "typedef" keyword. To avoid conflicts, we also encode the constraint described in the comment for [declaration_specifiers]. *) declaration_specifiers_typedef: -| ioption(declaration_specifiers_no_type) TYPEDEF declaration_specifiers_no_type? i = TYPEDEF_NAME declaration_specifiers_no_type? -| ioption(declaration_specifiers_no_type) i = TYPEDEF_NAME declaration_specifiers_no_type? TYPEDEF declaration_specifiers_no_type? - { set_id_type i TypedefId } +| ioption(declaration_specifiers_no_type) TYPEDEF declaration_specifiers_no_type? TYPEDEF_NAME declaration_specifiers_no_type? +| ioption(declaration_specifiers_no_type) TYPEDEF_NAME declaration_specifiers_no_type? TYPEDEF declaration_specifiers_no_type? | ioption(declaration_specifiers_no_type) TYPEDEF declaration_specifiers_no_type? type_specifier_no_typedef_name declaration_specifiers_no_typedef_name? | ioption(declaration_specifiers_no_type) type_specifier_no_typedef_name declaration_specifiers_no_typedef_name? TYPEDEF declaration_specifiers_no_typedef_name? {} @@ -437,8 +434,7 @@ struct_declaration: (* As in the standard, except it also encodes the constraint described in the comment above [declaration_specifiers]. *) specifier_qualifier_list: -| type_qualifier_list? i = TYPEDEF_NAME type_qualifier_list? - { set_id_type i TypedefId } +| type_qualifier_list? TYPEDEF_NAME type_qualifier_list? | type_qualifier_list? type_specifier_no_typedef_name specifier_qualifier_list_no_typedef_name? {} |