aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source
diff options
context:
space:
mode:
authorEduardo Julian2019-02-12 18:56:30 -0400
committerEduardo Julian2019-02-12 18:56:30 -0400
commit41d54d8c9f11cde7fb41578d5c2763906942884d (patch)
treea46242d16d920a3f43b915699bf0cfc8f6ee1ad5 /new-luxc/source
parent845ccb5460583df6cbf37824c2eed82729a24804 (diff)
Forgot to remove the JS module from new-luxc.
Diffstat (limited to 'new-luxc/source')
-rw-r--r--new-luxc/source/luxc/lang/host/js.lux113
1 files changed, 0 insertions, 113 deletions
diff --git a/new-luxc/source/luxc/lang/host/js.lux b/new-luxc/source/luxc/lang/host/js.lux
deleted file mode 100644
index e8f86ebdd..000000000
--- a/new-luxc/source/luxc/lang/host/js.lux
+++ /dev/null
@@ -1,113 +0,0 @@
-(.module:
- [lux #- or and function]
- (lux (data [text]
- text/format
- (coll [list "list/" Functor<List> Fold<List>]))))
-
-(type: #export JS Text)
-
-(type: #export Expression JS)
-
-(type: #export Statement JS)
-
-(def: #export (number value)
- (-> Frac Expression)
- (%f value))
-
-(def: #export (string value)
- (-> Text Expression)
- (%t value))
-
-(def: #export (apply func args)
- (-> Expression (List Expression) Expression)
- (format func "(" (text.join-with "," args) ")"))
-
-(def: #export (var! name value)
- (-> Text (Maybe Expression) Statement)
- (case value
- #.None
- (format "var " name ";")
-
- (#.Some value)
- (format "var " name " = " value ";")))
-
-(def: #export (set! name value)
- (-> Text Expression Statement)
- (format name " = " value ";"))
-
-(def: #export (if! test then! else!)
- (-> Expression Statement Statement Statement)
- (format "if(" test ") "
- then!
- " else "
- else!))
-
-(def: #export (cond! clauses else!)
- (-> (List [Expression Statement]) Statement Statement)
- (list/fold (.function (_ [test then!] next!)
- (if! test then! next!))
- else!
- (list.reverse clauses)))
-
-(def: #export (block! statements)
- (-> (List Statement) Statement)
- (format "{" (text.join-with "" statements) "}"))
-
-(def: #export (while! test body)
- (-> Expression (List Statement) Statement)
- (format "while(" test ") " (block! body)))
-
-(def: #export (throw! message)
- (-> Expression Statement)
- (format "throw Error(" message ");"))
-
-(def: #export (return! value)
- (-> Expression Statement)
- (format "return " value ";"))
-
-(def: #export (function name args body)
- (-> Text (List Text) (List Statement) Expression)
- (let [args (format "(" (text.join-with ", " args) ")")
- function (format "function " name args " " (block! body))]
- (format "(" function ")")))
-
-(def: #export (? test then else)
- (-> Expression Expression Expression Expression)
- (format "(" test " ? " then " : " else ")"))
-
-(def: #export (object fields)
- (-> (List [Text Expression]) Expression)
- (format "({"
- (|> fields
- (list/map (.function (_ [key val])
- (format key ": " val)))
- (text.join-with ", "))
- "})"))
-
-(do-template [<name> <op>]
- [(def: #export (<name> param subject)
- (-> Expression Expression Expression)
- (format "(" subject " " <op> " " param ")"))]
-
- [= "==="]
- [< "<"]
- [<= "<="]
- [> ">"]
- [>= ">="]
- [+ "+"]
- [- "-"]
- [* "*"]
- [/ "/"]
- [% "%"]
- )
-
-(do-template [<name> <op>]
- [(def: #export (<name> param subject)
- (-> Expression Expression Expression)
- (format "(" param " " <op> " " subject ")"))]
-
- [or "||"]
- [and "&&"]
- [bit-or "|"]
- [bit-and "&"]
- )