blob: ebf55df2dcd0948cb580f947b61561d10b6297bb (
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
|
# Token names.
lex start
{
token number /[0-9]+/
token id /[a-z]+/
token string /'"' [^"]* '"'/
ignore ws / [ \t\n]+ /
}
def prefix [id]
def choice1
[number number]
| [number]
def choice2
[string id]
| [number number]
| [id number]
| [number]
def start
[prefix choice1 choice2 string id id]
{
print_xml( match lhs "id 77 88 \"hello\" dude dude\n" )
}
parse start[stdin]
|