blob: 8cc43a4a87b420bb2477218f4b155afab52db345 (
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*]
Parser: parser<btscan> = cons parser<btscan> []
Parser << "!ab"
Parser << "b "
Parser << "!ab"
Parser << "ba !aab\n"
print_xml(Parser.finish())
|