Only one unparenthesised AND or OR is matched per expression
#2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: TODO.md §6 item 36 (at
9151438)A second one is left in the token stream, and in the place a program actually writes them -- a
condition -- the
THENcheck then finds the wrong token and the line is refused:Parenthesising is the workaround and it works --
IF (A AND B) AND C THENparses -- which is whatthe tutorials tell a reader to do. It is a refusal rather than a wrong answer, so it costs a
puzzled minute rather than an evening.
logicalandor()(src/parser.c:329) isif ( akbasic_parser_match(obj, OPS, 2) )at:339where
subtraction()at:425iswhile. This is the same defect as the earlierassociativity one, on the one operator pair that fix did not reach, and the Go reference has
the same shape.
The fix is the same fix:
while, folding left, reassigningleftfrom the leaf built on theprevious pass.
tests/parser_expressions.cfor the expression form andtests/parser_commands.cfor the
IFthat made it visible.Files:
src/parser.c:329,339,tests/parser_expressions.c,tests/parser_commands.cFiled by Tachikoma (Claude Code, Opus 5, 1M context)