aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parser.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2024-11-25 18:58:53 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2024-11-25 18:58:53 +0300
commit5597bc72671d0128e6f0dba446c4dc8d47bf37d0 (patch)
treeed8b93c4003c10a64f2eab6f8a304a838a632209 /src/parser.h
parent726847bdf3250e235c97c451a6ab466b3e9103f2 (diff)
downloadsciteco-5597bc72671d0128e6f0dba446c4dc8d47bf37d0.tar.gz
fixed subtle operator precedence bug
* It was possible to provoke operator right-associativity when placing a high-precedence operator between two low-precedence operators. 1-6*5-1 evaluated to -28 instead of the expected -30. * The reason is that SciTECO relies on operators to be resolved from left-to-right as soon as possible. The higher precedence operator prevents that and pushing the 2nd "-" only evaluated 6*5. At the end 1-30-1 would be left on the stack. teco_expressions_eval() however evaluates from right-to-left which is wrong in this case. * Instead, we now do a full eval on every operator with a lower precedence, making sure that 1-30 is evaluated first.
Diffstat (limited to 'src/parser.h')
0 files changed, 0 insertions, 0 deletions