[antlr-interest] case-insensitive parsing
Andreas Meyer
andreas.meyer at smartshift.de
Thu Apr 23 05:20:39 PDT 2009
Have you tried making the whole comment a lexer token? This way, the
keyword tokens would not interfere with plain text inside comments (If
that was your intention: lexer rule names have to start with an upper
case letter)
Andreas
Bob Sole schrieb:
> I'm trying to write a parser for PL/SQL package header files but I'm
> banging my head against the wall with a basic problem to do with
> case-insensitive parsing. I'm using Jim Idle's NoCaseFileStream to
> convert tokens into upper case, but I'm finding that the parser gets
> confused when it comes across language keywords that are embedded
> within comments. Here's some example input which has the OR keyword
> embedded within the package comment. The "create or replace package"
> statement is deliberately messed up - the parser handles this
> correctly, but it stumbles against the first 'or' on line 2:
>
> /**
> blah blah or blah
> */
> create Or rePlace PACKAGE
> test IS
>
> Here's the grammar:
>
> grammar Test;
>
> input: statement+ ;
>
> statement: pkgComment | pkgStmt ;
>
> pkgComment: '/**' description '*/' ;
More information about the antlr-interest
mailing list