Skip to content

Commit 6b90851

Browse files
committed
fix(debugger): ensure proper evaluation of variable expressions
fixes #405
1 parent c3c32bf commit 6b90851

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/debugger/src/robotcode/debugger/debugger.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,8 +1637,8 @@ def get_variables(
16371637

16381638
return list(result.values())
16391639

1640-
IS_VARIABLE_RE: ClassVar = re.compile(r"^[$@&%]\{.*\}(\[[^\]]*\])?$")
1641-
IS_VARIABLE_ASSIGNMENT_RE: ClassVar = re.compile(r"^[$@&%]\{.*\}=?$")
1640+
IS_VARIABLE_RE: ClassVar = re.compile(r"^[$@&]\{.*\}(\[[^\]]*\])?$")
1641+
IS_VARIABLE_ASSIGNMENT_RE: ClassVar = re.compile(r"^[$@&]\{.*\}=?$")
16421642
SPLIT_LINE: ClassVar = re.compile(r"(?= {2,}| ?\t)\s*")
16431643
CURRDIR: ClassVar = re.compile(r"(?i)\$\{CURDIR\}")
16441644

@@ -1762,8 +1762,10 @@ def run_kw() -> Any:
17621762
else:
17631763
result = internal_evaluate_expression(vars.replace_string(expression), vars)
17641764
else:
1765-
if self.IS_VARIABLE_RE.match(expression.strip()):
1766-
result = vars[expression.strip()]
1765+
parts = self.SPLIT_LINE.split(expression.strip())
1766+
if parts and len(parts) == 1 and self.IS_VARIABLE_RE.match(parts[0].strip()):
1767+
# result = vars[parts[0].strip()]
1768+
result = vars.replace_scalar(parts[0].strip())
17671769
else:
17681770

17691771
def get_test_body_from_string(command: str) -> TestCase:

0 commit comments

Comments
 (0)