aboutsummaryrefslogtreecommitdiffstats
path: root/calc-example
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-01-05 13:50:38 +0100
committerMattias Andrée <m@maandree.se>2026-02-23 07:52:18 +0100
commit7dd4970daafdc1992e1dba486a1477a17cb4c53e (patch)
treee56e544ec55e68872397738e0e5064b000d31eba /calc-example
parentOptimise detection of rejection (diff)
downloadlibparser-7dd4970daafdc1992e1dba486a1477a17cb4c53e.tar.gz
libparser-7dd4970daafdc1992e1dba486a1477a17cb4c53e.tar.bz2
libparser-7dd4970daafdc1992e1dba486a1477a17cb4c53e.tar.xz
Add committed-operator
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--calc-example/calc.syntax8
1 files changed, 4 insertions, 4 deletions
diff --git a/calc-example/calc.syntax b/calc-example/calc.syntax
index fb5a871..d76b68b 100644
--- a/calc-example/calc.syntax
+++ b/calc-example/calc.syntax
@@ -15,16 +15,16 @@ DIV = _, ("/" | "∕" | "÷"), _;
sign = ADD | SUB;
_digit = DIGIT | _WHITESPACE | "_" | "'";
-unsigned = DIGIT, {_digit}, !_digit;
+unsigned = DIGIT, +({_digit}, !_digit);
_number = unsigned | "(", _expr, (")" | -);
-number = _number, {_, _number}; (* optionally with implicit multiplication *)
+number = _number, +{_, _number}; (* optionally with implicit multiplication *)
value = [sign], number;
_expr = hyper1;
-hyper1 = _, hyper2, {(ADD | SUB), (hyper2 | -)}, _;
-hyper2 = _, value, {(MUL | DIV), (value | -)}, _;
+hyper1 = _, hyper2, {+(ADD | SUB), +(hyper2 | -)}, _;
+hyper2 = _, value, {+(MUL | DIV), +(value | -)}, _;