summaryrefslogtreecommitdiff
path: root/test/btscan2.lm
blob: b1d7c99080289b80c5171d5e286c5afca34c9db0 (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
namespace r1
{
	lex r1
	{
		literal '!', 'a', 'b'
		ignore /[ \n\t]+/
	}

	def line [ '!' 'a' 'b' 'b' 'a']
}

namespace r2
{
	lex r2
	{
		literal '!'
		token id /[a-zA-Z_]+/
		ignore /[ \n\t]+/
	}

	def line [ '!' id ]
}

def item 
	[r1::line]
|	[r2::line]

def btscan 
	[item*]

cons Parser: parser<btscan> []

send Parser "!ab"
send Parser "b "
send Parser "!ab"
send Parser "ba !aab\n"

print_xml( Parser() )