Line numbering with flex

Thomas Okken thomas at duteca
Fri Mar 1 05:57:31 AEST 1991


I am working on porting "rayshade" to the Mac's MPW Shell. Rayshade uses lex
and yacc to scan and parse its input files, and it reports errors using the
yylineno variable.
When lex is used to generate the scanner, yylineno is incremented as each LF
is read, and a routine in the ".l" file takes care of updating yylineno and
yyfilename when cpp-style "#line" directives are scanned.
Flex, however, does *not* update yylineno. This is very annoying, as all
errors are now reported to take place in line #1.
The README file warns that lex features missing from flex are probably hard
to implement (which is why it hasn't been done already), and some nosing around
the flex sources has confirmed this.

If anyone has a fix for changing the flex skeleton to support updating
yylineno, please let me know. Thanks!

 - Thomas (thomas at duteca.et.tudelft.nl)



More information about the Comp.unix.programmer mailing list