solpl 2.4.1__tar.gz → 2.5.0__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.
- {solpl-2.4.1/solpl.egg-info → solpl-2.5.0}/PKG-INFO +1 -1
- {solpl-2.4.1 → solpl-2.5.0}/interpreter/sol.py +5 -8
- {solpl-2.4.1 → solpl-2.5.0}/pyproject.toml +2 -2
- {solpl-2.4.1 → solpl-2.5.0/solpl.egg-info}/PKG-INFO +1 -1
- solpl-2.5.0/solpl.egg-info/entry_points.txt +2 -0
- solpl-2.4.1/solpl.egg-info/entry_points.txt +0 -2
- {solpl-2.4.1 → solpl-2.5.0}/LICENSE +0 -0
- {solpl-2.4.1 → solpl-2.5.0}/README.md +0 -0
- {solpl-2.4.1 → solpl-2.5.0}/setup.cfg +0 -0
- {solpl-2.4.1 → solpl-2.5.0}/solpl.egg-info/SOURCES.txt +0 -0
- {solpl-2.4.1 → solpl-2.5.0}/solpl.egg-info/dependency_links.txt +0 -0
- {solpl-2.4.1 → solpl-2.5.0}/solpl.egg-info/top_level.txt +0 -0
|
@@ -32,8 +32,7 @@ class SolInterpreter:
|
|
|
32
32
|
|
|
33
33
|
with open(filename, "r") as f:
|
|
34
34
|
code = f.read()
|
|
35
|
-
|
|
36
|
-
module_name = base_name.replace(".sol", "")
|
|
35
|
+
module_name = os.path.splitext(os.path.basename(filename))[0]
|
|
37
36
|
lines = [l.strip() for l in code.split('\n') if l.strip()]
|
|
38
37
|
for pc, line in enumerate(lines):
|
|
39
38
|
if "(" in line and ")" in line and "main" not in line and "end" not in line and "->" not in line and ">>" not in line and "?" not in line and not line.startswith(("if ", "while ", "for ", "elseif", "else")):
|
|
@@ -46,7 +45,7 @@ class SolInterpreter:
|
|
|
46
45
|
def _compute(self, expr):
|
|
47
46
|
is_literal = (expr.startswith('"') and expr.endswith('"')) or (expr.startswith("'") and expr.endswith("'"))
|
|
48
47
|
expr = str(expr).strip()
|
|
49
|
-
if "+" in expr and not
|
|
48
|
+
if "+" in expr and not is_literal and any(c.isalpha() or c in ['"', "'"] for c in expr):
|
|
50
49
|
parts = expr.split("+")
|
|
51
50
|
result = ""
|
|
52
51
|
for p in parts:
|
|
@@ -106,8 +105,8 @@ class SolInterpreter:
|
|
|
106
105
|
existing_val = self._lookup(val)
|
|
107
106
|
if existing_val is not None: return existing_val
|
|
108
107
|
try: return float(val) if '.' in val else int(val)
|
|
109
|
-
except:
|
|
110
|
-
print(f"Error: Failed to
|
|
108
|
+
except:
|
|
109
|
+
print(f"Error: Failed to parse: {val}")
|
|
111
110
|
return None
|
|
112
111
|
|
|
113
112
|
def _async_worker(self, expr, action):
|
|
@@ -181,7 +180,7 @@ class SolInterpreter:
|
|
|
181
180
|
pc = 0
|
|
182
181
|
while pc < len(self.lines):
|
|
183
182
|
line = self.lines[pc]
|
|
184
|
-
if "(" in line and ")" in line and "main" not in line and "end" not in line and "->" not in line and ">>" not in line and "?"
|
|
183
|
+
if "(" in line and ")" in line and "main" not in line and "end" not in line and "->" not in line and ">>" not in line and "?" in line and not line.startswith(("if ", "while ", "for ", "elseif", "else")):
|
|
185
184
|
parts = line.split("(")
|
|
186
185
|
self.functions[parts[0].strip()] = {"start_pc": pc + 1, "params": [p.strip() for p in parts[1].replace(")", "").split(",")] if parts[1].replace(")", "").strip() else []}
|
|
187
186
|
elif "{" in line: pc = self._parse_struct(pc)
|
|
@@ -347,5 +346,3 @@ def main():
|
|
|
347
346
|
|
|
348
347
|
if __name__ == "__main__":
|
|
349
348
|
main()
|
|
350
|
-
|
|
351
|
-
# do you really think I would go back and comment the code? i wrote the first version in a month.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "solpl"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.5.0"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name = "stefand-0", email = "stefand-0@users.noreply.github.com" }
|
|
10
10
|
]
|
|
@@ -18,7 +18,7 @@ classifiers = [
|
|
|
18
18
|
]
|
|
19
19
|
|
|
20
20
|
[project.scripts]
|
|
21
|
-
|
|
21
|
+
solpl = "interpreter.sol:main"
|
|
22
22
|
|
|
23
23
|
[tool.setuptools.packages]
|
|
24
24
|
find = { include = ["interpreter"] }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|