[antlr-interest] How can I emit multiple tokens in a lexer rule, using the C target?
Anders.Karlsson at sybase.com
Anders.Karlsson at sybase.com
Wed Jul 21 19:09:46 PDT 2010
Yes, as it is designed so that instead of overloading
you basically change the default function pointers
to point to something else (which in a sense
exactly is what overloading does).
E.g. if you want to install your own error handler
for the lexer you set the pointer to point to another func:
...
lxr = MyLexerNew(input)
lxr->pLexer->rec->reportError = MyReportLexError;
...
I would imagine a similar thing can be done with the emitter
(although I haven't tried that)
Thank you and kind regards,
Anders
Anders Karlsson | Staff SE II | Sybase Inc, Singapore | ( +65 6571 3125 | *
andersk at sybase.com
-- The competent programmer is fully aware of the strictly limited size of
his own skull; therefore he approaches the programming task in full
humility, and among other things he avoids clever tricks like the plague.
-- E.W. Dijkstra
"Billy O'Neal"
<billy.oneal at gmai
l.com> To
Sent by: antlr-interest at antlr.org
<antlr-interest-b cc
ounces at antlr.org>
Subject
[antlr-interest] How can I emit
07/22/2010 10:04 multiple tokens in a lexer rule,
AM using the C target?
There only seems to be documentation on how to do this using targets
with object oriented languages, which merely subclass the `emit`
method and wrap a buffer around it. This becomes a problem for the C
target of course because A. there are no virtual methods, and B. there
is no subclassing, and C. there is no (at least that I can find)
`emit` method.
Is there a way of accomplishing this with the C target?
Billy3
--------------------------------------------------------------
Intern - PreEmptive Solutions, LLC
Malware Response Instructor - BleepingComputer.com
Analyst, Security Team - TechSupportForum.com
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