| 1 |
schema = production+:ps -> schema(ps) |
| 2 |
production = tag:t ws '::=' argList:a ws ';' -> production(t, a) |
| 3 |
|
| 4 |
functor = (spaces ( (functorHole functorHole !(reserved("hole-tagged-hole"))) |
| 5 |
| ('.'? functorHole) |
| 6 |
| (tag:t functorHole:h) -> taggedHole(t, h))) |
| 7 |
| super |
| 8 |
|
| 9 |
arg = interleave:l (ws '|' interleave)*:r -> _or(l, *r) |
| 10 |
interleave = action:l (ws '&' action)*:r -> interleave(l, *r) |
| 11 |
action = pred:l (ws '->' pred:r -> action(l, *r) |
| 12 |
| -> l) |
| 13 |
pred = some | (ws '!' some:x -> not(x)) |
| 14 |
some = (quant:q -> some(None, q) |
| 15 |
| ( prim:l ( (ws '**' prim:r -> matchSeparatedSequence(l, r)) |
| 16 |
| (ws '++' prim:r -> matchSeparatedSequence1(l, r)) |
| 17 |
)?:seq |
| 18 |
quant?:q -> some(seq or l, q))) |
| 19 |
quant = ws ('?' |'+' | '*') |
| 20 |
prim = term |
| 21 |
| ('.' -> any()) |
| 22 |
| (literal:l ws '..' literal:r -> range(l, r)) |
| 23 |
| ws '^' string:s -> anyOf(s) |
| 24 |
| ws '(' argList:l ws ')' -> l |
| 25 |
|
| 26 |
simpleint = decdigits:ds -> int(ds) |
| 27 |
functorHole = '$' (simpleint:i | '{' simpleint:i '}' | (tag:t -> t.name):i) -> dollarHole(i) |
| 28 |
|('@' | '=') (simpleint:i | '{' simpleint:i '}' | (tag:t -> t.name):i) -> patternHole(i) |