diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/host.js.lux | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/stdlib/source/lux/host.js.lux b/stdlib/source/lux/host.js.lux index fdbc752c4..5e52cc283 100644 --- a/stdlib/source/lux/host.js.lux +++ b/stdlib/source/lux/host.js.lux @@ -1,4 +1,4 @@ -(;module: +(.module: lux (lux (control monad ["p" parser]) @@ -9,7 +9,7 @@ )) (do-template [<name> <type>] - [(type: #export <name> (#;Primitive <type> #;Nil))] + [(type: #export <name> (#.Primitive <type> #.Nil))] [Object "object"] [Function "function"] @@ -27,24 +27,24 @@ ## [Syntax] (syntax: #export (set! field-name field-value object) - {#;doc (doc "A way to set fields from objects." + {#.doc (doc "A way to set fields from objects." (set! "foo" 1234 some-object))} (wrap (list (` ("js set-field" (~ object) (~ field-name) (~ field-value)))))) (syntax: #export (delete! field-name object) - {#;doc (doc "A way to delete fields from objects." + {#.doc (doc "A way to delete fields from objects." (delete! "foo" some-object))} (wrap (list (` ("js delete-field" (~ object) (~ field-name)))))) (syntax: #export (get field-name type object) - {#;doc (doc "A way to get fields from objects." + {#.doc (doc "A way to get fields from objects." (get "ceil" (ref "Math")) (get "ceil" (-> Frac Frac) (ref "Math")))} (wrap (list (` (:! (~ type) ("js get-field" (~ object) (~ field-name))))))) -(syntax: #export (object [kvs (p;some (p;seq s;any s;any))]) - {#;doc (doc "A way to create JavaScript objects." +(syntax: #export (object [kvs (p.some (p.seq s.any s.any))]) + {#.doc (doc "A way to create JavaScript objects." (object) (object "foo" foo "bar" (inc bar)))} (wrap (list (L/fold (function [[k v] object] @@ -52,16 +52,16 @@ (` ("js object")) kvs)))) -(syntax: #export (ref [name s;text] [type (p;maybe s;any)]) - {#;doc (doc "A way to refer to JavaScript variables." +(syntax: #export (ref [name s.text] [type (p.maybe s.any)]) + {#.doc (doc "A way to refer to JavaScript variables." (ref "document") (ref "Math.ceil" (-> Frac Frac)))} - (wrap (list (` (:! (~ (default (' ;;Object) type)) - ("js ref" (~ (code;text name)))))))) + (wrap (list (` (:! (~ (default (' ..Object) type)) + ("js ref" (~ (code.text name)))))))) (do-template [<name> <proc> <doc>] [(syntax: #export (<name>) - {#;doc (doc <doc> + {#.doc (doc <doc> (<name>))} (wrap (list (` (<proc>)))))] @@ -69,16 +69,16 @@ [undef "js undefined" "Undefined."] ) -(syntax: #export (call! [shape (p;alt ($_ p;seq s;any (s;tuple (p;some s;any)) (p;maybe s;any)) - ($_ p;seq s;any s;text (s;tuple (p;some s;any)) (p;maybe s;any)))]) - {#;doc (doc "A way to call JavaScript functions and methods." +(syntax: #export (call! [shape (p.alt ($_ p.seq s.any (s.tuple (p.some s.any)) (p.maybe s.any)) + ($_ p.seq s.any s.text (s.tuple (p.some s.any)) (p.maybe s.any)))]) + {#.doc (doc "A way to call JavaScript functions and methods." (call! (ref "Math.ceil") [123.45]) (call! (ref "Math") "ceil" [123.45]))} (case shape - (#;Left [function args ?type]) - (wrap (list (` (:! (~ (default (' ;;Object) ?type)) + (#.Left [function args ?type]) + (wrap (list (` (:! (~ (default (' ..Object) ?type)) ("js call" (~ function) (~@ args)))))) - (#;Right [object field args ?type]) - (wrap (list (` (:! (~ (default (' ;;Object) ?type)) - ("js object-call" (~ object) (~ (code;text field)) (~@ args)))))))) + (#.Right [object field args ?type]) + (wrap (list (` (:! (~ (default (' ..Object) ?type)) + ("js object-call" (~ object) (~ (code.text field)) (~@ args)))))))) |