[antlr-interest] Lexing troubles

Johannes Luber jaluber at gmx.de
Tue Aug 7 05:13:35 PDT 2007


Has no one an idea? Or did I send the email on the wrong day?

Johannes Luber wrote:
> Hello!
> 
> I've been finally testing my C#-Lexer and after changing some rules I've
> got it working. But there are a few details I'm not happy about.
> 
> The first is that I have to use the filter option. Otherwise I can't get
> the lexer to work. It seems to be the same issue as in the thread
> "Understanding priorities in lexing (newbie)". Unfortunately I have to
> use a catch-all EVERYTHING_ELSE rule. If no one has an idea how I can do
> the lexer without filtering then I'd appreciate suggestions how I should
> do error reporting here.
> 
> Another issue is that I have to change the constructor as I have to do
> some additional initialization. Right now I have an extra function named
> Init(), which I call after the object construction but this is clumsy. I
> could use a static constructor but I don't really want to hardwire the
> grammar name into the file. Should someone rename it the same grammar
> will generate a failing file. At least now the dependency is obvious.
> I'm missing a general mechanism to adapt constructors to the grammar
> authors needs.
> 
> For those, who want to test the attached file themselves: The current C#
> target doesn't support lexer scopes. I've transposed the Java fix so you
> have to use a self-build ANTLR. Unless you manage to convince it
> otherwise to use the fixed .stg. It may be possible that the C# target
> is still broken in the newest sources (didn't test them) so I'd be
> willing to send my local copy of the sources if the need arises.
> 
> Best regards,
> Johannes Luber
> 



More information about the antlr-interest mailing list