Hi John,

On Thu, Feb 18, 2010 at 7:52 PM, John Pool <j.p...@ision.nl> wrote:

> ...
>
> Question: how do I 'execute' such a grammar lexer in C# without feeding it
> into a parser?
>
>
You probably meant to instantiate a FuzzyLexer instead of a FuzzyParser
(unless your lexer grammar is called FuzzyParser, of course...).
Try this:

        ANTLRStringStream in = new ANTLRStringStream("...some source
as a String...");
        FuzzyLexer lexer = new FuzzyLexer(in);
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        for(Object obj : tokens.getTokens()) {
            Token token = (Token)obj;
            System.out.println(token);
        }

Although the code above is Java, the C# variant can't be that much
different.

For a complete example how to use such a lexer, see the first answer from
this post on Stackoverflow:
http://stackoverflow.com/questions/2284571/how-to-match-a-comment-unless-its-in-a-quoted-string




>
> I tried downloading http://www.antlr.org/download/examples-v3.tar.gz, as
> suggested in the book, but that URL won't open.
>

No problem here: I can download that file just fine.

Regards,

Bart.

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

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to