diff options
Diffstat (limited to '')
-rw-r--r-- | lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux index e73ea068e..ff56c7824 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux @@ -44,13 +44,13 @@ (-> [(Parser s) (-> Text Phase Archive s (Operation Inst))] Handler)) - (function (_ extension-name phase archive input) + (function (_ extension_name phase archive input) (case (<s>.run parser input) (#try.Success input') - (handler extension-name phase archive input') + (handler extension_name phase archive input') (#try.Failure error) - (phase.throw extension.invalid-syntax [extension-name %synthesis input])))) + (phase.throw extension.invalid_syntax [extension_name %synthesis input])))) (import: java/lang/Double ["#::." @@ -62,16 +62,16 @@ (def: $System (type.class "java.lang.System" (list))) (def: $Object (type.class "java.lang.Object" (list))) -(def: lux-intI Inst (|>> _.I2L (_.wrap type.long))) -(def: jvm-intI Inst (|>> (_.unwrap type.long) _.L2I)) -(def: check-stringI Inst (_.CHECKCAST $String)) +(def: lux_intI Inst (|>> _.I2L (_.wrap type.long))) +(def: jvm_intI Inst (|>> (_.unwrap type.long) _.L2I)) +(def: check_stringI Inst (_.CHECKCAST $String)) (def: (predicateI tester) (-> (-> Label Inst) Inst) (let [$Boolean (type.class "java.lang.Boolean" (list))] - (<| _.with-label (function (_ @then)) - _.with-label (function (_ @end)) + (<| _.with_label (function (_ @then)) + _.with_label (function (_ @end)) (|>> (tester @then) (_.GETSTATIC $Boolean "FALSE" $Boolean) (_.GOTO @end) @@ -83,16 +83,16 @@ (def: unitI Inst (_.string synthesis.unit)) ## TODO: Get rid of this ASAP -(def: lux::syntax-char-case! +(def: lux::syntax_char_case! (..custom [($_ <>.and <s>.any <s>.any (<>.some (<s>.tuple ($_ <>.and (<s>.tuple (<>.many <s>.i64)) <s>.any)))) - (function (_ extension-name phase archive [input else conditionals]) - (<| _.with-label (function (_ @end)) - _.with-label (function (_ @else)) + (function (_ extension_name phase archive [input else conditionals]) + (<| _.with_label (function (_ @end)) + _.with_label (function (_ @else)) (do {@ phase.monad} [inputG (phase archive input) elseG (phase archive else) @@ -101,7 +101,7 @@ (monad.map @ (function (_ [chars branch]) (do @ [branchG (phase archive branch)] - (wrap (<| _.with-label (function (_ @branch)) + (wrap (<| _.with_label (function (_ @branch)) [(list@map (function (_ char) [(.int char) @branch]) chars) @@ -151,13 +151,13 @@ [(def: (<name> [shiftI inputI]) (Binary Inst) (|>> inputI (_.unwrap type.long) - shiftI jvm-intI + shiftI jvm_intI <op> (_.wrap type.long)))] - [i64::left-shift _.LSHL] - [i64::arithmetic-right-shift _.LSHR] - [i64::logical-right-shift _.LUSHR] + [i64::left_shift _.LSHL] + [i64::arithmetic_right_shift _.LSHR] + [i64::logical_right_shift _.LUSHR] ) (template [<name> <const> <type>] @@ -220,76 +220,76 @@ [f64::i64 (_.unwrap type.double) (<| (_.wrap type.long) _.D2L)] [f64::encode (_.unwrap type.double) (_.INVOKESTATIC (type.class "java.lang.Double" (list)) "toString" (type.method [(list type.double) $String (list)]))] - [f64::decode ..check-stringI + [f64::decode ..check_stringI (_.INVOKESTATIC ///.$Runtime "decode_frac" (type.method [(list $String) ///.$Variant (list)]))] ) (def: (text::size inputI) (Unary Inst) (|>> inputI - ..check-stringI + ..check_stringI (_.INVOKEVIRTUAL $String "length" (type.method [(list) type.int (list)])) - lux-intI)) + lux_intI)) -(template [<name> <pre-subject> <pre-param> <op> <post>] +(template [<name> <pre_subject> <pre_param> <op> <post>] [(def: (<name> [paramI subjectI]) (Binary Inst) - (|>> subjectI <pre-subject> - paramI <pre-param> + (|>> subjectI <pre_subject> + paramI <pre_param> <op> <post>))] [text::= (<|) (<|) (_.INVOKEVIRTUAL $Object "equals" (type.method [(list $Object) type.boolean (list)])) (_.wrap type.boolean)] - [text::< ..check-stringI ..check-stringI + [text::< ..check_stringI ..check_stringI (_.INVOKEVIRTUAL $String "compareTo" (type.method [(list $String) type.int (list)])) (predicateI _.IFLT)] - [text::char ..check-stringI jvm-intI + [text::char ..check_stringI jvm_intI (_.INVOKEVIRTUAL $String "charAt" (type.method [(list type.int) type.char (list)])) - lux-intI] + lux_intI] ) (def: (text::concat [leftI rightI]) (Binary Inst) - (|>> leftI ..check-stringI - rightI ..check-stringI + (|>> leftI ..check_stringI + rightI ..check_stringI (_.INVOKEVIRTUAL $String "concat" (type.method [(list $String) $String (list)])))) (def: (text::clip [startI endI subjectI]) (Trinary Inst) - (|>> subjectI ..check-stringI - startI jvm-intI - endI jvm-intI + (|>> subjectI ..check_stringI + startI jvm_intI + endI jvm_intI (_.INVOKEVIRTUAL $String "substring" (type.method [(list type.int type.int) $String (list)])))) -(def: index-method (type.method [(list $String type.int) type.int (list)])) +(def: index_method (type.method [(list $String type.int) type.int (list)])) (def: (text::index [startI partI textI]) (Trinary Inst) - (<| _.with-label (function (_ @not-found)) - _.with-label (function (_ @end)) - (|>> textI ..check-stringI - partI ..check-stringI - startI jvm-intI - (_.INVOKEVIRTUAL $String "indexOf" index-method) + (<| _.with_label (function (_ @not_found)) + _.with_label (function (_ @end)) + (|>> textI ..check_stringI + partI ..check_stringI + startI jvm_intI + (_.INVOKEVIRTUAL $String "indexOf" index_method) _.DUP (_.int -1) - (_.IF_ICMPEQ @not-found) - lux-intI + (_.IF_ICMPEQ @not_found) + lux_intI runtime.someI (_.GOTO @end) - (_.label @not-found) + (_.label @not_found) _.POP runtime.noneI (_.label @end)))) -(def: string-method (type.method [(list $String) type.void (list)])) +(def: string_method (type.method [(list $String) type.void (list)])) (def: (io::log messageI) (Unary Inst) (let [$PrintStream (type.class "java.io.PrintStream" (list))] (|>> (_.GETSTATIC $System "out" $PrintStream) messageI - ..check-stringI - (_.INVOKEVIRTUAL $PrintStream "println" string-method) + ..check_stringI + (_.INVOKEVIRTUAL $PrintStream "println" string_method) unitI))) (def: (io::error messageI) @@ -298,17 +298,17 @@ (|>> (_.NEW $Error) _.DUP messageI - ..check-stringI - (_.INVOKESPECIAL $Error "<init>" string-method) + ..check_stringI + (_.INVOKESPECIAL $Error "<init>" string_method) _.ATHROW))) (def: (io::exit codeI) (Unary Inst) - (|>> codeI jvm-intI + (|>> codeI jvm_intI (_.INVOKESTATIC $System "exit" (type.method [(list type.int) type.void (list)])) _.NULL)) -(def: (io::current-time _) +(def: (io::current_time _) (Nullary Inst) (|>> (_.INVOKESTATIC $System "currentTimeMillis" (type.method [(list) type.long (list)])) (_.wrap type.long))) @@ -316,7 +316,7 @@ (def: bundle::lux Bundle (|> (: Bundle bundle.empty) - (bundle.install "syntax char case!" lux::syntax-char-case!) + (bundle.install "syntax char case!" lux::syntax_char_case!) (bundle.install "is" (binary lux::is)) (bundle.install "try" (unary lux::try)))) @@ -327,9 +327,9 @@ (bundle.install "and" (binary i64::and)) (bundle.install "or" (binary i64::or)) (bundle.install "xor" (binary i64::xor)) - (bundle.install "left-shift" (binary i64::left-shift)) - (bundle.install "logical-right-shift" (binary i64::logical-right-shift)) - (bundle.install "arithmetic-right-shift" (binary i64::arithmetic-right-shift)) + (bundle.install "left-shift" (binary i64::left_shift)) + (bundle.install "logical-right-shift" (binary i64::logical_right_shift)) + (bundle.install "arithmetic-right-shift" (binary i64::arithmetic_right_shift)) (bundle.install "=" (binary i64::=)) (bundle.install "<" (binary i64::<)) (bundle.install "+" (binary i64::+)) @@ -377,7 +377,7 @@ (bundle.install "log" (unary io::log)) (bundle.install "error" (unary io::error)) (bundle.install "exit" (unary io::exit)) - (bundle.install "current-time" (nullary io::current-time))))) + (bundle.install "current-time" (nullary io::current_time))))) (def: #export bundle Bundle |