summaryrefslogtreecommitdiff
path: root/test/accum3.lm
blob: 9d19e2185bf11047cdbdb0eceb6ca6d8ac1f88b7 (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
lex
{   
	literal '-'
	token file /^('-'|0)(^0)*/
}

token word /(^0)+/
token zero /0/ 

lex
{
	token single /[qvh]/
	token with_opt /[oi]/
}

def item
	[file zero]
|	['-' single* zero]
|	['-' with_opt zero? word zero]

def args 
	[word zero item*]

cons ArgParser: parser<args> []

ArgV: list<str> ArgV = argv
for A: str in ArgV 
	send ArgParser [A '\0']

Args: args = ArgParser() 

print_xml( Args )