aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/pre_parser.mly
diff options
context:
space:
mode:
authorFrançois Pottier <francois.pottier@inria.fr>2015-10-07 10:53:26 +0200
committerFrançois Pottier <francois.pottier@inria.fr>2015-10-07 10:53:26 +0200
commitc16b1ce7a09e7091f2482c9d898bc4f7ac73fe29 (patch)
tree2c7568ae28e5812509b21b7d4b30c97cb5f15a45 /cparser/pre_parser.mly
parent09527e66514edcfa20a0341acd75c1fe6fd77363 (diff)
downloadcompcert-kvx-c16b1ce7a09e7091f2482c9d898bc4f7ac73fe29.tar.gz
compcert-kvx-c16b1ce7a09e7091f2482c9d898bc4f7ac73fe29.zip
Factorized the two forms of FOR statement by introducing [for_statement_header].
This leads to a smaller automaton.
Diffstat (limited to 'cparser/pre_parser.mly')
-rw-r--r--cparser/pre_parser.mly8
1 files changed, 6 insertions, 2 deletions
diff --git a/cparser/pre_parser.mly b/cparser/pre_parser.mly
index 62a57618..d6097ec1 100644
--- a/cparser/pre_parser.mly
+++ b/cparser/pre_parser.mly
@@ -772,8 +772,12 @@ iteration_statement(openc,last_statement):
| WHILE openc LPAREN expression RPAREN last_statement
| DO open_context statement_finish_close WHILE
openc LPAREN expression RPAREN close_context SEMICOLON
-| FOR openc LPAREN optional(expression, SEMICOLON) optional(expression, SEMICOLON) optional(expression, RPAREN) last_statement
-| FOR openc LPAREN declaration optional(expression, SEMICOLON) optional(expression, RPAREN) last_statement
+| FOR openc LPAREN for_statement_header optional(expression, SEMICOLON) optional(expression, RPAREN) last_statement
+ {}
+
+for_statement_header:
+| optional(expression, SEMICOLON)
+| declaration
{}
asm_attributes: