242 |
|
|
243 |
|
|
244 |
|
|
245 |
|
|
246 |
|
## ------------------- ## |
247 |
|
## Rule Line Numbers. ## |
248 |
|
## ------------------- ## |
249 |
|
|
250 |
|
AT_SETUP([Rule Line Numbers]) |
251 |
|
|
252 |
|
AT_DATA([input.y], |
253 |
|
[[%% |
254 |
|
expr: |
255 |
|
'a' |
256 |
|
|
257 |
|
{ |
258 |
|
|
259 |
|
} |
260 |
|
|
261 |
|
'b' |
262 |
|
|
263 |
|
{ |
264 |
|
|
265 |
|
} |
266 |
|
|
267 |
|
| |
268 |
|
|
269 |
|
|
270 |
|
{ |
271 |
|
|
272 |
|
|
273 |
|
} |
274 |
|
|
275 |
|
'c' |
276 |
|
|
277 |
|
{ |
278 |
|
|
279 |
|
} |
280 |
|
]]) |
281 |
|
|
282 |
|
AT_CHECK([bison input.y -o input.c -v], 0, [], []) |
283 |
|
|
284 |
|
# Check the contents of the report. |
285 |
|
AT_CHECK([cat input.output], [], |
286 |
|
[[ |
287 |
|
Grammar |
288 |
|
|
289 |
|
Number, Line, Rule |
290 |
|
1 2 @1 -> /* empty */ |
291 |
|
2 2 expr -> 'a' @1 'b' |
292 |
|
3 15 @2 -> /* empty */ |
293 |
|
4 15 expr -> @2 'c' |
294 |
|
|
295 |
|
Terminals, with rules where they appear |
296 |
|
|
297 |
|
$ (-1) |
298 |
|
'a' (97) 2 |
299 |
|
'b' (98) 2 |
300 |
|
'c' (99) 4 |
301 |
|
error (256) |
302 |
|
|
303 |
|
Nonterminals, with rules where they appear |
304 |
|
|
305 |
|
expr (6) |
306 |
|
on left: 2 4 |
307 |
|
@1 (7) |
308 |
|
on left: 1, on right: 2 |
309 |
|
@2 (8) |
310 |
|
on left: 3, on right: 4 |
311 |
|
|
312 |
|
|
313 |
|
state 0 |
314 |
|
|
315 |
|
'a' shift, and go to state 1 |
316 |
|
|
317 |
|
$default reduce using rule 3 (@2) |
318 |
|
|
319 |
|
expr go to state 6 |
320 |
|
@2 go to state 2 |
321 |
|
|
322 |
|
|
323 |
|
|
324 |
|
state 1 |
325 |
|
|
326 |
|
expr -> 'a' . @1 'b' (rule 2) |
327 |
|
|
328 |
|
$default reduce using rule 1 (@1) |
329 |
|
|
330 |
|
@1 go to state 3 |
331 |
|
|
332 |
|
|
333 |
|
|
334 |
|
state 2 |
335 |
|
|
336 |
|
expr -> @2 . 'c' (rule 4) |
337 |
|
|
338 |
|
'c' shift, and go to state 4 |
339 |
|
|
340 |
|
|
341 |
|
|
342 |
|
state 3 |
343 |
|
|
344 |
|
expr -> 'a' @1 . 'b' (rule 2) |
345 |
|
|
346 |
|
'b' shift, and go to state 5 |
347 |
|
|
348 |
|
|
349 |
|
|
350 |
|
state 4 |
351 |
|
|
352 |
|
expr -> @2 'c' . (rule 4) |
353 |
|
|
354 |
|
$default reduce using rule 4 (expr) |
355 |
|
|
356 |
|
|
357 |
|
|
358 |
|
state 5 |
359 |
|
|
360 |
|
expr -> 'a' @1 'b' . (rule 2) |
361 |
|
|
362 |
|
$default reduce using rule 2 (expr) |
363 |
|
|
364 |
|
|
365 |
|
|
366 |
|
state 6 |
367 |
|
|
368 |
|
$ go to state 7 |
369 |
|
|
370 |
|
|
371 |
|
|
372 |
|
state 7 |
373 |
|
|
374 |
|
$ go to state 8 |
375 |
|
|
376 |
|
|
377 |
|
|
378 |
|
state 8 |
379 |
|
|
380 |
|
$default accept |
381 |
|
]]) |
382 |
|
|
383 |
|
AT_CLEANUP |
384 |
|
|
385 |
|
|
386 |
|
|
387 |
## -------------------- ## |
## -------------------- ## |
388 |
## %expect not enough. ## |
## %expect not enough. ## |
389 |
## -------------------- ## |
## -------------------- ## |