Skip to content

Commit 24e4560

Browse files
committed
Try to add more explicit error cases for missing parts
1 parent 5ca42bf commit 24e4560

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

Diff for: src/mlang/test_framework/irj_parser.mly

+25-6
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,27 @@ fip:
8383
primitif:
8484
ENTREESPRIM NL
8585
entrees = list(variable_and_value)
86-
CONTROLESPRIM NL
86+
controlesprim NL
8787
controles_attendus = list(calc_error)
88-
RESULTATSPRIM NL
88+
resultatsprim NL
8989
resultats_attendus = list(variable_and_value)
9090
{ { entrees; controles_attendus; resultats_attendus } }
9191

92+
controlesprim:
93+
| CONTROLESPRIM { ( ) }
94+
| error { error $loc "Missing part #CONTROLES-PRIMITIF" }
95+
96+
resultatsprim:
97+
| RESULTATSPRIM { ( ) }
98+
| error { error $loc "Missing part #RESULTATS-PRIMITIF" }
99+
92100
rappels:
93101
/* The two constructions match respectively corrective test files and primary test files */
94-
| ENTREESRAPP NL
102+
| entreesrapp NL
95103
entrees_rappels = list(rappel)
96104
CONTROLESRAPP NL
97105
controles_attendus = list(calc_error)
98-
RESULTATSRAPP NL
106+
resultatsrapp NL
99107
resultats_attendus = list(variable_and_value)
100108
{ Some { entrees_rappels; controles_attendus; resultats_attendus} }
101109
| ENTREESCORR NL
@@ -107,15 +115,24 @@ rappels:
107115
DATES? AVISIR? AVISCSG?
108116
{ ignore (entrees_rappels, controles_attendus, resultats_attendus) ; None }
109117

118+
entreesrapp:
119+
| ENTREESRAPP { ( ) }
120+
| error { error $loc "Missing part #ENTREES-RAPPELS" }
121+
122+
resultatsrapp:
123+
| RESULTATSRAPP { ( ) }
124+
| error { error $loc "Missing part #RESULTATS-RAPPELS" }
125+
110126
variable_and_value:
111127
| var = SYMBOL SLASH value = value NL { (var, value, mk_position $sloc) }
112128
| SYMBOL error { error $loc "Missing slash in pair variable/value" }
113129

114130
calc_error:
115-
error = SYMBOL NL { (error, mk_position $sloc) }
131+
| error = SYMBOL NL { (error, mk_position $sloc) }
132+
| variable_and_value { error $loc "Missing a #RESULTATS- header" }
116133

117134
rappel:
118-
event_nb = integer SLASH
135+
| event_nb = integer SLASH
119136
rappel_nb = integer SLASH
120137
variable_code = SYMBOL SLASH
121138
change_value = integer SLASH (* No decimal value was found in existing files *)
@@ -141,6 +158,8 @@ rappel:
141158
decl_2042_rect;
142159
pos = mk_position $sloc }
143160
}
161+
| calc_error { error $loc "Missing #CONTROLES-RAPPELS header" }
162+
| resultatsrapp { error $loc "Missing #CONTROLES-RAPPELS header" }
144163

145164
integer:
146165
| i = INTEGER { i }

0 commit comments

Comments
 (0)