You will have to do that in the scanner using exclusive start states.
When it meets blanks after a NUMBER or ID, it emits the SPACE token if
the beginning of a number or identifier follows the blank(s):
<afternumid>{
[ \t]+/[a-z0-9] BEGIN(INITIAL); return SPACE;
[ \t]+ BEGIN(INITIAL);
}
On 12/02/2016 05:19 AM, Ricky Zhang wrote:
I have read through 'handling context dependencies' section Bison manual.
But I still haven't figured out the proper solution to my problem.
We have production rule:
expr : expr SINGLE_SPACE expr { /* some operation */ }
| expr + expr
...
;
expr: NUMBER
| ID
;
and also for all white space [SINGLE_SPACE | \t]* in the language should be
ignored. Are there any easy way to solve it?
Thanks,
Ricky
_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison
_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison