Make the multisym splitter tiebreak the right way

This commit is contained in:
XeroOl 2024-03-01 21:36:00 -06:00
parent cb8dc29bed
commit 1eb4a770dd
4 changed files with 5 additions and 8 deletions

View File

@ -161,7 +161,7 @@ a user-written file.
;; for example, if I'm searching for "foo.bar.baz", my immediate priority is to find foo,
;; and the stack has ["baz" "bar"]. "bar" is at the "top"/"end" of the stack as the next key to search.
(if (sym? symbol)
(let [split (utils.multi-sym-split symbol (if ?byte (+ 1 (- ?byte symbol.bytestart))))
(let [split (utils.multi-sym-split symbol (if ?byte (- ?byte symbol.bytestart)))
stack (stack-add-split! [] split)]
(case (docs.get-global-metadata (. split 1))

View File

@ -178,9 +178,8 @@
(check "(local a {:b {:c =={:d #\"hi\"}==}})
(a.b.|c.d)")
;; TODO fix the multisym splitter
; (check "(local a {:b {:c =={:d #\"hi\"}==}})
; (a.b.c|.d)"))
(check "(local a {:b {:c =={:d #\"hi\"}==}})
(a.b.c|.d)")

View File

@ -91,8 +91,7 @@ new message handler `msgh`.")
(fn test-multisym []
(check "(local x {:foo 10}) x.foo|" "```fnl\n10\n```")
(check "(local x {:foo 10}) x.|foo" "```fnl\n10\n```")
;; TODO make it pick the other side of the multisym
;; (check "(local x {:foo 10}) x|.foo" "```fnl\n{:foo 10}\n```")
(check "(local x {:foo 10}) x|.foo" "```fnl\n{:foo 10}\n```")
(check "(local x {:foo 10}) |x.foo" "```fnl\n{:foo 10}\n```")
(check "(local x {:foo \"hello\"}) x.foo|" "```fnl\n:hello\n```")

View File

@ -35,8 +35,7 @@
(check "(fn x| []) ==x==")
(check "(fn x [])| x")
(check "(let [x nil] ==|x.y== ==x.z==)")
;; TODO decide this the other way
;; (check "(let [x nil] ==x|.y== ==x.z==)")
(check "(let [x nil] ==x|.y== ==x.z==)")
(check "(let [x nil] x.|y x.z)")
(check "(let [x nil] x.y| x.z)")
(check "(let [x| 10]