Fix string/indexof-char

Changes `string/indexof-char` to return :ignore-instruction if the character is not present in the string. This makes it consistent with it's description
This commit is contained in:
Erik Rauer 2021-03-21 01:02:11 -05:00
parent 92cdfe9e59
commit 9cd4f875c2

View File

@ -106,7 +106,11 @@
:string_indexof_char
^{:stacks #{:char :integer :string}}
(fn [state]
(make-instruction state string/index-of [:string :char] :integer)))
(make-instruction state
#(let [index (string/index-of %1 %2)]
(if index index :ignore-instruction))
[:string :char]
:integer)))
;; Iterates over the top STRING using code on the EXEC stack
(def-instruction