Question about Lex
Ger Timmens
gtir5 at fel.tno.nl
Wed May 29 18:19:12 AEST 1991
This is what I do:
1. lex lexcommands /* ==> lex.yy.c */
2. cc lex.yy.c /* ==> a.out */
3. a.out < input > output /* ==> output */
I've got the following problem:
When I encounter a string in the file *input* I want to
generate an error message reporting the line number and
file.
However I cannot include the following in my *lexcommands* file:
"string" fprintf(stderr,"Found *string* on line %d in %s.\n",
__LINE__,__FILE__);
since this would report the line number in the file *lex.yy.c* !
Is there a solution to this problem ?
I've experimented with #line, but I did not succeed.
Thanks in advance,
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
= Ger Timmens, Fysisch Elektronisch Laboratorium TNO =
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
= Tel.: 070-3264221 tst. 308 @-mail: gtir5 at fel.tno.nl =
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
= >>> Any You Can Do, I Can Do Better, (No You Can't) ... <<< =
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
More information about the Comp.lang.c
mailing list