HS: coll-feats error on unconsumed tokens (+1 test)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 38s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 38s
When parse-feat returns nil but the token stream is not at EOF,
coll-feats now throws a parse error ('Unexpected token X') instead
of silently returning the partial result. Fixes 'extra chars cause
error when evaling': eval-hs("1!") now correctly throws because '!'
is left over after parsing the number expression.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3133,7 +3133,19 @@
|
|||||||
acc
|
acc
|
||||||
(let
|
(let
|
||||||
((feat (parse-feat)))
|
((feat (parse-feat)))
|
||||||
(if (nil? feat) acc (coll-feats (append acc (list feat))))))))
|
(if
|
||||||
|
(nil? feat)
|
||||||
|
(if
|
||||||
|
(at-end?)
|
||||||
|
acc
|
||||||
|
(error
|
||||||
|
(str
|
||||||
|
"Parse error: Unexpected token '"
|
||||||
|
(tp-val)
|
||||||
|
"' (line "
|
||||||
|
(get (nth tokens p) "line")
|
||||||
|
")")))
|
||||||
|
(coll-feats (append acc (list feat))))))))
|
||||||
(let
|
(let
|
||||||
((features (coll-feats (list))))
|
((features (coll-feats (list))))
|
||||||
(if
|
(if
|
||||||
|
|||||||
@@ -3133,7 +3133,19 @@
|
|||||||
acc
|
acc
|
||||||
(let
|
(let
|
||||||
((feat (parse-feat)))
|
((feat (parse-feat)))
|
||||||
(if (nil? feat) acc (coll-feats (append acc (list feat))))))))
|
(if
|
||||||
|
(nil? feat)
|
||||||
|
(if
|
||||||
|
(at-end?)
|
||||||
|
acc
|
||||||
|
(error
|
||||||
|
(str
|
||||||
|
"Parse error: Unexpected token '"
|
||||||
|
(tp-val)
|
||||||
|
"' (line "
|
||||||
|
(get (nth tokens p) "line")
|
||||||
|
")")))
|
||||||
|
(coll-feats (append acc (list feat))))))))
|
||||||
(let
|
(let
|
||||||
((features (coll-feats (list))))
|
((features (coll-feats (list))))
|
||||||
(if
|
(if
|
||||||
|
|||||||
Reference in New Issue
Block a user