solpl 2.5.7__tar.gz → 2.6.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: solpl
3
- Version: 2.5.7
3
+ Version: 2.6.0
4
4
  Summary: A lightweight, multi-threaded interpreter for the Sol programming language
5
5
  Author-email: stefand-0 <stefand-0@users.noreply.github.com>
6
6
  License-Expression: Apache-2.0
@@ -33,8 +33,7 @@ class SolInterpreter:
33
33
  with open(filename, "r") as f:
34
34
  code = f.read()
35
35
  module_name = os.path.splitext(os.path.basename(filename))[0]
36
-
37
- # FIX: Properly strip comments from imported library files
36
+
38
37
  lines = []
39
38
  for l in code.split('\n'):
40
39
  l = l.strip()
@@ -55,7 +54,6 @@ class SolInterpreter:
55
54
  def _compute(self, expr):
56
55
  expr = str(expr).strip()
57
56
 
58
- # FIX: Critical helper to split expressions ONLY outside of literal quotes
59
57
  def split_outside_quotes(string, op):
60
58
  parts = []
61
59
  current = []
@@ -78,7 +76,6 @@ class SolInterpreter:
78
76
  parts.append("".join(current))
79
77
  return parts
80
78
 
81
- # FIX: Use quote-aware splitting for string concatenation
82
79
  plus_parts = split_outside_quotes(expr, '+')
83
80
  if len(plus_parts) > 1:
84
81
  if any(any(c.isalpha() or c in ['"', "'"] for c in p) for p in plus_parts):
@@ -88,7 +85,6 @@ class SolInterpreter:
88
85
  result += str(val) if val is not None else ""
89
86
  return result
90
87
 
91
- # FIX: Use quote-aware splitting for mathematical operations (ignores colons in URLs)
92
88
  ops = ['+', '-', '*', ':']
93
89
  for op in ops:
94
90
  op_parts = split_outside_quotes(expr, op)
@@ -141,15 +137,15 @@ class SolInterpreter:
141
137
  obj_name, prop = val.split(".", 1)
142
138
  obj = self._lookup(obj_name)
143
139
  if isinstance(obj, dict): return obj.get(prop, 0)
144
-
145
- # FIX: Avoid failing on variables explicitly assigned to a None value
140
+
146
141
  for scope in reversed(self.scope_stack):
147
142
  if val in scope: return scope[val]
148
-
149
- try: return float(val) if '.' in val else int(val)
150
- except:
151
- print(f"Error: Failed to parse: {val}")
152
- return None
143
+
144
+ # FIX: Only try to parse as number if it looks like one
145
+ if val.replace('.', '', 1).isdigit() or (val.startswith('-') and val[1:].replace('.', '', 1).isdigit()):
146
+ return float(val) if '.' in val else int(val)
147
+
148
+ return None
153
149
 
154
150
  def _async_worker(self, expr, action):
155
151
  result = self._compute(expr)
@@ -224,8 +220,7 @@ class SolInterpreter:
224
220
  line = self.lines[pc]
225
221
  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")):
226
222
  parts = line.split("(")
227
- 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 []
228
- continue
223
+ 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 []}
229
224
  elif "{" in line: pc = self._parse_struct(pc)
230
225
  pc += 1
231
226
  for i, line in enumerate(self.lines):
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "solpl"
7
- version = "2.5.7"
7
+ version = "2.6.0"
8
8
  authors = [
9
9
  { name = "stefand-0", email = "stefand-0@users.noreply.github.com" }
10
10
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: solpl
3
- Version: 2.5.7
3
+ Version: 2.6.0
4
4
  Summary: A lightweight, multi-threaded interpreter for the Sol programming language
5
5
  Author-email: stefand-0 <stefand-0@users.noreply.github.com>
6
6
  License-Expression: Apache-2.0
File without changes
File without changes
File without changes
File without changes