| 1 |
#TreeTransformer |
| 2 |
Grammar(str:name str:tree @rules) {{{ |
| 3 |
class $name: |
| 4 |
tree = $tree |
| 5 |
$rules |
| 6 |
}}} |
| 7 |
Rule(str:name @rules) {{{ |
| 8 |
$name = [ |
| 9 |
$rules |
| 10 |
] |
| 11 |
}}} |
| 12 |
|
| 13 |
Ascend() --> t.Ascend(), |
| 14 |
Bind(str:x) --> t.Bind($x), |
| 15 |
Call(str:x) --> t.Call($x), |
| 16 |
Choice(str:x) --> t.Choice($x), |
| 17 |
Commit(str:x) --> t.Commit($x), |
| 18 |
Descend() --> t.Descend(), |
| 19 |
EndSlice() --> t.EndSlice(), |
| 20 |
Fail() --> t.Fail(), |
| 21 |
ForeignCall(str:x str:y) --> t.ForeignCall($x, $y), |
| 22 |
Match(str:x) --> t.Match($x), |
| 23 |
Predicate() --> t.Predicate(), |
| 24 |
Push() --> t.Push(), |
| 25 |
Python(str:x) --> t.Python($x), |
| 26 |
StartSlice() --> t.StartSlice(), |
| 27 |
SuperCall(str:x) --> t.SuperCall($x), |
| 28 |
|
| 29 |
str = anything:s -> str(s.data) |