aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/target/ruby.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/target/ruby.lux')
-rw-r--r--stdlib/source/library/lux/target/ruby.lux140
1 files changed, 70 insertions, 70 deletions
diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux
index a5949aab0..a89537de1 100644
--- a/stdlib/source/library/lux/target/ruby.lux
+++ b/stdlib/source/library/lux/target/ruby.lux
@@ -24,7 +24,7 @@
["n" nat]
["f" frac]]]
[type
- abstract]]])
+ [abstract {"-" pattern}]]]])
(def: input_separator ", ")
(def: statement_suffix ";")
@@ -47,15 +47,15 @@
(All (_ brand) (Equivalence (Code brand)))
(def: (= reference subject)
- (# text.equivalence = (:representation reference) (:representation subject))))
+ (# text.equivalence = (representation reference) (representation subject))))
(def: .public manual
(-> Text Code)
- (|>> :abstraction))
+ (|>> abstraction))
(def: .public code
(-> (Code Any) Text)
- (|>> :representation))
+ (|>> representation))
(template [<type> <super>+]
[(with_expansions [<brand> (template.symbol [<type> "'"])]
@@ -88,7 +88,7 @@
(template [<var> <prefix> <constructor>]
[(def: .public <constructor>
(-> Text <var>)
- (|>> (format <prefix>) :abstraction))]
+ (|>> (format <prefix>) abstraction))]
[LVar "l_" local]
[CVar "C_" constant]
@@ -101,7 +101,7 @@
[(template [<name> <input> <output>]
[(def: .public <name>
(-> <input> <output>)
- (|>> :representation (format <prefix>) :abstraction))]
+ (|>> representation (format <prefix>) abstraction))]
[<modifier> LVar <var>]
[<unpacker> Expression Computation]
@@ -145,18 +145,18 @@
(-> (List Expression) Expression)
(|>> (list#each ..code)
(text.interposed ..input_separator)
- :abstraction))
+ abstraction))
(def: .public nil
Literal
- (:abstraction "nil"))
+ (abstraction "nil"))
(def: .public bool
(-> Bit Literal)
(|>> (pipe.case
#0 "false"
#1 "true")
- :abstraction))
+ abstraction))
(def: safe
(-> Text Text)
@@ -178,7 +178,7 @@
(template [<format> <name> <type> <prep>]
[(def: .public <name>
(-> <type> Literal)
- (|>> <prep> <format> :abstraction))]
+ (|>> <prep> <format> abstraction))]
[%.int int Int (<|)]
[%.text string Text ..safe]
@@ -198,29 +198,29 @@
... else
[%.frac])
- :abstraction))
+ abstraction))
(def: .public (array_range from to array)
(-> Expression Expression Expression Computation)
- (|> (format (:representation from) ".." (:representation to))
+ (|> (format (representation from) ".." (representation to))
(text.enclosed ["[" "]"])
- (format (:representation array))
- :abstraction))
+ (format (representation array))
+ abstraction))
(def: .public array
(-> (List Expression) Computation)
- (|>> (list#each (|>> :representation (text.suffix ..input_separator)))
+ (|>> (list#each (|>> representation (text.suffix ..input_separator)))
text.together
(text.enclosed ["[" "]"])
- :abstraction))
+ abstraction))
(def: .public hash
(-> (List [Expression Expression]) Computation)
(|>> (list#each (.function (_ [k v])
- (format (:representation k) " => " (:representation v) ..input_separator)))
+ (format (representation k) " => " (representation v) ..input_separator)))
text.together
(text.enclosed ["{" "}"])
- :abstraction))
+ abstraction))
(def: (control_structure content)
(-> Text Text)
@@ -235,16 +235,16 @@
(def: (block it)
(-> Block Text)
(|> (format (|> (.the #parameters it)
- (list#each (|>> :representation))
+ (list#each (|>> representation))
(text.interposed ..input_separator)
(text.enclosed' "|"))
- (..nested (:representation (.the #body it))))
+ (..nested (representation (.the #body it))))
(text.enclosed ["{" "}"])))
(def: .public (apply/* arguments block func)
(-> (List Expression) (Maybe Block) Expression Computation)
(let [arguments (|> arguments
- (list#each (|>> :representation))
+ (list#each (|>> representation))
(text.interposed ..input_separator)
(text.enclosed ["(" ")"]))
block (case block
@@ -253,72 +253,72 @@
{.#Some [inputs block]}
(|> block
- :representation
+ representation
nested
control_structure
(format " do "
(|> inputs
- (list#each (|>> :representation))
+ (list#each (|>> representation))
(text.interposed ..input_separator)
(text.enclosed' "|")))))]
- (:abstraction (format (:representation func) arguments block))))
+ (abstraction (format (representation func) arguments block))))
(def: .public (the field object)
(-> Text Expression Access)
- (:abstraction (format (:representation object) "." field)))
+ (abstraction (format (representation object) "." field)))
(def: .public (item idx array)
(-> Expression Expression Access)
- (|> (:representation idx)
+ (|> (representation idx)
(text.enclosed ["[" "]"])
- (format (:representation array))
- :abstraction))
+ (format (representation array))
+ abstraction))
(def: .public (? test then else)
(-> Expression Expression Expression Computation)
- (|> (format (:representation test) " ? "
- (:representation then) " : "
- (:representation else))
+ (|> (format (representation test) " ? "
+ (representation then) " : "
+ (representation else))
(text.enclosed ["(" ")"])
- :abstraction))
+ abstraction))
(def: .public statement
(-> Expression Statement)
- (|>> :representation
+ (|>> representation
(text.suffix ..statement_suffix)
- :abstraction))
+ abstraction))
(def: .public (then pre! post!)
(-> Statement Statement Statement)
- (:abstraction
- (format (:representation pre!)
+ (abstraction
+ (format (representation pre!)
\n+
- (:representation post!))))
+ (representation post!))))
(def: .public (set vars value)
(-> (List Location) Expression Statement)
- (:abstraction
+ (abstraction
(format (|> vars
- (list#each (|>> :representation))
+ (list#each (|>> representation))
(text.interposed ..input_separator))
- " = " (:representation value) ..statement_suffix)))
+ " = " (representation value) ..statement_suffix)))
(def: .public (if test then! else!)
(-> Expression Statement Statement Statement)
- (<| :abstraction
+ (<| abstraction
..control_structure
- (format "if " (:representation test)
- (..nested (:representation then!))
+ (format "if " (representation test)
+ (..nested (representation then!))
\n+ "else"
- (..nested (:representation else!)))))
+ (..nested (representation else!)))))
(template [<name> <control_structure>]
[(def: .public (<name> test then!)
(-> Expression Statement Statement)
- (<| :abstraction
+ (<| abstraction
..control_structure
- (format <control_structure> " " (:representation test)
- (..nested (:representation then!)))))]
+ (format <control_structure> " " (representation test)
+ (..nested (representation then!)))))]
[when "if"]
[while "while"]
@@ -326,12 +326,12 @@
(def: .public (for_in var array iteration!)
(-> LVar Expression Statement Statement)
- (<| :abstraction
+ (<| abstraction
..control_structure
- (format "for " (:representation var)
- " in " (:representation array)
+ (format "for " (representation var)
+ " in " (representation array)
" do "
- (..nested (:representation iteration!)))))
+ (..nested (representation iteration!)))))
(type: .public Rescue
(Record
@@ -341,36 +341,36 @@
(def: .public (begin body! rescues)
(-> Statement (List Rescue) Statement)
- (<| :abstraction
+ (<| abstraction
..control_structure
- (format "begin" (..nested (:representation body!))
+ (format "begin" (..nested (representation body!))
(|> rescues
(list#each (.function (_ [classes exception rescue])
(format \n+ "rescue " (text.interposed ..input_separator classes)
- " => " (:representation exception)
- (..nested (:representation rescue)))))
+ " => " (representation exception)
+ (..nested (representation rescue)))))
(text.interposed \n+)))))
(def: .public (catch expectation block)
(-> Expression Block Expression)
- (<| :abstraction
- (format "catch(" (:representation expectation) ") "
+ (<| abstraction
+ (format "catch(" (representation expectation) ") "
(..block block))))
(def: .public (return value)
(-> Expression Statement)
- (:abstraction (format "return " (:representation value) ..statement_suffix)))
+ (abstraction (format "return " (representation value) ..statement_suffix)))
(def: .public (raise message)
(-> Expression Expression)
- (:abstraction (format "raise " (:representation message))))
+ (abstraction (format "raise " (representation message))))
(template [<name> <keyword>]
[(def: .public <name>
Statement
(|> <keyword>
(text.suffix ..statement_suffix)
- :abstraction))]
+ abstraction))]
[next "next"]
[redo "redo"]
@@ -383,14 +383,14 @@
(def: .public (function name args body!)
(-> LVar (List LVar) Statement Statement)
- (<| :abstraction
+ (<| abstraction
..control_structure
- (format "def " (:representation name)
+ (format "def " (representation name)
(|> args
- (list#each (|>> :representation))
+ (list#each (|>> representation))
(text.interposed ..input_separator)
(text.enclosed ["(" ")"]))
- (..nested (:representation body!)))))
+ (..nested (representation body!)))))
(def: .public (lambda name block)
(-> (Maybe LVar) Block Literal)
@@ -400,14 +400,14 @@
proc
{.#Some name}
- (format (:representation name) " = " proc))
+ (format (representation name) " = " proc))
(text.enclosed ["(" ")"])
- :abstraction)))
+ abstraction)))
(template [<op> <name>]
[(def: .public (<name> parameter subject)
(-> Expression Expression Computation)
- (:abstraction (format "(" (:representation subject) " " <op> " " (:representation parameter) ")")))]
+ (abstraction (format "(" (representation subject) " " <op> " " (representation parameter) ")")))]
["==" =]
[ "<" <]
@@ -435,7 +435,7 @@
(template [<unary> <name>]
[(def: .public (<name> subject)
(-> Expression Computation)
- (:abstraction (format "(" <unary> (:representation subject) ")")))]
+ (abstraction (format "(" <unary> (representation subject) ")")))]
["!" not]
["~" bit_not]
@@ -444,8 +444,8 @@
(def: .public (comment commentary on)
(All (_ brand) (-> Text (Code brand) (Code brand)))
- (:abstraction (format "# " (..safe commentary) \n+
- (:representation on))))
+ (abstraction (format "# " (..safe commentary) \n+
+ (representation on))))
(template [<name>]
[(`` (def: .public ((~~ (template.symbol [<name> "/*"])) attributes)