Last change
on this file since 1 was
1,
checked in by lnalod, 15 years ago
|
Initial import of YAO sources
|
File size:
451 bytes
|
Rev | Line | |
---|
[1] | 1 | /* This grammar demonstrates the use of two parsers sharing a token |
---|
| 2 | * vocabulary with a single lexer. |
---|
| 3 | */ |
---|
| 4 | |
---|
| 5 | header { |
---|
| 6 | /* empty header */ |
---|
| 7 | } |
---|
| 8 | |
---|
| 9 | options { |
---|
| 10 | language=Cpp; |
---|
| 11 | } |
---|
| 12 | |
---|
| 13 | class SimpleLexer extends Lexer; |
---|
| 14 | |
---|
| 15 | options { |
---|
| 16 | exportVocab=Simple; |
---|
| 17 | } |
---|
| 18 | |
---|
| 19 | WS_ : (' ' |
---|
| 20 | | '\t' { tab(); } |
---|
| 21 | | '\n' { newline(); } |
---|
| 22 | | '\r') |
---|
| 23 | { $setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP); } |
---|
| 24 | ; |
---|
| 25 | |
---|
| 26 | A : 'a' | 'A' ; |
---|
| 27 | B : 'b' | 'B' ; |
---|
| 28 | C : 'c' | 'C' ; |
---|
| 29 | D : 'd' | 'D' ; |
---|
| 30 | |
---|
Note: See
TracBrowser
for help on using the repository browser.