[antlr-interest] problem with literal match

Ric Klaren klaren at cs.utwente.nl
Thu Oct 4 01:50:24 PDT 2001


On Thu, Oct 04, 2001 at 12:41:52AM +0300, Ruslan Zasukhin wrote:
> Well, it seems I have found at least one way when it works.
> I did have Lexer and Parser in separate files. In Lexer I did have
>     exportVocab=OBL_SQL
> in Parser I have   
>     importVocab=OBL_SQL
> In this configuration ANTLR produce EMPTY initLiterals()...

You're doing something wrong then ;) I use the same setup daily without
problem. Maybe manually add a bit of code to your lexer and see what's in
the map? Are you using caseSensitive or caseSensitiveLiterals or both? What
are the exact options you feed to antlr?

Or maybe did you define the DROP token in your parser and not in the lexer?
This would explain why it works with lexer and parser in one file. If you
use exportvocab make sure you define *all* tokens in the lexer. In the
parser you can safely add new imaginary AST tokens but *no* lexer tokens.
Since how would the lexer know about them? (ok this could be fixed but
antlr doesn't work that way now)

> When I have put Lexer into the same file as Parser It start work.
> I also remove export/import options after merge...
> So may be bug in ANTLR...may be I have made something wrong, but what ?

The import/export vocab options and lexer and parser in one/separate
file(s) is a nice thing to get right. The docs are a bit cryptic on this
point look in the archives for a complete and exhaustive discussion of the
topic. Behaviour of antlr is quite different in both cases (something I'm
lobbying against).

Hmmm I see I was not 100% correct in my previous mail... Think I have some
cleaning up to do with respect to casesensitivity.

    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
 'And this 'rebooting' business? Give it a good kicking, do you?' 'Oh, no,
  of course, we ... that is ... well, yes, in fact,' said Ponder. 'Adrian
    goes round the back and ... er ... prods it with his foot. But in a
     technical way,' he added. --- From: Hogfather by Terry Pratchett.


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list