blob: c514f6f7419c8f5fbc33fc60ad2cfcdf7eda7bc8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
tree grammar TTree;
options {
// Default but name it anyway
//
language = Java;
// Use the vocab from the parser (not the lexer)
// The ANTLR Maven plugin knows how to work out the
// relationships between the .g files and it will build
// the tree parser after the parser. It will also rebuild
// the tree parser if the parser is rebuilt.
//
tokenVocab = TParser;
// Use ANTLR built-in CommonToken for tree nodes
//
ASTLabelType = CommonToken;
}
// What package should the generated source exist in?
//
@header {
package ${package};
}
a : ^(SCRIPT stuff+)
| SCRIPT
;
stuff
: keyser
| expression
;
keyser
: ^(KEYSER SOZE)
{ System.out.println("Found Keyser Soze!!"); }
;
expression
: ^(ADD expression expression)
| ID
| INT
| STRING
;
|