Posted By:
Amakura_Hotaru
Posted On:
Thursday, July 20, 2006 02:50 AM
There are keywords like "NO-UNDO", "BUFFER-COPY" in the language which I'm writing a parser for. ANTLR Manual says "any double-quoted string used in a parser is automatically entered into the literals table of the associated lexer". But when I write in my .g file like this: keyword: "NO-UNDO" | "BUFFER-COPY" | "NO-LOBS" | "NO-ERROR" | ... and rules like this: usestate : "USE"^ expression ("NO-ERROR")? state_end ; state_end : PERIOD ; PERIOD : '.' ; ANTLR generates MyTok
More>>
There are keywords like "NO-UNDO", "BUFFER-COPY" in the language which I'm writing a parser for. ANTLR Manual says "any double-quoted string used in a parser is automatically entered into the literals table of the associated lexer". But when I write in my .g file like this:
keyword:
"NO-UNDO" | "BUFFER-COPY" | "NO-LOBS" | "NO-ERROR" | ...
and rules like this:
usestate
: "USE"^ expression ("NO-ERROR")? state_end
;
state_end
: PERIOD
;
PERIOD : '.'
;
ANTLR generates MyTokenTypes.java like this:
public interface MyTokenTypes {
...
// "NO-UNDO" = 41
...
}
How to recognize the keyword with ANTLR?
<<Less