363 |
each state with conflicts.) |
each state with conflicts.) |
364 |
|
|
365 |
|
|
366 |
|
* $undefined |
367 |
|
From Hans: |
368 |
|
- If the Bison generated parser experiences an undefined number in the |
369 |
|
character range, that character is written out in diagnostic messages, an |
370 |
|
addition to the $undefined value. |
371 |
|
|
372 |
|
Suggest: Change the name $undefined to undefined; looks better in outputs. |
373 |
|
|
374 |
|
* Default Action |
375 |
|
From Hans: |
376 |
|
- For use with my C++ parser, I transported the "switch (yyn)" statement |
377 |
|
that Bison writes to the bison.simple skeleton file. This way, I can remove |
378 |
|
the current default rule $$ = $1 implementation, which causes a double |
379 |
|
assignment to $$ which may not be OK under C++, replacing it with a |
380 |
|
"default:" part within the switch statement. |
381 |
|
|
382 |
|
Note that the default rule $$ = $1, when typed, is perfectly OK under C, |
383 |
|
but in the C++ implementation I made, this rule is different from |
384 |
|
$<type_name>$ = $<type_name>1. I therefore think that one should implement |
385 |
|
a Bison option where every typed default rule is explicitly written out |
386 |
|
(same typed ruled can of course be grouped together). |
387 |
|
|
388 |
|
* Pre and post actions. |
389 |
|
From: Florian Krohm <florian@edamail.fishkill.ibm.com> |
390 |
|
Subject: YYACT_EPILOGUE |
391 |
|
To: bug-bison@gnu.org |
392 |
|
X-Sent: 1 week, 4 days, 14 hours, 38 minutes, 11 seconds ago |
393 |
|
|
394 |
|
The other day I had the need for explicitly building the parse tree. I |
395 |
|
used %locations for that and defined YYLLOC_DEFAULT to call a function |
396 |
|
that returns the tree node for the production. Easy. But I also needed |
397 |
|
to assign the S-attribute to the tree node. That cannot be done in |
398 |
|
YYLLOC_DEFAULT, because it is invoked before the action is executed. |
399 |
|
The way I solved this was to define a macro YYACT_EPILOGUE that would |
400 |
|
be invoked after the action. For reasons of symmetry I also added |
401 |
|
YYACT_PROLOGUE. Although I had no use for that I can envision how it |
402 |
|
might come in handy for debugging purposes. |
403 |
|
All is needed is to add |
404 |
|
|
405 |
|
#if YYLSP_NEEDED |
406 |
|
YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen, yyloc, (yylsp - yylen)); |
407 |
|
#else |
408 |
|
YYACT_EPILOGUE (yyval, (yyvsp - yylen), yylen); |
409 |
|
#endif |
410 |
|
|
411 |
|
at the proper place to bison.simple. Ditto for YYACT_PROLOGUE. |
412 |
|
|
413 |
|
I was wondering what you think about adding YYACT_PROLOGUE/EPILOGUE |
414 |
|
to bison. If you're interested, I'll work on a patch. |
415 |
|
|
416 |
----- |
----- |
417 |
|
|
418 |
Copyright (C) 2001, 2002 Free Software Foundation, Inc. |
Copyright (C) 2001, 2002 Free Software Foundation, Inc. |