Fix another regression
This commit is contained in:
@ -868,6 +868,7 @@ fn possible_operands(i: TokenSlice) -> PResult<Value> {
|
|||||||
fn_call.map(Box::new).map(Value::CallExpression),
|
fn_call.map(Box::new).map(Value::CallExpression),
|
||||||
identifier.map(Box::new).map(Value::Identifier),
|
identifier.map(Box::new).map(Value::Identifier),
|
||||||
binary_expr_in_parens.map(Box::new).map(Value::BinaryExpression),
|
binary_expr_in_parens.map(Box::new).map(Value::BinaryExpression),
|
||||||
|
unnecessarily_bracketed,
|
||||||
))
|
))
|
||||||
.context(expected(
|
.context(expected(
|
||||||
"a KCL value which can be used as an argument/operand to an operator",
|
"a KCL value which can be used as an argument/operand to an operator",
|
||||||
@ -1561,6 +1562,21 @@ const mySk1 = startSketchAt([0, 0])"#;
|
|||||||
assert_eq!(actual.operator, BinaryOperator::Sub);
|
assert_eq!(actual.operator, BinaryOperator::Sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_arg() {
|
||||||
|
for input in [
|
||||||
|
"( sigmaAllow * width )",
|
||||||
|
"6 / ( sigmaAllow * width )",
|
||||||
|
"sqrt(distance * p * FOS * 6 / ( sigmaAllow * width ))",
|
||||||
|
] {
|
||||||
|
let tokens = crate::token::lexer(input);
|
||||||
|
let _actual = match value.parse(&tokens) {
|
||||||
|
Ok(x) => x,
|
||||||
|
Err(e) => panic!("{e:?}"),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_arithmetic() {
|
fn test_arithmetic() {
|
||||||
let input = "1 * (2 - 3)";
|
let input = "1 * (2 - 3)";
|
||||||
|
|||||||
Reference in New Issue
Block a user