mapres 3.dev9__tar.gz → 3.dev10__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.dev9/src/mapres.egg-info → mapres-3.dev10}/PKG-INFO +1 -1
- {mapres-3.dev9 → mapres-3.dev10}/pyproject.toml +1 -1
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres/evaluator.py +6 -18
- {mapres-3.dev9 → mapres-3.dev10/src/mapres.egg-info}/PKG-INFO +1 -1
- {mapres-3.dev9 → mapres-3.dev10}/LICENSE +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/README.md +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/setup.cfg +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres/__init__.py +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres/ast.py +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres/cache.py +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres/datamap.py +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres/exceptions.py +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres/layers.py +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres/maps/__init__.py +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres/maps/color.py +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres/maps/time.py +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres/parser.py +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres/resolver.py +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres/tokenizer.py +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres.egg-info/SOURCES.txt +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres.egg-info/dependency_links.txt +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres.egg-info/requires.txt +0 -0
- {mapres-3.dev9 → mapres-3.dev10}/src/mapres.egg-info/top_level.txt +0 -0
|
@@ -11,15 +11,11 @@ class Evaluator:
|
|
|
11
11
|
self.ctx = ctx or {}
|
|
12
12
|
self._seen = set() # cycle detection
|
|
13
13
|
|
|
14
|
-
#
|
|
15
|
-
# PUBLIC API
|
|
16
|
-
# -----------------------------
|
|
14
|
+
# public api
|
|
17
15
|
def evaluate(self, node):
|
|
18
16
|
return self._eval(node)
|
|
19
17
|
|
|
20
|
-
#
|
|
21
|
-
# INTERNAL DISPATCH
|
|
22
|
-
# -----------------------------
|
|
18
|
+
# internal dispatch
|
|
23
19
|
def _eval(self, node):
|
|
24
20
|
if isinstance(node, TemplateNode):
|
|
25
21
|
return self._eval_template(node)
|
|
@@ -35,18 +31,14 @@ class Evaluator:
|
|
|
35
31
|
|
|
36
32
|
raise EvaluationError(f"Unknown AST node: {node}")
|
|
37
33
|
|
|
38
|
-
#
|
|
39
|
-
# TEMPLATE
|
|
40
|
-
# -----------------------------
|
|
34
|
+
# template
|
|
41
35
|
def _eval_template(self, node: TemplateNode):
|
|
42
36
|
parts = []
|
|
43
37
|
for child in node.children:
|
|
44
38
|
parts.append(self._eval(child))
|
|
45
39
|
return "".join(parts)
|
|
46
40
|
|
|
47
|
-
#
|
|
48
|
-
# IDENTIFIER
|
|
49
|
-
# -----------------------------
|
|
41
|
+
# identifier
|
|
50
42
|
def _eval_ident(self, node: IdentNode):
|
|
51
43
|
name = node.name
|
|
52
44
|
|
|
@@ -77,9 +69,7 @@ class Evaluator:
|
|
|
77
69
|
self._seen.remove(name)
|
|
78
70
|
raise EvaluationError(f"Missing key '{name}'")
|
|
79
71
|
|
|
80
|
-
#
|
|
81
|
-
# CALL (nested token)
|
|
82
|
-
# -----------------------------
|
|
72
|
+
# call (nested token)
|
|
83
73
|
def _eval_call(self, node: CallNode):
|
|
84
74
|
outer = node.name
|
|
85
75
|
|
|
@@ -110,9 +100,7 @@ class Evaluator:
|
|
|
110
100
|
self._seen.remove(outer)
|
|
111
101
|
raise EvaluationError(f"Missing nested key '{outer}({arg_value})'")
|
|
112
102
|
|
|
113
|
-
#
|
|
114
|
-
# HELPERS
|
|
115
|
-
# -----------------------------
|
|
103
|
+
# helpers
|
|
116
104
|
def _map_to_dict(self, m):
|
|
117
105
|
if hasattr(m, "as_map"):
|
|
118
106
|
return m.as_map()
|
|
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
|
|
File without changes
|
|
File without changes
|