8 import re |
8 import re |
9 import parser, error, util, merge |
9 import parser, error, util, merge |
10 from i18n import _ |
10 from i18n import _ |
11 |
11 |
12 elements = { |
12 elements = { |
13 # token-type: binding-strength, prefix, infix, suffix |
13 # token-type: binding-strength, primary, prefix, infix, suffix |
14 "(": (20, ("group", 1, ")"), ("func", 1, ")"), None), |
14 "(": (20, None, ("group", 1, ")"), ("func", 1, ")"), None), |
15 "-": (5, ("negate", 19), ("minus", 5), None), |
15 "-": (5, None, ("negate", 19), ("minus", 5), None), |
16 "not": (10, ("not", 10), None, None), |
16 "not": (10, None, ("not", 10), None, None), |
17 "!": (10, ("not", 10), None, None), |
17 "!": (10, None, ("not", 10), None, None), |
18 "and": (5, None, ("and", 5), None), |
18 "and": (5, None, None, ("and", 5), None), |
19 "&": (5, None, ("and", 5), None), |
19 "&": (5, None, None, ("and", 5), None), |
20 "or": (4, None, ("or", 4), None), |
20 "or": (4, None, None, ("or", 4), None), |
21 "|": (4, None, ("or", 4), None), |
21 "|": (4, None, None, ("or", 4), None), |
22 "+": (4, None, ("or", 4), None), |
22 "+": (4, None, None, ("or", 4), None), |
23 ",": (2, None, ("list", 2), None), |
23 ",": (2, None, None, ("list", 2), None), |
24 ")": (0, None, None, None), |
24 ")": (0, None, None, None, None), |
25 "symbol": (0, ("symbol",), None, None), |
25 "symbol": (0, "symbol", None, None, None), |
26 "string": (0, ("string",), None, None), |
26 "string": (0, "string", None, None, None), |
27 "end": (0, None, None, None), |
27 "end": (0, None, None, None, None), |
28 } |
28 } |
29 |
29 |
30 keywords = set(['and', 'or', 'not']) |
30 keywords = set(['and', 'or', 'not']) |
31 |
31 |
32 globchars = ".*{}[]?/\\_" |
32 globchars = ".*{}[]?/\\_" |