Skip to content

Commit a7b325e

Browse files
committed
(fix): debugger now also supports dictionary expressions
given this example: ```robot *** Variables *** &{DICTIONARY_EXAMPLE1} output_dir=${OUTPUT DIR} ... AA=${DUT_IP_ADDRESS_1} ... ZZ=${{{1:2, 3:4}}} ``` now you can also evaluate expressions like ``` ${DICTIONARY_EXAMPLE1}[output_dir] ``` in the debugger.
1 parent da8692c commit a7b325e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

robotcode/debugger/debugger.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ def get_variables(
11841184

11851185
return list(result.values())
11861186

1187-
IS_VARIABLE_RE = re.compile(r"^[$@&%]\{.*\}$")
1187+
IS_VARIABLE_RE = re.compile(r"^[$@&%]\{.*\}(\[[^\]]*\])?$")
11881188
IS_VARIABLE_ASSIGNMENT_RE = re.compile(r"^[$@&%]\{.*\}=?$")
11891189
SPLIT_LINE = re.compile(r"(?= {2,}| ?\t)\s*")
11901190
CURRDIR = re.compile(r"(?i)\$\{CURDIR\}")
@@ -1200,7 +1200,7 @@ def evaluate(
12001200
from robot.running.context import EXECUTION_CONTEXTS
12011201
from robot.running.model import Keyword
12021202
from robot.variables.evaluation import evaluate_expression
1203-
from robot.variables.finders import VariableFinder
1203+
from robot.variables.replacer import VariableReplacer
12041204

12051205
if not expression:
12061206
return EvaluateResult(result="")
@@ -1271,7 +1271,7 @@ def run_kw() -> Any:
12711271

12721272
elif self.IS_VARIABLE_RE.match(expression.strip()):
12731273
try:
1274-
result = VariableFinder(vars.store).find(expression)
1274+
result = VariableReplacer(vars.store).replace_scalar(expression)
12751275
except VariableError:
12761276
if context is not None and (
12771277
isinstance(context, EvaluateArgumentContext)

0 commit comments

Comments
 (0)