summaryrefslogtreecommitdiff
path: root/test/undofrag1.lm
blob: 2f2d4d049e5ecf39a52775eda8ea7a7eab4de465 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
lex start2
{
	ignore /space+/
	literal '#', '{', '}'
	token id2 /[a-zA-Z_]+/ 
}

def item2
	[id2]
|	['{' item2* '}']

def start2
	[item2*]

global SP: parser<start2> = 
	cons parser<start2> []

context ctx
{
	lex start
	{
		ignore /space+/
		literal '*', '(', ')', '!', ';\n'
		token id /[a-zA-Z_]+/ 
	}

	def item 
		[id]
	|	['(' item* ')']


	def A [] {
		print( 'A\n' )
		send SP "{ A{d} }"
	}

	def B [] {
		print( 'B\n' )
		send SP "{ B{d} }"
	}

	def start 
		[A item* '!']
	|	[B item* ';\n']
}

send SP "a b{c}"

CTX: ctx = cons ctx []
Input: ctx::start = parse ctx::start( CTX stdin )

send SP "{e}f g"

print( Input )
print( SP() '\n' )