bison/flex: Best practice to report an libc error to caller of yyparse

2009-06-13 Thread Nicolai Stange
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.

Re: bison/flex: Best practice to report an libc error to caller of yyparse

2009-06-13 Thread Hans Aberg
On 13 Jun 2009, at 13:40, Nicolai Stange wrote: i wonder how to report an libc error (maybe ENOMEM, EIO) that has occured in either yylex or yyparse to the caller of yyparse. As for the first error, memory allocation error, your program is likely unrecoverable, so just write an error message

Re: bison/flex: Best practice to report an libc error to caller of yyparse

2009-06-13 Thread Nicolai Stange
Hi, first of all: Thank you for your reply Hans. > > i wonder how to report an libc error > > (maybe ENOMEM, EIO) that has occured in either yylex or yyparse to the > > caller of yyparse. > > As for the first error, memory allocation error, your program is > likely unrecoverable, so just write

Re: bison/flex: Best practice to report an libc error to caller of yyparse

2009-06-13 Thread Hans Aberg
On 13 Jun 2009, at 17:55, Nicolai Stange wrote: i wonder how to report an libc error (maybe ENOMEM, EIO) that has occured in either yylex or yyparse to the caller of yyparse. As for the first error, memory allocation error, your program is likely unrecoverable, so just write an error messag