Skip to content

Commit 18ede60

Browse files
committed
[Draw][Breakpoint] Early check the breakpoint expression and does not allow setting invalid expressions to user by warning.
1 parent bf16036 commit 18ede60

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

vpr/src/draw/draw_debug.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,17 @@ bool valid_expression(std::string exp) {
766766
return false;
767767
}
768768

769+
//use the formula parser for checking the validity of the formula.
770+
//we ignore the actual result here, since we only care about whether parsing succeeds without a VtrError.
771+
vtr::FormulaParser fp;
772+
vtr::t_formula_data dummy;
773+
try {
774+
int result = fp.parse_formula(exp, dummy, true);
775+
(void)result;
776+
} catch (const vtr::VtrError& e) {
777+
return false;
778+
}
779+
769780
return true;
770781
}
771782

0 commit comments

Comments
 (0)