[expr parser] rearrange expression errors to point right at the original metadesk nodes as much as possible

This commit is contained in:
Allen Webster
2021-10-01 22:08:40 -07:00
parent 8cbd0cc2dc
commit 04e65af953
4 changed files with 120 additions and 96 deletions
+3 -1
View File
@@ -302,6 +302,8 @@ operator_array[Op_##name].op = (MD_ExprOpr){ .op_id = Op_##name, .kind = MD_Expr
// adding some extra parens, we can then compare it to the expected parenthisation of the
// original input string. We get most of the topological comparison with a simpler test interface.
Expression_QA tests[] = {
{ .q = "a+", .a = "", ExpressionErrorKind_Expr, 2},
{ .q = "a + b + c", .a = "(a + b) + c" },
{ .q = "a + (b + c)", .a = "a + (b + c)" },
{ .q = "a + b + c + d", .a = "((a + b) + c) + d" },
@@ -351,7 +353,7 @@ operator_array[Op_##name].op = (MD_ExprOpr){ .op_id = Op_##name, .kind = MD_Expr
{ .q = "a)", .a = "", ExpressionErrorKind_MD, 1},
{ .q = "/a", .a = "", ExpressionErrorKind_Expr, 0},
{ .q = "+ /a", .a = "", ExpressionErrorKind_Expr, 2},
{ .q = "a+", .a = "", ExpressionErrorKind_Expr, 2},
//{ .q = "a+", .a = "", ExpressionErrorKind_Expr, 2},
{ .q = "a 1", .a = "", ExpressionErrorKind_Expr, 2},
};