aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/host/php.lux
diff options
context:
space:
mode:
authorEduardo Julian2018-07-03 19:49:04 -0400
committerEduardo Julian2018-07-03 19:49:04 -0400
commitaac5a7796939cd705d955acb616cbff38474606d (patch)
tree567f60f65afb2a94299336a72ea105f00a16b63d /new-luxc/source/luxc/lang/host/php.lux
parentd3f5e1f4baa667bc2eb72edd542cf5d8cd3924ce (diff)
- Re-named "@abstraction" to ":abstraction" and "@representation" to ":representation".
Diffstat (limited to 'new-luxc/source/luxc/lang/host/php.lux')
-rw-r--r--new-luxc/source/luxc/lang/host/php.lux100
1 files changed, 50 insertions, 50 deletions
diff --git a/new-luxc/source/luxc/lang/host/php.lux b/new-luxc/source/luxc/lang/host/php.lux
index 603888d3e..50d618f85 100644
--- a/new-luxc/source/luxc/lang/host/php.lux
+++ b/new-luxc/source/luxc/lang/host/php.lux
@@ -28,7 +28,7 @@
(type: #export Computation (Code' (Expression' Computation')))
(type: #export Statement (Code' Statement'))
- (def: #export code (-> Code Text) (|>> @representation))
+ (def: #export code (-> Code Text) (|>> :representation))
(def: nest
(-> Text Text)
@@ -41,18 +41,18 @@
(def: computation
(-> Text Computation)
- (|>> (text.enclose ["(" ")"]) @abstraction))
+ (|>> (text.enclose ["(" ")"]) :abstraction))
(def: (statement code)
(-> Text Statement)
- (@abstraction (format code ";")))
+ (:abstraction (format code ";")))
(def: parameters
(-> (List Argument) Text)
(|>> (list/map (.function (_ [reference? var])
(if reference?
- (format "&" (@representation var))
- (@representation var))))
+ (format "&" (:representation var))
+ (:representation var))))
(text.join-with ", ")
(text.enclose ["(" ")"])))
@@ -71,23 +71,23 @@
(def: #export var
(-> Text Var)
- (|>> (format "$") @abstraction))
+ (|>> (format "$") :abstraction))
(def: #export global
(-> Text Global)
- (|>> @abstraction))
+ (|>> :abstraction))
(def: #export null
Computation
- (@abstraction "NULL"))
+ (:abstraction "NULL"))
(def: #export bool
(-> Bool Computation)
- (|>> %b @abstraction))
+ (|>> %b :abstraction))
(def: #export int
(-> Int Computation)
- (|>> %i @abstraction))
+ (|>> %i :abstraction))
(def: #export float
(-> Frac Computation)
@@ -101,16 +101,16 @@
[(new> "NAN" computation)]
## else
- [%f @abstraction])))
+ [%f :abstraction])))
(def: #export string
(-> Text Computation)
- (|>> %t @abstraction))
+ (|>> %t :abstraction))
(def: #export (apply args func)
(-> (List Expression) Expression Computation)
- (@abstraction
- (format (@representation func) (..arguments args))))
+ (:abstraction
+ (format (:representation func) (..arguments args))))
(def: #export (function arguments uses body)
(-> (List Argument) (List Argument) Statement Computation)
@@ -123,7 +123,7 @@
(computation
(format "function " (..parameters arguments)
" " uses " "
- (block (@representation body))))))
+ (block (:representation body))))))
(do-template [<name> <function>]
[(def: #export <name>
@@ -156,7 +156,7 @@
(format "array("
(|> kvs
(list/map (.function (_ [key value])
- (format (@representation key) " => " (@representation value))))
+ (format (:representation key) " => " (:representation value))))
(text.join-with ", "))
")")))
@@ -192,30 +192,30 @@
(def: #export (new constructor inputs)
(-> Global (List Expression) Computation)
(computation
- (format "new " (@representation constructor) (arguments inputs))))
+ (format "new " (:representation constructor) (arguments inputs))))
(def: #export (send method inputs object)
(-> Text (List Expression) Expression Computation)
(computation
- (format (@representation object) "->" method (arguments inputs))))
+ (format (:representation object) "->" method (arguments inputs))))
(def: #export (nth idx array)
(-> Expression Expression Computation)
(computation
- (format (@representation array) "[" (@representation idx) "]")))
+ (format (:representation array) "[" (:representation idx) "]")))
(def: #export (? test then else)
(-> Expression Expression Expression Computation)
(computation
- (format (@representation test) " ? "
- (@representation then) " : "
- (@representation else))))
+ (format (:representation test) " ? "
+ (:representation then) " : "
+ (:representation else))))
(do-template [<name> <op>]
[(def: #export (<name> param subject)
(-> Expression Expression Computation)
(computation
- (format (@representation subject) " " <op> " " (@representation param))))]
+ (format (:representation subject) " " <op> " " (:representation param))))]
[or "||"]
[and "&&"]
@@ -240,12 +240,12 @@
(def: #export not
(-> Computation Computation)
- (|>> @representation (format "!") @abstraction))
+ (|>> :representation (format "!") :abstraction))
(do-template [<name> <type> <constructor>]
[(def: #export (<name> var value)
(-> Var Expression <type>)
- (<constructor> (format (@representation var) " = " (@representation value))))]
+ (<constructor> (format (:representation var) " = " (:representation value))))]
[set! Statement ..statement]
[set!' Computation ..computation]
@@ -254,11 +254,11 @@
(def: #export (set-nth! idx value array)
(-> Expression Expression Expression Statement)
(..statement
- (format (@representation array) "[" (@representation idx) "] = " (@representation value))))
+ (format (:representation array) "[" (:representation idx) "] = " (:representation value))))
(def: #export global!
(-> Var Statement)
- (|>> @representation (format "global ") ..statement))
+ (|>> :representation (format "global ") ..statement))
(def: #export (set-global! name value)
(-> Text Expression Statement)
@@ -266,34 +266,34 @@
(def: #export (if! test then! else!)
(-> Expression Statement Statement Statement)
- (@abstraction
- (format "if (" (@representation test) ")"
- (block (@representation then!))
+ (:abstraction
+ (format "if (" (:representation test) ")"
+ (block (:representation then!))
" else "
- (block (@representation else!)))))
+ (block (:representation else!)))))
(def: #export (when! test then!)
(-> Expression Statement Statement)
- (@abstraction
- (format "if (" (@representation test) ") "
- (block (@representation then!)))))
+ (:abstraction
+ (format "if (" (:representation test) ") "
+ (block (:representation then!)))))
(def: #export (then! post! pre!)
(-> Statement Statement Statement)
- (@abstraction
- (format (@representation pre!)
+ (:abstraction
+ (format (:representation pre!)
"\n"
- (@representation post!))))
+ (:representation post!))))
## (def: #export (while! test body!)
## (-> Computation Statement Statement)
- ## (@abstraction
+ ## (:abstraction
## (format "while " (expression test) ":"
## (nest body!))))
## (def: #export (for-in! variable inputs body!)
## (-> SVariable Computation Statement Statement)
- ## (@abstraction
+ ## (:abstraction
## (format "for " (..name variable) " in " (expression inputs) ":"
## (nest body!))))
@@ -304,21 +304,21 @@
(def: (catch! except)
(-> Except Text)
- (let [declaration (format "(" (@representation (get@ #class except))
- " " (@representation (get@ #exception except)) ")")]
+ (let [declaration (format "(" (:representation (get@ #class except))
+ " " (:representation (get@ #exception except)) ")")]
(format "catch" declaration " "
- (block (@representation (get@ #handler except))))))
+ (block (:representation (get@ #handler except))))))
(def: #export (try! body! excepts)
(-> Statement (List Except) Statement)
- (@abstraction
- (format "try " (block (@representation body!)) "\n"
+ (:abstraction
+ (format "try " (block (:representation body!)) "\n"
(|> excepts (list/map catch!) (text.join-with "\n")))))
(do-template [<name> <keyword>]
[(def: #export (<name> message)
(-> Expression Statement)
- (statement (format <keyword> " " (@representation message))))]
+ (statement (format <keyword> " " (:representation message))))]
[throw! "throw"]
[return! "return"]
@@ -327,17 +327,17 @@
(def: #export do!
(-> Expression Statement)
- (|>> @representation statement))
+ (|>> :representation statement))
(def: #export (define! name value)
(-> Global Expression Statement)
- (do! (..apply (list (|> name @representation ..string)
+ (do! (..apply (list (|> name :representation ..string)
value)
(..global "define"))))
(def: #export (function! name args body)
(-> Global (List Argument) Statement Statement)
- (@abstraction
- (format "function " (@representation name) (..parameters args)
- " " (block (@representation body)))))
+ (:abstraction
+ (format "function " (:representation name) (..parameters args)
+ " " (block (:representation body)))))
)