diff --git a/src/boot/boot.janet b/src/boot/boot.janet index d7113da5..546a7461 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -75,6 +75,11 @@ [name & more] ~(var ,name :private ,;more)) +(defmacro toggle + "Set a value to its boolean inverse. Same as `(set value (not value))`." + [value] + ~(set ,value (,not ,value))) + (defn defglobal "Dynamically create a global def." [name value] @@ -2950,7 +2955,7 @@ :italics ["*" "*"] :bold ["**" "**"]})) (def modes @{}) - (defn toggle [mode] + (defn toggle-mode [mode] (def active (get modes mode)) (def delims (get delimiters mode)) (put modes mode (not active)) @@ -3060,7 +3065,7 @@ (def token @"") (var token-length 0) (defn delim [mode] - (def d (toggle mode)) + (def d (toggle-mode mode)) (if-not has-color (+= token-length (length d))) (buffer/push token d)) (defn endtoken []