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
|
#TreeTransformer
Grammar(str:name str:tree @rules) {{{
class $name:
tree = $tree
$rules
}}}
Rule(str:name @rules) {{{
$name = [
$rules
]
}}}
Ascend() --> t.Ascend(),
Bind(str:x) --> t.Bind($x),
Call(str:x) --> t.Call($x),
Choice(str:x) --> t.Choice($x),
Commit(str:x) --> t.Commit($x),
Descend() --> t.Descend(),
EndSlice() --> t.EndSlice(),
Fail() --> t.Fail(),
ForeignCall(str:x str:y) --> t.ForeignCall($x, $y),
Match(str:x) --> t.Match($x),
Predicate() --> t.Predicate(),
Push() --> t.Push(),
Python(str:x) --> t.Python($x),
StartSlice() --> t.StartSlice(),
SuperCall(str:x) --> t.SuperCall($x),
str = anything:s -> str(s.data)
|