aboutsummaryrefslogtreecommitdiff
path: root/lux-lua
diff options
context:
space:
mode:
Diffstat (limited to 'lux-lua')
-rw-r--r--lux-lua/source/program.lux112
1 files changed, 56 insertions, 56 deletions
diff --git a/lux-lua/source/program.lux b/lux-lua/source/program.lux
index 5c3185252..0a1eda39b 100644
--- a/lux-lua/source/program.lux
+++ b/lux-lua/source/program.lux
@@ -525,44 +525,44 @@
$b4 (_.var "b4")
table/insert (function (_ in/0 in/1) (_.apply (list in/0 in/1) (_.var "table.insert")))]
(_.function (_.var "utf8.char") (list $var_args)
- ($_ _.then
- (_.local/1 $buffer (_.array (list)))
- (<| (_.for_in (list $k $v) (_.ipairs/1 (_.array (list $var_args))))
- ($_ _.then
- (_.when (_.or (_.< (_.int +0) $v)
- (_.> (!int "10FFFF") $v))
- (_.statement (_.error/2 (|> (_.string "bad argument #")
- (_.concat $k)
- (_.concat (_.string " to char (out of range)")))
- (_.int +2))))
- (<| (_.if (_.< (!int "80") $v)
- ... Single-byte sequence
+ (all _.then
+ (_.local/1 $buffer (_.array (list)))
+ (<| (_.for_in (list $k $v) (_.ipairs/1 (_.array (list $var_args))))
+ (all _.then
+ (_.when (_.or (_.< (_.int +0) $v)
+ (_.> (!int "10FFFF") $v))
+ (_.statement (_.error/2 (|> (_.string "bad argument #")
+ (_.concat $k)
+ (_.concat (_.string " to char (out of range)")))
+ (_.int +2))))
+ (<| (_.if (_.< (!int "80") $v)
+ ... Single-byte sequence
+ (_.statement (|> (_.var "string.char")
+ (_.apply (list $v))
+ (table/insert $buffer))))
+ (_.if (_.< (!int "800") $v)
+ ... Two-byte sequence
+ (_.statement (|> (_.var "string.char")
+ (_.apply (list (!&|< "C0" "1F" +6 $v)
+ (!&| "80" "3F" $v)))
+ (table/insert $buffer))))
+ (_.if (_.< (!int "10000") $v)
+ ... Three-byte sequence
+ (_.statement (|> (_.var "string.char")
+ (_.apply (list (!&|< "E0" "0F" +12 $v)
+ (!&|< "80" "3F" +6 $v)
+ (!&| "80" "3F" $v)))
+ (table/insert $buffer))))
+ ... Four-byte sequence
(_.statement (|> (_.var "string.char")
- (_.apply (list $v))
- (table/insert $buffer))))
- (_.if (_.< (!int "800") $v)
- ... Two-byte sequence
- (_.statement (|> (_.var "string.char")
- (_.apply (list (!&|< "C0" "1F" +6 $v)
- (!&| "80" "3F" $v)))
- (table/insert $buffer))))
- (_.if (_.< (!int "10000") $v)
- ... Three-byte sequence
- (_.statement (|> (_.var "string.char")
- (_.apply (list (!&|< "E0" "0F" +12 $v)
+ (_.apply (list (!&|< "F0" "07" +18 $v)
+ (!&|< "80" "3F" +12 $v)
(!&|< "80" "3F" +6 $v)
(!&| "80" "3F" $v)))
(table/insert $buffer))))
- ... Four-byte sequence
- (_.statement (|> (_.var "string.char")
- (_.apply (list (!&|< "F0" "07" +18 $v)
- (!&|< "80" "3F" +12 $v)
- (!&|< "80" "3F" +6 $v)
- (!&| "80" "3F" $v)))
- (table/insert $buffer))))
- ))
- (_.return (_.apply (list $buffer (_.string "")) (_.var "table.concat")))
- ))))
+ ))
+ (_.return (_.apply (list $buffer (_.string "")) (_.var "table.concat")))
+ ))))
... (def: rembulan//str_rel_to_abs
... (let [$string (_.var "string")
@@ -570,10 +570,10 @@
... $k (_.var "k")
... $v (_.var "v")]
... (<| (_.local_function $str_rel_to_abs (list $string $var_args))
- ... ($_ _.then
+ ... (all _.then
... (_.local/1 $args (_.array (list $var_args)))
... (<| (_.for_in (list $k $v) (_.ipairs/1 $args))
- ... ($_ _.then
+ ... (all _.then
... (_.if (_.> (_.int +0) $v)
... (_.set (list $v) $v)
... (_.set (list $v) (|> $v (_.+ (_.length $string)) (_.+ (_.int +1)))))
@@ -592,7 +592,7 @@
... $bx (_.var "bx")
... $end (_.var "_end")]
... (<| (_.local_function $decode (list $string $start))
- ... ($_ _.then
+ ... (all _.then
... (_.set (list $start) (_.apply (list $string (_.or (_.int +1) $start)) $str_rel_to_abs))
... (_.local/1 $b1 (_.do "byte" (list $start $start) $string))
... (<| (_.if (_.< (!int "80") $b1)
@@ -603,7 +603,7 @@
... (_.< (!int "C2") $b1))
... (_.return _.nil))
... ... Get 'supposed' amount of continuation bytes from primary byte
- ... ($_ _.then
+ ... (all _.then
... (_.local/1 $end (|> (|> $b1 (_.>= (!int "F0")) (_.and (_.int +3)))
... (_.or (|> $b1 (_.>= (!int "E0")) (_.and (_.int +2))))
... (_.or (|> $b1 (_.>= (!int "C0")) (_.and (_.int +1))))
@@ -627,16 +627,16 @@
... $start (_.var "start")
... $end (_.var "_end")]
... (_.function (_.var "utf8.codes") (list $string)
- ... ($_ _.then
+ ... (all _.then
... (_.local/1 $i (_.int +1))
... (_.return (<| (_.closure (list))
... (_.if (_.> (_.length $string) $i)
... (_.return _.nil)
- ... ($_ _.then
+ ... (all _.then
... (_.let (list $start $end) (_.apply (list $string $i) $decode))
... (_.if (_.not $start)
... (_.statement (_.error/2 (_.string "invalid UTF-8 code") (_.int +2)))
- ... ($_ _.then
+ ... (all _.then
... (_.set (list $i) (_.+ (_.int +1) $end))
... (_.return (_.multi (list $start (_.do "sub" (list $start $end) $string))))
... ))
@@ -651,16 +651,16 @@
... $seq_end (_.var "seq_end")
... $size (_.var "size")]
... (_.function (_.var "utf8.len") (list $string $start $end)
- ... ($_ _.then
+ ... (all _.then
... (_.set (list $start $end) (_.apply (list $string (_.or (_.int +1) $start) (_.or (_.int -1) $end)) $str_rel_to_abs))
... (_.local/1 $size (_.int +0))
... (_.repeat (_.>= $end $seq_end)
- ... ($_ _.then
+ ... (all _.then
... (_.let (list $seq_start $seq_end) (_.apply (list $string $start) $decode))
... (_.if (_.not $seq_start)
... ... Hit an invalid sequence!
... (_.return (_.multi (list (_.boolean false) $start)))
- ... ($_ _.then
+ ... (all _.then
... (_.set (list $start) (_.+ (_.int +1) $seq_end))
... (_.set (list $size) (_.+ (_.int +1) $size))
... ))
@@ -674,18 +674,18 @@
(def: rembulan_prelude
_.Statement
- ($_ _.then
- (_.function (_.var "os.time") (list)
- (_.return (_.int +0)))
-
- ... Ported from https://github.com/meepen/Lua-5.1-UTF-8
- ..rembulan//char
- ... ..rembulan//str_rel_to_abs
- ... ..rembulan//decode
- ... ..rembulan//codes
- ... ..rembulan//len
- ... ..rembulan//charpattern
- )))))
+ (all _.then
+ (_.function (_.var "os.time") (list)
+ (_.return (_.int +0)))
+
+ ... Ported from https://github.com/meepen/Lua-5.1-UTF-8
+ ..rembulan//char
+ ... ..rembulan//str_rel_to_abs
+ ... ..rembulan//decode
+ ... ..rembulan//codes
+ ... ..rembulan//len
+ ... ..rembulan//charpattern
+ )))))
(def: host
(IO [Baggage (Host _.Expression _.Statement)])