[antlr-interest] Replacing the token type

Gokhan Caglar gcaglar at gmail.com
Thu May 31 18:49:45 PDT 2007


Thanks for the pointer :)
Gokhan

On 5/31/07, Micheal J <open.zone at virgin.net> wrote:
>
>  Hi Gokhan,
>
> Once you have your custom token class and it's associated TokenCreator,
> use the setTokenCreator(TokenCreator) method on your lexer instance. E.g.
>
>     myLexer.setTokenCreator( new MyCustomToken.MyCustomTokenCreator() );
>
> The 'csharp_v1' example shows how this is done (it is included with ANTLR
> 2.7.6+). It uses a custom token class and three lexers and sets all lexers
> to create tokens of the custom type. See the method "parseFile(string f,
> Stream s)" in the Main.cs file in that example.
>
> Micheal
>
> -----------------------
> The best way to contact me is via the list/forum. My time is very limited.
>
>  -----Original Message-----
> *From:* antlr-interest-bounces at antlr.org [mailto:
> antlr-interest-bounces at antlr.org] *On Behalf Of *Gokhan Caglar
> *Sent:* 31 May 2007 01:35
> *To:* antlr-interest at antlr.org
> *Subject:* [antlr-interest] Replacing the token type
>
> Hi, I was wondering what would be the simplest way of changing the
> instantiated token class?  I guess I have to derive from CommonToken, and
> and CommonTokenCreator, but how can I hook that up to the lexer?
> Thanks,
> Gokhan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070531/54534b4f/attachment.html 


More information about the antlr-interest mailing list