mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
core: fix fmt without arguments
This commit is contained in:
parent
ae22172338
commit
3b0b032bdc
@ -4,7 +4,12 @@
|
||||
(let [idx (String.index-of s \%)
|
||||
len (String.length s)]
|
||||
(if (= idx -1)
|
||||
(list 'copy s) ; no more splits found, just return string
|
||||
(if (= (length args) 0)
|
||||
s ; no more splits found, just return string
|
||||
(macro-error
|
||||
(str "error in format string: too many arguments to format string (missing directive for '"
|
||||
(car args)
|
||||
"')")))
|
||||
(if (= len 1)
|
||||
(macro-error "error in format string: expected expression after last %")
|
||||
(if (= \% (String.char-at s (inc idx))) ; this is an escaped %
|
||||
|
Loading…
Reference in New Issue
Block a user