[antlr-interest] How to set filename in parser
shmuel siegel
antlr at shmuelhome.mine.nu
Wed Jul 13 09:26:29 PDT 2005
My grammar parses the output of a c preprocessor. It interprets the
#line directives so that syntax errors can be easily tracked back to the
original file. My lexer sets the filename and linenumber parameters
appropriately and then treats the directive like a single line comment.
This works fine for the lexer; when an error occurs, the proper error
message is printed. But the parser never finds out about this
resequencing, so syntactical errors at the parser level do not reflect
the original file information. Short of overriding the various match
routines, is there any simple way to propagate the #line information
from the lexer to the parser?
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.8.13/47 - Release Date: 7/12/2005
More information about the antlr-interest
mailing list