prthm11 commited on
Commit
6b400cf
·
verified ·
1 Parent(s): 78b17a8

Update utils/block_relation_builder.py

Browse files
Files changed (1) hide show
  1. utils/block_relation_builder.py +2 -2
utils/block_relation_builder.py CHANGED
@@ -1874,7 +1874,7 @@ def classify(line):
1874
  if l.startswith("repeat until <"): return "control_repeat_until", "c_block"
1875
  # Updated regex for stop block to handle different options
1876
  #if re.match(r"stop \[(all|this script|other scripts in sprite)\s*v\]", l): return "control_stop", "cap"
1877
- if re.match(r"stop\s*(?:[\[(]?\s*(all|this script|other scripts in sprite)\s*[\])]?$)", l, re.IGNORECASE): return "control_stop", "cap"
1878
  if l.startswith("create clone of"): return "control_create_clone_of", "stack"
1879
  if l == "delete this clone": return "control_delete_this_clone", "cap"
1880
 
@@ -2351,7 +2351,7 @@ def generate_plan(generated_input, opcode_keys, pseudo_code):
2351
  if m: info["fields"]["LIST"] = [m.group(1), None]
2352
  if "STOP_OPTION" in info["fields"]:
2353
  m = re.search(r"stop \[([^\]]+)\s*v\]", stmt_for_parse)
2354
- if m: info["fields"]["STOP_OPTION"] = [m.group(1), None]
2355
  if "STYLE" in info["fields"]:
2356
  m = re.search(r"set rotation style \[([^\]]+)\s*v\]", stmt_for_parse)
2357
  if m: info["fields"]["STYLE"] = [m.group(1), None]
 
1874
  if l.startswith("repeat until <"): return "control_repeat_until", "c_block"
1875
  # Updated regex for stop block to handle different options
1876
  #if re.match(r"stop \[(all|this script|other scripts in sprite)\s*v\]", l): return "control_stop", "cap"
1877
+ if re.match(r"stop\s*[\[(]?\s*(all|this script|other scripts in sprite)\s*(?:v)?\s*[\])]?$", l, re.IGNORECASE): return "control_stop", "cap"
1878
  if l.startswith("create clone of"): return "control_create_clone_of", "stack"
1879
  if l == "delete this clone": return "control_delete_this_clone", "cap"
1880
 
 
2351
  if m: info["fields"]["LIST"] = [m.group(1), None]
2352
  if "STOP_OPTION" in info["fields"]:
2353
  m = re.search(r"stop \[([^\]]+)\s*v\]", stmt_for_parse)
2354
+ if m: info["fields"]["STOP_OPTION"] = [m.group(1).strip(), None]
2355
  if "STYLE" in info["fields"]:
2356
  m = re.search(r"set rotation style \[([^\]]+)\s*v\]", stmt_for_parse)
2357
  if m: info["fields"]["STYLE"] = [m.group(1), None]