blob: 7da88215ddc5c385f756f5813c130c3a7d0d0c84 (
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
|
lex string
{
token str_escape /'\\' any/
token str_chr /[^\\"]+/
}
def str_item
[str_escape]
| [str_chr]
def string
['"' str_item* '"']
lex start
{
token ident /[a-zA-Z_]+/
token number /[0-9]+/
literal '+', '*', ';', '"', '\'', '(', ')'
literal '+=', '-=', '*='
ignore wp /[ \t\n]+/
}
def expr
[expr '+' term]
| [term]
def term
[term '*' primary]
| [primary]
def primary
[number]
| [ident]
| [string]
| ['(' expr ')']
def expr_list
[expr_list expr ';']
| []
def start
[expr_list]
{
if match lhs
~a + "%{{"; 1 * 2;
{
print( 'yes\n' )
}
}
start S = parse start(stdin)
print_xml( S )
|