mapres 3.dev5__tar.gz → 3.dev7__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.dev5/src/mapres.egg-info → mapres-3.dev7}/PKG-INFO +1 -1
- {mapres-3.dev5 → mapres-3.dev7}/pyproject.toml +1 -1
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres/ast.py +3 -2
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres/parser.py +1 -1
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres/tokenizer.py +21 -33
- {mapres-3.dev5 → mapres-3.dev7/src/mapres.egg-info}/PKG-INFO +1 -1
- {mapres-3.dev5 → mapres-3.dev7}/LICENSE +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/README.md +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/setup.cfg +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres/__init__.py +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres/cache.py +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres/datamap.py +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres/evaluator.py +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres/exceptions.py +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres/layers.py +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres/maps/__init__.py +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres/maps/color.py +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres/maps/time.py +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres/resolver.py +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres.egg-info/SOURCES.txt +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres.egg-info/dependency_links.txt +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres.egg-info/requires.txt +0 -0
- {mapres-3.dev5 → mapres-3.dev7}/src/mapres.egg-info/top_level.txt +0 -0
|
@@ -8,7 +8,7 @@ class Node:
|
|
|
8
8
|
|
|
9
9
|
@dataclass
|
|
10
10
|
class TemplateNode(Node):
|
|
11
|
-
children: list[
|
|
11
|
+
children: list[Node]
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
@dataclass
|
|
@@ -18,7 +18,8 @@ class TextNode(Node):
|
|
|
18
18
|
|
|
19
19
|
@dataclass
|
|
20
20
|
class IdentNode(Node):
|
|
21
|
-
name: str
|
|
21
|
+
name: str
|
|
22
|
+
syntax: str
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
@dataclass
|
|
@@ -46,6 +46,11 @@ class Tokenizer:
|
|
|
46
46
|
self.n = len(text)
|
|
47
47
|
self.tokens = []
|
|
48
48
|
|
|
49
|
+
# state for single-char paired delimiters
|
|
50
|
+
self.in_pipe = False
|
|
51
|
+
self.in_percent = False
|
|
52
|
+
self.in_colon = False
|
|
53
|
+
|
|
49
54
|
def peek(self, k=0):
|
|
50
55
|
idx = self.i + k
|
|
51
56
|
if idx >= self.n:
|
|
@@ -72,9 +77,7 @@ class Tokenizer:
|
|
|
72
77
|
while self.i < self.n:
|
|
73
78
|
ch = self.peek()
|
|
74
79
|
|
|
75
|
-
#
|
|
76
|
-
# ESCAPING: \X → literal X
|
|
77
|
-
# ------------------------------------
|
|
80
|
+
# ESCAPES
|
|
78
81
|
if self.match(r'\:'):
|
|
79
82
|
buf.append(':'); self.advance(2); continue
|
|
80
83
|
if self.match(r'\<'):
|
|
@@ -96,9 +99,7 @@ class Tokenizer:
|
|
|
96
99
|
if self.match(r'\)'):
|
|
97
100
|
buf.append(')'); self.advance(2); continue
|
|
98
101
|
|
|
99
|
-
# ------------------------------------
|
|
100
102
|
# DOUBLE BRACES {{value}}
|
|
101
|
-
# ------------------------------------
|
|
102
103
|
if self.match("{{"):
|
|
103
104
|
flush_text()
|
|
104
105
|
self.emit(TokenType.BRACE_OPEN)
|
|
@@ -111,9 +112,7 @@ class Tokenizer:
|
|
|
111
112
|
self.advance(2)
|
|
112
113
|
continue
|
|
113
114
|
|
|
114
|
-
# ------------------------------------
|
|
115
115
|
# DOLLARS ${value}
|
|
116
|
-
# ------------------------------------
|
|
117
116
|
if self.match("${"):
|
|
118
117
|
flush_text()
|
|
119
118
|
self.emit(TokenType.DOLLAR_OPEN)
|
|
@@ -126,9 +125,7 @@ class Tokenizer:
|
|
|
126
125
|
self.advance()
|
|
127
126
|
continue
|
|
128
127
|
|
|
129
|
-
# ------------------------------------
|
|
130
128
|
# ANGLES <value>
|
|
131
|
-
# ------------------------------------
|
|
132
129
|
if self.match("<"):
|
|
133
130
|
flush_text()
|
|
134
131
|
self.emit(TokenType.ANGLE_OPEN)
|
|
@@ -141,48 +138,43 @@ class Tokenizer:
|
|
|
141
138
|
self.advance()
|
|
142
139
|
continue
|
|
143
140
|
|
|
144
|
-
# ------------------------------------
|
|
145
141
|
# PIPES |value|
|
|
146
|
-
# ------------------------------------
|
|
147
142
|
if self.match("|"):
|
|
148
143
|
flush_text()
|
|
149
|
-
|
|
150
|
-
# |IDENT| → PIPE_OPEN IDENT PIPE_CLOSE
|
|
151
|
-
# parser enforces structure
|
|
152
|
-
if self.tokens and self.tokens[-1].type == TokenType.PIPE_OPEN:
|
|
153
|
-
self.emit(TokenType.PIPE_CLOSE)
|
|
154
|
-
else:
|
|
144
|
+
if not self.in_pipe:
|
|
155
145
|
self.emit(TokenType.PIPE_OPEN)
|
|
146
|
+
self.in_pipe = True
|
|
147
|
+
else:
|
|
148
|
+
self.emit(TokenType.PIPE_CLOSE)
|
|
149
|
+
self.in_pipe = False
|
|
156
150
|
self.advance()
|
|
157
151
|
continue
|
|
158
152
|
|
|
159
|
-
# ------------------------------------
|
|
160
153
|
# PERCENTS %value%
|
|
161
|
-
# ------------------------------------
|
|
162
154
|
if self.match("%"):
|
|
163
155
|
flush_text()
|
|
164
|
-
if
|
|
165
|
-
self.emit(TokenType.PERCENT_CLOSE)
|
|
166
|
-
else:
|
|
156
|
+
if not self.in_percent:
|
|
167
157
|
self.emit(TokenType.PERCENT_OPEN)
|
|
158
|
+
self.in_percent = True
|
|
159
|
+
else:
|
|
160
|
+
self.emit(TokenType.PERCENT_CLOSE)
|
|
161
|
+
self.in_percent = False
|
|
168
162
|
self.advance()
|
|
169
163
|
continue
|
|
170
164
|
|
|
171
|
-
# ------------------------------------
|
|
172
165
|
# COLONS :value:
|
|
173
|
-
# ------------------------------------
|
|
174
166
|
if self.match(":"):
|
|
175
167
|
flush_text()
|
|
176
|
-
if
|
|
177
|
-
self.emit(TokenType.COLON_CLOSE)
|
|
178
|
-
else:
|
|
168
|
+
if not self.in_colon:
|
|
179
169
|
self.emit(TokenType.COLON_OPEN)
|
|
170
|
+
self.in_colon = True
|
|
171
|
+
else:
|
|
172
|
+
self.emit(TokenType.COLON_CLOSE)
|
|
173
|
+
self.in_colon = False
|
|
180
174
|
self.advance()
|
|
181
175
|
continue
|
|
182
176
|
|
|
183
|
-
# ------------------------------------
|
|
184
177
|
# PARENTHESES
|
|
185
|
-
# ------------------------------------
|
|
186
178
|
if ch == "(":
|
|
187
179
|
flush_text()
|
|
188
180
|
self.emit(TokenType.LPAREN)
|
|
@@ -195,9 +187,7 @@ class Tokenizer:
|
|
|
195
187
|
self.advance()
|
|
196
188
|
continue
|
|
197
189
|
|
|
198
|
-
# ------------------------------------
|
|
199
190
|
# IDENTIFIERS (with dots)
|
|
200
|
-
# ------------------------------------
|
|
201
191
|
if ch.isalpha():
|
|
202
192
|
flush_text()
|
|
203
193
|
start = self.i
|
|
@@ -207,9 +197,7 @@ class Tokenizer:
|
|
|
207
197
|
self.emit(TokenType.IDENT, ident)
|
|
208
198
|
continue
|
|
209
199
|
|
|
210
|
-
# ------------------------------------
|
|
211
200
|
# DEFAULT: TEXT
|
|
212
|
-
# ------------------------------------
|
|
213
201
|
buf.append(ch)
|
|
214
202
|
self.advance()
|
|
215
203
|
|
|
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
|