[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bison/flex: Best practice to report an libc error to caller of yyparse
From: |
Nicolai Stange |
Subject: |
bison/flex: Best practice to report an libc error to caller of yyparse |
Date: |
Sat, 13 Jun 2009 13:40:07 +0200 |
Hi,
i'm new to bison and flex and i wonder how to report an libc error
(maybe ENOMEM, EIO) that has occured in either yylex or yyparse to the
caller of yyparse.
My current strategy is to define a token ERROR that yylex returns if it
encounters such an error and sets some global variable to errno.
If yyparse encounters
- token ERROR, it YYABORTs
- a libc error by itself it sets some global variable to errno and
YYABORTs.
In my bison file I have
err: ERROR { YYABORT; }
in my rules section and bison warns that it's useless, a fact that
brings me to the question if my way is the best way of doing things?
Another question that might not belong to here but maybe somebody knows
it ad-hoc:
Is there an automake way of telling flex to also generate a header file?
Thank you very much!
Regards
Nicolai Stange
- bison/flex: Best practice to report an libc error to caller of yyparse,
Nicolai Stange <=