mapres 3.dev11__tar.gz → 3.dev13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mapres-3.dev11/src/mapres.egg-info → mapres-3.dev13}/PKG-INFO +1 -1
- {mapres-3.dev11 → mapres-3.dev13}/pyproject.toml +1 -1
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres/datamap.py +1 -1
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres/resolver.py +2 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres/tokenizer.py +10 -27
- {mapres-3.dev11 → mapres-3.dev13/src/mapres.egg-info}/PKG-INFO +1 -1
- {mapres-3.dev11 → mapres-3.dev13}/LICENSE +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/README.md +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/setup.cfg +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres/__init__.py +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres/ast.py +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres/cache.py +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres/evaluator.py +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres/exceptions.py +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres/layers.py +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres/maps/__init__.py +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres/maps/color.py +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres/maps/time.py +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres/parser.py +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres.egg-info/SOURCES.txt +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres.egg-info/dependency_links.txt +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres.egg-info/requires.txt +0 -0
- {mapres-3.dev11 → mapres-3.dev13}/src/mapres.egg-info/top_level.txt +0 -0
|
@@ -78,7 +78,7 @@ def datamap(_cls=None, *, syntax=None, mode=None):
|
|
|
78
78
|
cls = type(cls.__name__, (DataMap,), namespace)
|
|
79
79
|
if rules_obj is not None:
|
|
80
80
|
setattr(cls, 'rules', rules_obj)
|
|
81
|
-
return dataclass(frozen=False)(cls)
|
|
81
|
+
return dataclass(frozen=False)(cls)()
|
|
82
82
|
if _cls is not None:
|
|
83
83
|
return wrap(_cls)
|
|
84
84
|
return wrap
|
|
@@ -104,6 +104,8 @@ def setGlobalMaps(maps, *, priority=0):
|
|
|
104
104
|
Register a global map or datamap instance/class/dict.
|
|
105
105
|
Lower priority = earlier lookup.
|
|
106
106
|
"""
|
|
107
|
+
if isinstance(maps, type):
|
|
108
|
+
maps = maps()
|
|
107
109
|
_DEFAULT_RESOLVER.layers.add_layer(maps, priority=priority)
|
|
108
110
|
|
|
109
111
|
def res(text: str, **ctx) -> str:
|
|
@@ -4,25 +4,18 @@ from enum import Enum, auto
|
|
|
4
4
|
class TokenType(Enum):
|
|
5
5
|
TEXT = auto()
|
|
6
6
|
IDENT = auto()
|
|
7
|
-
|
|
8
7
|
COLON_OPEN = auto()
|
|
9
8
|
COLON_CLOSE = auto()
|
|
10
|
-
|
|
11
9
|
BRACE_OPEN = auto()
|
|
12
10
|
BRACE_CLOSE = auto()
|
|
13
|
-
|
|
14
11
|
DOLLAR_OPEN = auto()
|
|
15
12
|
DOLLAR_CLOSE = auto()
|
|
16
|
-
|
|
17
13
|
ANGLE_OPEN = auto()
|
|
18
14
|
ANGLE_CLOSE = auto()
|
|
19
|
-
|
|
20
15
|
PIPE_OPEN = auto()
|
|
21
16
|
PIPE_CLOSE = auto()
|
|
22
|
-
|
|
23
17
|
PERCENT_OPEN = auto()
|
|
24
18
|
PERCENT_CLOSE = auto()
|
|
25
|
-
|
|
26
19
|
LPAREN = auto()
|
|
27
20
|
RPAREN = auto()
|
|
28
21
|
|
|
@@ -45,12 +38,9 @@ class Tokenizer:
|
|
|
45
38
|
self.i = 0
|
|
46
39
|
self.n = len(text)
|
|
47
40
|
self.tokens = []
|
|
48
|
-
|
|
49
|
-
# state for single-char paired delimiters
|
|
50
41
|
self.in_pipe = False
|
|
51
42
|
self.in_percent = False
|
|
52
43
|
self.in_colon = False
|
|
53
|
-
self.escaped = False
|
|
54
44
|
|
|
55
45
|
def peek(self, k=0):
|
|
56
46
|
idx = self.i + k
|
|
@@ -78,33 +68,26 @@ class Tokenizer:
|
|
|
78
68
|
while self.i < self.n:
|
|
79
69
|
ch = self.peek()
|
|
80
70
|
|
|
81
|
-
# ESCAPES
|
|
82
71
|
if self.match(r'\:'):
|
|
83
|
-
buf.append(':'); self.advance(2);
|
|
72
|
+
buf.append(':'); self.advance(2); continue
|
|
84
73
|
if self.match(r'\<'):
|
|
85
|
-
buf.append('<'); self.advance(2);
|
|
74
|
+
buf.append('<'); self.advance(2); continue
|
|
86
75
|
if self.match(r'\>'):
|
|
87
|
-
buf.append('>'); self.advance(2);
|
|
76
|
+
buf.append('>'); self.advance(2); continue
|
|
88
77
|
if self.match(r'\%'):
|
|
89
|
-
buf.append('%'); self.advance(2);
|
|
78
|
+
buf.append('%'); self.advance(2); continue
|
|
90
79
|
if self.match(r'\$'):
|
|
91
|
-
buf.append('$'); self.advance(2);
|
|
80
|
+
buf.append('$'); self.advance(2); continue
|
|
92
81
|
if self.match(r'\{'):
|
|
93
|
-
buf.append('{'); self.advance(2);
|
|
82
|
+
buf.append('{'); self.advance(2); continue
|
|
94
83
|
if self.match(r'\}'):
|
|
95
|
-
buf.append('}'); self.advance(2);
|
|
84
|
+
buf.append('}'); self.advance(2); continue
|
|
96
85
|
if self.match(r'\|'):
|
|
97
|
-
buf.append('|'); self.advance(2);
|
|
86
|
+
buf.append('|'); self.advance(2); continue
|
|
98
87
|
if self.match(r'\('):
|
|
99
|
-
buf.append('('); self.advance(2);
|
|
88
|
+
buf.append('('); self.advance(2); continue
|
|
100
89
|
if self.match(r'\)'):
|
|
101
|
-
buf.append(')'); self.advance(2);
|
|
102
|
-
|
|
103
|
-
if self.escaped:
|
|
104
|
-
buf.append(ch)
|
|
105
|
-
self.escaped = False
|
|
106
|
-
self.advance()
|
|
107
|
-
continue
|
|
90
|
+
buf.append(')'); self.advance(2); continue
|
|
108
91
|
|
|
109
92
|
if self.match("{{"):
|
|
110
93
|
flush_text()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|