[antlr-interest] Extends the lexer in C target

Jim Idle jimi at temporal-wave.com
Tue Mar 2 07:53:20 PST 2010


mTokens is generated but you can install any function you like in its place by adding code in the initialization. You should see that the address of the static function is just stored in the lexer structures. Just replace the pointer with a pointer to your own function. Read through the source though to find out what you need to do in that function and the functions that it invokes.

That said, if you are trying to override this function, then you are really replacing the lexer. Perhaps you should tell us why you want to override that and what you are trying to achieve - maybe there is a better way.

Jim

-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Fabien Antoine
Sent: Tuesday, March 02, 2010 6:23 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Extends the lexer in C target

Hi list,

I'm working on a lexer/parser with the C runtime but I need to override
the "mTokens" function in the lexer to create a system of preprocessor.
However, I can't find the way to overwrite it with a clean method...

The "mTokens" function is static so I can't access it and I don't want
to edit by hand the ANTLR's C library to keep it clean.
And it seems to be quite complicated and not progressive to recreate an
other lexer structure with my new functions...

Thanks,

Fabien

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address





More information about the antlr-interest mailing list