solpl 2.3.5__tar.gz → 2.3.7__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.3.5
3
+ Version: 2.3.7
4
4
  Summary: Sol Programming Language Interpreter
5
5
  Requires-Python: >=3.7
6
6
  License-File: LICENSE
@@ -32,7 +32,8 @@ class SolInterpreter:
32
32
 
33
33
  with open(filename, "r") as f:
34
34
  code = f.read()
35
- module_name = filename.replace(".sol", "")
35
+ base_name = os.path.basename(filename)
36
+ module_name = base_name.replace(".sol", "")
36
37
  lines = [l.strip() for l in code.split('\n') if l.strip()]
37
38
  for pc, line in enumerate(lines):
38
39
  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")):
@@ -44,7 +45,8 @@ class SolInterpreter:
44
45
 
45
46
  def _compute(self, expr):
46
47
  expr = str(expr).strip()
47
- if "+" in expr and any(c.isalpha() or c in ['"', "'"] for c in expr):
48
+ is_literal = (expr.startswith('"') and expr.endswith('"')) or (expr.startswith("'") and expr.endswith("'"))
49
+ if "+" in expr and not is_literal and any(c.isalpha() or c in ['"', "'"] for c in expr):
48
50
  parts = expr.split("+")
49
51
  result = ""
50
52
  for p in parts:
@@ -147,7 +149,9 @@ class SolInterpreter:
147
149
  def get_val(expr):
148
150
  val = self._compute(expr.strip())
149
151
  return val if val is not None else 0
150
-
152
+ if "==" in cond:
153
+ left, right = cond.split("==", 1)
154
+ return get_val(left) == get_val(right)
151
155
  if "=" in cond:
152
156
  left, right = cond.split("=")
153
157
  return get_val(left) == get_val(right)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "solpl"
7
- version = "2.3.5"
7
+ version = "2.3.7"
8
8
  description = "Sol Programming Language Interpreter"
9
9
  requires-python = ">=3.7"
10
10
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: solpl
3
- Version: 2.3.5
3
+ Version: 2.3.7
4
4
  Summary: Sol Programming Language Interpreter
5
5
  Requires-Python: >=3.7
6
6
  License-File: LICENSE
File without changes
File without changes
File without changes
File without changes