aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2024-02-07 21:23:48 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2024-02-08 04:45:54 +0300
commit83398b3fb5674441ebe73d0f6e1226cb3c700aa9 (patch)
treed54f10031d287dc2a2d3b710eef1c2299235b69b
parent21c5be3706f70d573f8d0195760846fce46f6807 (diff)
downloadsciteco-83398b3fb5674441ebe73d0f6e1226cb3c700aa9.tar.gz
fixed expressions like `1,(2)` or `(1),(2)`: they are reported as two numbers now
* Instead of TECO_OP_NEW, there should perhaps simply be a flag of whether `,` was used.
-rw-r--r--src/expressions.c3
-rw-r--r--tests/testsuite.at1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/expressions.c b/src/expressions.c
index cec3492..c7151f8 100644
--- a/src/expressions.c
+++ b/src/expressions.c
@@ -318,6 +318,9 @@ guint teco_brace_level = 0;
void
teco_expressions_brace_open(void)
{
+ while (teco_operators->len > 0 && teco_expressions_peek_op(0) == TECO_OP_NEW)
+ teco_expressions_pop_op(0);
+
teco_expressions_push_op(TECO_OP_BRACE);
teco_undo_guint(teco_brace_level)++;
}
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 3a8bed8..3965730 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -25,6 +25,7 @@ AT_CHECK([$SCITECO -e "2%a,%a - 3\"N(0/0)'"], 0, ignore, ignore)
# c) The empty "list" element is equivalent to 0, so
# "1,,2" is equivalent to "1,0,2" and (1,) to (1,0).
AT_CHECK([$SCITECO -e "(1,) \"~|(0/0)'"], 0, ignore, ignore)
+AT_CHECK([$SCITECO -e "1,(2)=="], 0, ignore, ignore)
AT_CLEANUP
AT_SETUP([Exponentiation])