From 41d54d8c9f11cde7fb41578d5c2763906942884d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 12 Feb 2019 18:56:30 -0400 Subject: Forgot to remove the JS module from new-luxc. --- new-luxc/source/luxc/lang/host/js.lux | 113 ---------------------------------- 1 file changed, 113 deletions(-) delete mode 100644 new-luxc/source/luxc/lang/host/js.lux (limited to 'new-luxc/source') 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 Fold])))) - -(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 [ ] - [(def: #export ( param subject) - (-> Expression Expression Expression) - (format "(" subject " " " " param ")"))] - - [= "==="] - [< "<"] - [<= "<="] - [> ">"] - [>= ">="] - [+ "+"] - [- "-"] - [* "*"] - [/ "/"] - [% "%"] - ) - -(do-template [ ] - [(def: #export ( param subject) - (-> Expression Expression Expression) - (format "(" param " " " " subject ")"))] - - [or "||"] - [and "&&"] - [bit-or "|"] - [bit-and "&"] - ) -- cgit v1.2.3