summaryrefslogtreecommitdiff
path: root/test/btscan1.lm
blob: 6afa707b3f90759bbdc4a26ad188566cc89bc238 (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
#
# R1
#
namespace r1

	lex
		literal '!', 'a', 'b'
		ignore /[ \n\t]+/
	end

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

end r1

#
# R2
#
namespace r2

	lex
		literal '!'
		token id /[a-zA-Z_]+/
		ignore /[ \n\t]+/
	end

	def line [ '!' id ]

end r2

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

def btscan 
	[item*]

parse P: btscan[ stdin ]

match P.tree ~!abb !abba !aab
print_xml(P.tree)
print( '\n' )