From 314f7bcc81a8fe465bf12ede12618356d1ecca37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=94=84=EB=A6=AC=EB=A7=88?= Date: Mon, 22 Apr 2024 23:39:39 -0400 Subject: [PATCH] tests --- apps/spiral/Eval.dib | 10 +- apps/spiral/Eval.fs | 10 +- lib/spiral/benchmark.dib | 2 +- lib/spiral/benchmark.spi | 2 +- lib/spiral/common.fsx | 187 +++++++++++++++++++------------------ lib/spiral/common.rs | 37 ++++---- lib/spiral/file_system.fsx | 187 +++++++++++++++++++------------------ lib/spiral/file_system.rs | 37 ++++---- lib/spiral/networking.fsx | 187 +++++++++++++++++++------------------ lib/spiral/networking.rs | 37 ++++---- lib/spiral/runtime.dib | 18 ++++ lib/spiral/runtime.fsx | 187 +++++++++++++++++++------------------ lib/spiral/runtime.rs | 37 ++++---- lib/spiral/runtime.spi | 8 ++ lib/spiral/sm'.dib | 12 ++- lib/spiral/sm'.spi | 4 +- lib/spiral/sm.fsx | 148 ++++++++++++++--------------- lib/spiral/sm.rs | 157 ++++++++++++++++--------------- lib/spiral/trace.dib | 2 +- lib/spiral/trace.fsx | 185 ++++++++++++++++++------------------ lib/spiral/trace.rs | 37 ++++---- lib/spiral/trace.spi | 2 +- 22 files changed, 783 insertions(+), 710 deletions(-) diff --git a/apps/spiral/Eval.dib b/apps/spiral/Eval.dib index 7f376ae3..07e99027 100644 --- a/apps/spiral/Eval.dib +++ b/apps/spiral/Eval.dib @@ -557,7 +557,10 @@ let inline eval let rsCode = if cached then rsCode - else rsCode |> SpiralSm.replace "),);" "));" + else + rsCode + |> SpiralSm.replace "),);" "));" + |> SpiralSm.replace "get_or_insert_with" "get_or_init" if printCode then _trace (fun () -> $".rs:\n{rsCode}") @@ -577,7 +580,7 @@ edition = "2021" [workspace] [dependencies] -fable_library_rust = {{ path = "fable_modules/fable-library-rust", optional = true, default-features = false, features = ["static_do_bindings"] }} +fable_library_rust = {{ path = "fable_modules/fable-library-rust", default-features = false, features = ["static_do_bindings", "datetime", "threaded"] }} clap = "~4.5" inline_colorization = "~0.1" num-complex = "~0.4" @@ -588,9 +591,6 @@ futures-lite = "~2.3" async-walkdir = "~1.0" rayon = "~1.10" -[features] -default = ["fable_library_rust/default", "fable_library_rust/static_do_bindings"] - [[bin]] name = "{hash}" path = "{hash}.rs" diff --git a/apps/spiral/Eval.fs b/apps/spiral/Eval.fs index 08f28a5e..4b98f0e3 100644 --- a/apps/spiral/Eval.fs +++ b/apps/spiral/Eval.fs @@ -490,7 +490,10 @@ module Eval = let rsCode = if cached then rsCode - else rsCode |> SpiralSm.replace "),);" "));" + else + rsCode + |> SpiralSm.replace "),);" "));" + |> SpiralSm.replace "get_or_insert_with" "get_or_init" if printCode then _trace (fun () -> $".rs:\n{rsCode}") @@ -510,7 +513,7 @@ edition = "2021" [workspace] [dependencies] -fable_library_rust = {{ path = "fable_modules/fable-library-rust", optional = true, default-features = false, features = ["static_do_bindings"] }} +fable_library_rust = {{ path = "fable_modules/fable-library-rust", default-features = false, features = ["static_do_bindings", "datetime", "threaded"] }} clap = "~4.5" inline_colorization = "~0.1" num-complex = "~0.4" @@ -521,9 +524,6 @@ futures-lite = "~2.3" async-walkdir = "~1.0" rayon = "~1.10" -[features] -default = ["fable_library_rust/default", "fable_library_rust/static_do_bindings"] - [[bin]] name = "{hash}" path = "{hash}.rs" diff --git a/lib/spiral/benchmark.dib b/lib/spiral/benchmark.dib index 339d4bc7..4fa7f7ca 100644 --- a/lib/spiral/benchmark.dib +++ b/lib/spiral/benchmark.dib @@ -192,7 +192,7 @@ inl sort_result_list results = row |> listm'.indexed |> listm.map fun (i, cell) => - cell |> sm'.pad_right (lengthMap |> mapm.item i |> conv) + cell |> sm'.pad_right (lengthMap |> mapm.item i |> conv) ' ' |> listm.toArray newRow, color diff --git a/lib/spiral/benchmark.spi b/lib/spiral/benchmark.spi index 8957076c..2d9ea760 100644 --- a/lib/spiral/benchmark.spi +++ b/lib/spiral/benchmark.spi @@ -155,7 +155,7 @@ inl sort_result_list results = row |> listm'.indexed |> listm.map fun (i, cell) => - cell |> sm'.pad_right (lengthMap |> mapm.item i |> conv) + cell |> sm'.pad_right (lengthMap |> mapm.item i |> conv) ' ' |> listm.toArray newRow, color diff --git a/lib/spiral/common.fsx b/lib/spiral/common.fsx index 04a4a679..7cfb589f 100644 --- a/lib/spiral/common.fsx +++ b/lib/spiral/common.fsx @@ -284,128 +284,129 @@ and closure11 (v0 : US0, v1 : (unit -> string), v2 : (unit -> string)) () : stri let v66 : string = "Warning" v66 let v73 : string = v72.ToLower () - let v74 : string option = None - let v75 : bool = true in let mutable _v74 = v74 + let v74 : string = v73.PadRight (7, ' ') + let v75 : string option = None + let v76 : bool = true in let mutable _v75 = v75 #if FABLE_COMPILER_RUST && !WASM && !CONTRACT - let v90 : Ref = + let v91 : Ref = match v0 with | US0_4 -> (* Critical *) - let v84 : string = "inline_colorization::color_bright_red" - let v85 : Ref = Fable.Core.RustInterop.emitRustExpr () v84 - v85 + let v85 : string = "inline_colorization::color_bright_red" + let v86 : Ref = Fable.Core.RustInterop.emitRustExpr () v85 + v86 | US0_1 -> (* Debug *) - let v78 : string = "inline_colorization::color_bright_blue" - let v79 : Ref = Fable.Core.RustInterop.emitRustExpr () v78 - v79 + let v79 : string = "inline_colorization::color_bright_blue" + let v80 : Ref = Fable.Core.RustInterop.emitRustExpr () v79 + v80 | US0_2 -> (* Info *) - let v80 : string = "inline_colorization::color_bright_green" - let v81 : Ref = Fable.Core.RustInterop.emitRustExpr () v80 - v81 + let v81 : string = "inline_colorization::color_bright_green" + let v82 : Ref = Fable.Core.RustInterop.emitRustExpr () v81 + v82 | US0_0 -> (* Verbose *) - let v76 : string = "inline_colorization::color_bright_black" - let v77 : Ref = Fable.Core.RustInterop.emitRustExpr () v76 - v77 + let v77 : string = "inline_colorization::color_bright_black" + let v78 : Ref = Fable.Core.RustInterop.emitRustExpr () v77 + v78 | US0_3 -> (* Warning *) - let v82 : string = "inline_colorization::color_bright_yellow" - let v83 : Ref = Fable.Core.RustInterop.emitRustExpr () v82 - v83 - let v91 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v92 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v91 - let v93 : string = "inline_colorization::color_reset" - let v94 : Ref = Fable.Core.RustInterop.emitRustExpr () v93 - let v95 : string = "\"{v90}{v92}{v94}\"" - let v96 : string = @$"format!(" + v95 + ")" - let v97 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v96 - let v98 : string = "fable_library_rust::String_::fromString($0)" - let v99 : string = Fable.Core.RustInterop.emitRustExpr v97 v98 - v99 + let v83 : string = "inline_colorization::color_bright_yellow" + let v84 : Ref = Fable.Core.RustInterop.emitRustExpr () v83 + v84 + let v92 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v93 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v92 + let v94 : string = "inline_colorization::color_reset" + let v95 : Ref = Fable.Core.RustInterop.emitRustExpr () v94 + let v96 : string = "\"{v91}{v93}{v95}\"" + let v97 : string = @$"format!(" + v96 + ")" + let v98 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v97 + let v99 : string = "fable_library_rust::String_::fromString($0)" + let v100 : string = Fable.Core.RustInterop.emitRustExpr v98 v99 + v100 #endif #if FABLE_COMPILER_RUST && WASM - let v114 : Ref = + let v115 : Ref = match v0 with | US0_4 -> (* Critical *) - let v108 : string = "inline_colorization::color_bright_red" - let v109 : Ref = Fable.Core.RustInterop.emitRustExpr () v108 - v109 + let v109 : string = "inline_colorization::color_bright_red" + let v110 : Ref = Fable.Core.RustInterop.emitRustExpr () v109 + v110 | US0_1 -> (* Debug *) - let v102 : string = "inline_colorization::color_bright_blue" - let v103 : Ref = Fable.Core.RustInterop.emitRustExpr () v102 - v103 + let v103 : string = "inline_colorization::color_bright_blue" + let v104 : Ref = Fable.Core.RustInterop.emitRustExpr () v103 + v104 | US0_2 -> (* Info *) - let v104 : string = "inline_colorization::color_bright_green" - let v105 : Ref = Fable.Core.RustInterop.emitRustExpr () v104 - v105 + let v105 : string = "inline_colorization::color_bright_green" + let v106 : Ref = Fable.Core.RustInterop.emitRustExpr () v105 + v106 | US0_0 -> (* Verbose *) - let v100 : string = "inline_colorization::color_bright_black" - let v101 : Ref = Fable.Core.RustInterop.emitRustExpr () v100 - v101 + let v101 : string = "inline_colorization::color_bright_black" + let v102 : Ref = Fable.Core.RustInterop.emitRustExpr () v101 + v102 | US0_3 -> (* Warning *) - let v106 : string = "inline_colorization::color_bright_yellow" - let v107 : Ref = Fable.Core.RustInterop.emitRustExpr () v106 - v107 - let v115 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v116 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v115 - let v117 : string = "inline_colorization::color_reset" - let v118 : Ref = Fable.Core.RustInterop.emitRustExpr () v117 - let v119 : string = "\"{v114}{v116}{v118}\"" - let v120 : string = @$"format!(" + v119 + ")" - let v121 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v120 - let v122 : string = "fable_library_rust::String_::fromString($0)" - let v123 : string = Fable.Core.RustInterop.emitRustExpr v121 v122 - v123 + let v107 : string = "inline_colorization::color_bright_yellow" + let v108 : Ref = Fable.Core.RustInterop.emitRustExpr () v107 + v108 + let v116 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v117 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v116 + let v118 : string = "inline_colorization::color_reset" + let v119 : Ref = Fable.Core.RustInterop.emitRustExpr () v118 + let v120 : string = "\"{v115}{v117}{v119}\"" + let v121 : string = @$"format!(" + v120 + ")" + let v122 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v121 + let v123 : string = "fable_library_rust::String_::fromString($0)" + let v124 : string = Fable.Core.RustInterop.emitRustExpr v122 v123 + v124 #endif #if FABLE_COMPILER_RUST && CONTRACT - let v138 : Ref = + let v139 : Ref = match v0 with | US0_4 -> (* Critical *) - let v132 : string = "inline_colorization::color_bright_red" - let v133 : Ref = Fable.Core.RustInterop.emitRustExpr () v132 - v133 + let v133 : string = "inline_colorization::color_bright_red" + let v134 : Ref = Fable.Core.RustInterop.emitRustExpr () v133 + v134 | US0_1 -> (* Debug *) - let v126 : string = "inline_colorization::color_bright_blue" - let v127 : Ref = Fable.Core.RustInterop.emitRustExpr () v126 - v127 + let v127 : string = "inline_colorization::color_bright_blue" + let v128 : Ref = Fable.Core.RustInterop.emitRustExpr () v127 + v128 | US0_2 -> (* Info *) - let v128 : string = "inline_colorization::color_bright_green" - let v129 : Ref = Fable.Core.RustInterop.emitRustExpr () v128 - v129 + let v129 : string = "inline_colorization::color_bright_green" + let v130 : Ref = Fable.Core.RustInterop.emitRustExpr () v129 + v130 | US0_0 -> (* Verbose *) - let v124 : string = "inline_colorization::color_bright_black" - let v125 : Ref = Fable.Core.RustInterop.emitRustExpr () v124 - v125 + let v125 : string = "inline_colorization::color_bright_black" + let v126 : Ref = Fable.Core.RustInterop.emitRustExpr () v125 + v126 | US0_3 -> (* Warning *) - let v130 : string = "inline_colorization::color_bright_yellow" - let v131 : Ref = Fable.Core.RustInterop.emitRustExpr () v130 - v131 - let v139 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v140 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v139 - let v141 : string = "inline_colorization::color_reset" - let v142 : Ref = Fable.Core.RustInterop.emitRustExpr () v141 - let v143 : string = "\"{v138}{v140}{v142}\"" - let v144 : string = @$"format!(" + v143 + ")" - let v145 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v144 - let v146 : string = "fable_library_rust::String_::fromString($0)" - let v147 : string = Fable.Core.RustInterop.emitRustExpr v145 v146 - v147 + let v131 : string = "inline_colorization::color_bright_yellow" + let v132 : Ref = Fable.Core.RustInterop.emitRustExpr () v131 + v132 + let v140 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v141 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v140 + let v142 : string = "inline_colorization::color_reset" + let v143 : Ref = Fable.Core.RustInterop.emitRustExpr () v142 + let v144 : string = "\"{v139}{v141}{v143}\"" + let v145 : string = @$"format!(" + v144 + ")" + let v146 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v145 + let v147 : string = "fable_library_rust::String_::fromString($0)" + let v148 : string = Fable.Core.RustInterop.emitRustExpr v146 v147 + v148 #endif #if !FABLE_COMPILER && !FABLE_COMPILER_RUST && !FABLE_COMPILER_TYPESCRIPT && !WASM && !CONTRACT - v73 + v74 #endif #if FABLE_COMPILER_TYPESCRIPT - v73 + v74 #endif #if FABLE_COMPILER_PYTHON || FABLE_COMPILER_PHP || FABLE_COMPILER_DART - let v148 : string = Unchecked.defaultof - v148 -#endif - |> fun x -> _v74 <- Some x - let v149 : string = _v74.Value - let v150 : string = $"{v61} {v149} #{v62} %s{v1 ()} / %s{v2 ()}" - let v151 : (char []) = [||] - let v152 : string = v150.TrimStart v151 - let v153 : (char []) = [|' '; '/'|] - let v154 : string = v152.TrimEnd v153 - v154 + let v149 : string = Unchecked.defaultof + v149 +#endif + |> fun x -> _v75 <- Some x + let v150 : string = _v75.Value + let v151 : string = $"{v61} {v150} #{v62} %s{v1 ()} / %s{v2 ()}" + let v152 : (char []) = [||] + let v153 : string = v151.TrimStart v152 + let v154 : (char []) = [|' '; '/'|] + let v155 : string = v153.TrimEnd v154 + v155 and method6 (v0 : US0, v1 : (unit -> string)) : unit = let v2 : (unit -> struct (Mut0 * Mut1 * Mut2 * int64 option * Mut3)) = closure0() if State.trace_state.IsNone then State.trace_state <- v2 () |> Some diff --git a/lib/spiral/common.rs b/lib/spiral/common.rs index 9c087b82..6254f3e2 100644 --- a/lib/spiral/common.rs +++ b/lib/spiral/common.rs @@ -22,6 +22,7 @@ pub mod Common { use fable_library_rust::Option_::getValue; use fable_library_rust::Option_::map; use fable_library_rust::Seq_::ofList; + use fable_library_rust::String_::padRight; use fable_library_rust::String_::sprintf; use fable_library_rust::String_::string; use fable_library_rust::String_::toLower; @@ -396,35 +397,39 @@ pub mod Common { { let v61: string = getValue(_v9.get().clone()); let v62: i64 = (patternInput.0.clone()).l0.get().clone(); - let v73: string = toLower(match &v0_1 { - Common::US0::US0_1 => string("Debug"), - Common::US0::US0_2 => string("Info"), - Common::US0::US0_0 => string("Verbose"), - Common::US0::US0_3 => string("Warning"), - _ => string("Critical"), - }); - let _v74: MutCell> = MutCell::new(None::); - let v90: &str = match &v0_1 { + let v74: string = padRight( + toLower(match &v0_1 { + Common::US0::US0_1 => string("Debug"), + Common::US0::US0_2 => string("Info"), + Common::US0::US0_0 => string("Verbose"), + Common::US0::US0_3 => string("Warning"), + _ => string("Critical"), + }), + 7_i32, + ' ', + ); + let _v75: MutCell> = MutCell::new(None::); + let v91: &str = match &v0_1 { Common::US0::US0_1 => inline_colorization::color_bright_blue, Common::US0::US0_2 => inline_colorization::color_bright_green, Common::US0::US0_0 => inline_colorization::color_bright_black, Common::US0::US0_3 => inline_colorization::color_bright_yellow, _ => inline_colorization::color_bright_red, }; - let v92: &str = fable_library_rust::String_::LrcStr::as_str(&v73); - let v94: &str = inline_colorization::color_reset; - let v96: string = string("format!(\"{v90}{v92}{v94}\")"); - let v97: std::string::String = format!("{v90}{v92}{v94}"); + let v93: &str = fable_library_rust::String_::LrcStr::as_str(&v74); + let v95: &str = inline_colorization::color_reset; + let v97: string = string("format!(\"{v91}{v93}{v95}\")"); + let v98: std::string::String = format!("{v91}{v93}{v95}"); { - let x_1: string = fable_library_rust::String_::fromString(v97); - _v74.set(Some(x_1)) + let x_1: string = fable_library_rust::String_::fromString(v98); + _v75.set(Some(x_1)) } trimEndChars( trimStartChars( sprintf!( "{} {} #{} {} / {}", v61, - getValue(_v74.get().clone()), + getValue(_v75.get().clone()), v62, v1_1(), v2_1() diff --git a/lib/spiral/file_system.fsx b/lib/spiral/file_system.fsx index 37860772..7597519a 100644 --- a/lib/spiral/file_system.fsx +++ b/lib/spiral/file_system.fsx @@ -303,128 +303,129 @@ and closure7 (v0 : US0, v1 : (unit -> string), v2 : (unit -> string)) () : strin let v66 : string = "Warning" v66 let v73 : string = v72.ToLower () - let v74 : string option = None - let v75 : bool = true in let mutable _v74 = v74 + let v74 : string = v73.PadRight (7, ' ') + let v75 : string option = None + let v76 : bool = true in let mutable _v75 = v75 #if FABLE_COMPILER_RUST && !WASM && !CONTRACT - let v90 : Ref = + let v91 : Ref = match v0 with | US0_4 -> (* Critical *) - let v84 : string = "inline_colorization::color_bright_red" - let v85 : Ref = Fable.Core.RustInterop.emitRustExpr () v84 - v85 + let v85 : string = "inline_colorization::color_bright_red" + let v86 : Ref = Fable.Core.RustInterop.emitRustExpr () v85 + v86 | US0_1 -> (* Debug *) - let v78 : string = "inline_colorization::color_bright_blue" - let v79 : Ref = Fable.Core.RustInterop.emitRustExpr () v78 - v79 + let v79 : string = "inline_colorization::color_bright_blue" + let v80 : Ref = Fable.Core.RustInterop.emitRustExpr () v79 + v80 | US0_2 -> (* Info *) - let v80 : string = "inline_colorization::color_bright_green" - let v81 : Ref = Fable.Core.RustInterop.emitRustExpr () v80 - v81 + let v81 : string = "inline_colorization::color_bright_green" + let v82 : Ref = Fable.Core.RustInterop.emitRustExpr () v81 + v82 | US0_0 -> (* Verbose *) - let v76 : string = "inline_colorization::color_bright_black" - let v77 : Ref = Fable.Core.RustInterop.emitRustExpr () v76 - v77 + let v77 : string = "inline_colorization::color_bright_black" + let v78 : Ref = Fable.Core.RustInterop.emitRustExpr () v77 + v78 | US0_3 -> (* Warning *) - let v82 : string = "inline_colorization::color_bright_yellow" - let v83 : Ref = Fable.Core.RustInterop.emitRustExpr () v82 - v83 - let v91 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v92 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v91 - let v93 : string = "inline_colorization::color_reset" - let v94 : Ref = Fable.Core.RustInterop.emitRustExpr () v93 - let v95 : string = "\"{v90}{v92}{v94}\"" - let v96 : string = @$"format!(" + v95 + ")" - let v97 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v96 - let v98 : string = "fable_library_rust::String_::fromString($0)" - let v99 : string = Fable.Core.RustInterop.emitRustExpr v97 v98 - v99 + let v83 : string = "inline_colorization::color_bright_yellow" + let v84 : Ref = Fable.Core.RustInterop.emitRustExpr () v83 + v84 + let v92 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v93 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v92 + let v94 : string = "inline_colorization::color_reset" + let v95 : Ref = Fable.Core.RustInterop.emitRustExpr () v94 + let v96 : string = "\"{v91}{v93}{v95}\"" + let v97 : string = @$"format!(" + v96 + ")" + let v98 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v97 + let v99 : string = "fable_library_rust::String_::fromString($0)" + let v100 : string = Fable.Core.RustInterop.emitRustExpr v98 v99 + v100 #endif #if FABLE_COMPILER_RUST && WASM - let v114 : Ref = + let v115 : Ref = match v0 with | US0_4 -> (* Critical *) - let v108 : string = "inline_colorization::color_bright_red" - let v109 : Ref = Fable.Core.RustInterop.emitRustExpr () v108 - v109 + let v109 : string = "inline_colorization::color_bright_red" + let v110 : Ref = Fable.Core.RustInterop.emitRustExpr () v109 + v110 | US0_1 -> (* Debug *) - let v102 : string = "inline_colorization::color_bright_blue" - let v103 : Ref = Fable.Core.RustInterop.emitRustExpr () v102 - v103 + let v103 : string = "inline_colorization::color_bright_blue" + let v104 : Ref = Fable.Core.RustInterop.emitRustExpr () v103 + v104 | US0_2 -> (* Info *) - let v104 : string = "inline_colorization::color_bright_green" - let v105 : Ref = Fable.Core.RustInterop.emitRustExpr () v104 - v105 + let v105 : string = "inline_colorization::color_bright_green" + let v106 : Ref = Fable.Core.RustInterop.emitRustExpr () v105 + v106 | US0_0 -> (* Verbose *) - let v100 : string = "inline_colorization::color_bright_black" - let v101 : Ref = Fable.Core.RustInterop.emitRustExpr () v100 - v101 + let v101 : string = "inline_colorization::color_bright_black" + let v102 : Ref = Fable.Core.RustInterop.emitRustExpr () v101 + v102 | US0_3 -> (* Warning *) - let v106 : string = "inline_colorization::color_bright_yellow" - let v107 : Ref = Fable.Core.RustInterop.emitRustExpr () v106 - v107 - let v115 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v116 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v115 - let v117 : string = "inline_colorization::color_reset" - let v118 : Ref = Fable.Core.RustInterop.emitRustExpr () v117 - let v119 : string = "\"{v114}{v116}{v118}\"" - let v120 : string = @$"format!(" + v119 + ")" - let v121 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v120 - let v122 : string = "fable_library_rust::String_::fromString($0)" - let v123 : string = Fable.Core.RustInterop.emitRustExpr v121 v122 - v123 + let v107 : string = "inline_colorization::color_bright_yellow" + let v108 : Ref = Fable.Core.RustInterop.emitRustExpr () v107 + v108 + let v116 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v117 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v116 + let v118 : string = "inline_colorization::color_reset" + let v119 : Ref = Fable.Core.RustInterop.emitRustExpr () v118 + let v120 : string = "\"{v115}{v117}{v119}\"" + let v121 : string = @$"format!(" + v120 + ")" + let v122 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v121 + let v123 : string = "fable_library_rust::String_::fromString($0)" + let v124 : string = Fable.Core.RustInterop.emitRustExpr v122 v123 + v124 #endif #if FABLE_COMPILER_RUST && CONTRACT - let v138 : Ref = + let v139 : Ref = match v0 with | US0_4 -> (* Critical *) - let v132 : string = "inline_colorization::color_bright_red" - let v133 : Ref = Fable.Core.RustInterop.emitRustExpr () v132 - v133 + let v133 : string = "inline_colorization::color_bright_red" + let v134 : Ref = Fable.Core.RustInterop.emitRustExpr () v133 + v134 | US0_1 -> (* Debug *) - let v126 : string = "inline_colorization::color_bright_blue" - let v127 : Ref = Fable.Core.RustInterop.emitRustExpr () v126 - v127 + let v127 : string = "inline_colorization::color_bright_blue" + let v128 : Ref = Fable.Core.RustInterop.emitRustExpr () v127 + v128 | US0_2 -> (* Info *) - let v128 : string = "inline_colorization::color_bright_green" - let v129 : Ref = Fable.Core.RustInterop.emitRustExpr () v128 - v129 + let v129 : string = "inline_colorization::color_bright_green" + let v130 : Ref = Fable.Core.RustInterop.emitRustExpr () v129 + v130 | US0_0 -> (* Verbose *) - let v124 : string = "inline_colorization::color_bright_black" - let v125 : Ref = Fable.Core.RustInterop.emitRustExpr () v124 - v125 + let v125 : string = "inline_colorization::color_bright_black" + let v126 : Ref = Fable.Core.RustInterop.emitRustExpr () v125 + v126 | US0_3 -> (* Warning *) - let v130 : string = "inline_colorization::color_bright_yellow" - let v131 : Ref = Fable.Core.RustInterop.emitRustExpr () v130 - v131 - let v139 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v140 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v139 - let v141 : string = "inline_colorization::color_reset" - let v142 : Ref = Fable.Core.RustInterop.emitRustExpr () v141 - let v143 : string = "\"{v138}{v140}{v142}\"" - let v144 : string = @$"format!(" + v143 + ")" - let v145 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v144 - let v146 : string = "fable_library_rust::String_::fromString($0)" - let v147 : string = Fable.Core.RustInterop.emitRustExpr v145 v146 - v147 + let v131 : string = "inline_colorization::color_bright_yellow" + let v132 : Ref = Fable.Core.RustInterop.emitRustExpr () v131 + v132 + let v140 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v141 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v140 + let v142 : string = "inline_colorization::color_reset" + let v143 : Ref = Fable.Core.RustInterop.emitRustExpr () v142 + let v144 : string = "\"{v139}{v141}{v143}\"" + let v145 : string = @$"format!(" + v144 + ")" + let v146 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v145 + let v147 : string = "fable_library_rust::String_::fromString($0)" + let v148 : string = Fable.Core.RustInterop.emitRustExpr v146 v147 + v148 #endif #if !FABLE_COMPILER && !FABLE_COMPILER_RUST && !FABLE_COMPILER_TYPESCRIPT && !WASM && !CONTRACT - v73 + v74 #endif #if FABLE_COMPILER_TYPESCRIPT - v73 + v74 #endif #if FABLE_COMPILER_PYTHON || FABLE_COMPILER_PHP || FABLE_COMPILER_DART - let v148 : string = Unchecked.defaultof - v148 -#endif - |> fun x -> _v74 <- Some x - let v149 : string = _v74.Value - let v150 : string = $"{v61} {v149} #{v62} %s{v1 ()} / %s{v2 ()}" - let v151 : (char []) = [||] - let v152 : string = v150.TrimStart v151 - let v153 : (char []) = [|' '; '/'|] - let v154 : string = v152.TrimEnd v153 - v154 + let v149 : string = Unchecked.defaultof + v149 +#endif + |> fun x -> _v75 <- Some x + let v150 : string = _v75.Value + let v151 : string = $"{v61} {v150} #{v62} %s{v1 ()} / %s{v2 ()}" + let v152 : (char []) = [||] + let v153 : string = v151.TrimStart v152 + let v154 : (char []) = [|' '; '/'|] + let v155 : string = v153.TrimEnd v154 + v155 and method6 (v0 : US0, v1 : (unit -> string)) : unit = let v2 : (unit -> struct (Mut0 * Mut1 * Mut2 * int64 option * Mut3)) = closure0() if State.trace_state.IsNone then State.trace_state <- v2 () |> Some diff --git a/lib/spiral/file_system.rs b/lib/spiral/file_system.rs index 2124578e..80862832 100644 --- a/lib/spiral/file_system.rs +++ b/lib/spiral/file_system.rs @@ -25,6 +25,7 @@ pub mod File_system { use fable_library_rust::Seq_::ofList; use fable_library_rust::String_::getCharAt; use fable_library_rust::String_::getSlice; + use fable_library_rust::String_::padRight; use fable_library_rust::String_::replace; use fable_library_rust::String_::sprintf; use fable_library_rust::String_::string; @@ -549,35 +550,39 @@ pub mod File_system { { let v61: string = getValue(_v9.get().clone()); let v62: i64 = (patternInput.0.clone()).l0.get().clone(); - let v73: string = toLower(match &v0_1 { - File_system::US0::US0_1 => string("Debug"), - File_system::US0::US0_2 => string("Info"), - File_system::US0::US0_0 => string("Verbose"), - File_system::US0::US0_3 => string("Warning"), - _ => string("Critical"), - }); - let _v74: MutCell> = MutCell::new(None::); - let v90: &str = match &v0_1 { + let v74: string = padRight( + toLower(match &v0_1 { + File_system::US0::US0_1 => string("Debug"), + File_system::US0::US0_2 => string("Info"), + File_system::US0::US0_0 => string("Verbose"), + File_system::US0::US0_3 => string("Warning"), + _ => string("Critical"), + }), + 7_i32, + ' ', + ); + let _v75: MutCell> = MutCell::new(None::); + let v91: &str = match &v0_1 { File_system::US0::US0_1 => inline_colorization::color_bright_blue, File_system::US0::US0_2 => inline_colorization::color_bright_green, File_system::US0::US0_0 => inline_colorization::color_bright_black, File_system::US0::US0_3 => inline_colorization::color_bright_yellow, _ => inline_colorization::color_bright_red, }; - let v92: &str = fable_library_rust::String_::LrcStr::as_str(&v73); - let v94: &str = inline_colorization::color_reset; - let v96: string = string("format!(\"{v90}{v92}{v94}\")"); - let v97: std::string::String = format!("{v90}{v92}{v94}"); + let v93: &str = fable_library_rust::String_::LrcStr::as_str(&v74); + let v95: &str = inline_colorization::color_reset; + let v97: string = string("format!(\"{v91}{v93}{v95}\")"); + let v98: std::string::String = format!("{v91}{v93}{v95}"); { - let x_1: string = fable_library_rust::String_::fromString(v97); - _v74.set(Some(x_1)) + let x_1: string = fable_library_rust::String_::fromString(v98); + _v75.set(Some(x_1)) } trimEndChars( trimStartChars( sprintf!( "{} {} #{} {} / {}", v61, - getValue(_v74.get().clone()), + getValue(_v75.get().clone()), v62, v1_1(), v2_1() diff --git a/lib/spiral/networking.fsx b/lib/spiral/networking.fsx index 470759ed..0a602e3d 100644 --- a/lib/spiral/networking.fsx +++ b/lib/spiral/networking.fsx @@ -250,128 +250,129 @@ and closure5 (v0 : US0, v1 : (unit -> string), v2 : (unit -> string)) () : strin let v66 : string = "Warning" v66 let v73 : string = v72.ToLower () - let v74 : string option = None - let v75 : bool = true in let mutable _v74 = v74 + let v74 : string = v73.PadRight (7, ' ') + let v75 : string option = None + let v76 : bool = true in let mutable _v75 = v75 #if FABLE_COMPILER_RUST && !WASM && !CONTRACT - let v90 : Ref = + let v91 : Ref = match v0 with | US0_4 -> (* Critical *) - let v84 : string = "inline_colorization::color_bright_red" - let v85 : Ref = Fable.Core.RustInterop.emitRustExpr () v84 - v85 + let v85 : string = "inline_colorization::color_bright_red" + let v86 : Ref = Fable.Core.RustInterop.emitRustExpr () v85 + v86 | US0_1 -> (* Debug *) - let v78 : string = "inline_colorization::color_bright_blue" - let v79 : Ref = Fable.Core.RustInterop.emitRustExpr () v78 - v79 + let v79 : string = "inline_colorization::color_bright_blue" + let v80 : Ref = Fable.Core.RustInterop.emitRustExpr () v79 + v80 | US0_2 -> (* Info *) - let v80 : string = "inline_colorization::color_bright_green" - let v81 : Ref = Fable.Core.RustInterop.emitRustExpr () v80 - v81 + let v81 : string = "inline_colorization::color_bright_green" + let v82 : Ref = Fable.Core.RustInterop.emitRustExpr () v81 + v82 | US0_0 -> (* Verbose *) - let v76 : string = "inline_colorization::color_bright_black" - let v77 : Ref = Fable.Core.RustInterop.emitRustExpr () v76 - v77 + let v77 : string = "inline_colorization::color_bright_black" + let v78 : Ref = Fable.Core.RustInterop.emitRustExpr () v77 + v78 | US0_3 -> (* Warning *) - let v82 : string = "inline_colorization::color_bright_yellow" - let v83 : Ref = Fable.Core.RustInterop.emitRustExpr () v82 - v83 - let v91 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v92 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v91 - let v93 : string = "inline_colorization::color_reset" - let v94 : Ref = Fable.Core.RustInterop.emitRustExpr () v93 - let v95 : string = "\"{v90}{v92}{v94}\"" - let v96 : string = @$"format!(" + v95 + ")" - let v97 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v96 - let v98 : string = "fable_library_rust::String_::fromString($0)" - let v99 : string = Fable.Core.RustInterop.emitRustExpr v97 v98 - v99 + let v83 : string = "inline_colorization::color_bright_yellow" + let v84 : Ref = Fable.Core.RustInterop.emitRustExpr () v83 + v84 + let v92 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v93 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v92 + let v94 : string = "inline_colorization::color_reset" + let v95 : Ref = Fable.Core.RustInterop.emitRustExpr () v94 + let v96 : string = "\"{v91}{v93}{v95}\"" + let v97 : string = @$"format!(" + v96 + ")" + let v98 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v97 + let v99 : string = "fable_library_rust::String_::fromString($0)" + let v100 : string = Fable.Core.RustInterop.emitRustExpr v98 v99 + v100 #endif #if FABLE_COMPILER_RUST && WASM - let v114 : Ref = + let v115 : Ref = match v0 with | US0_4 -> (* Critical *) - let v108 : string = "inline_colorization::color_bright_red" - let v109 : Ref = Fable.Core.RustInterop.emitRustExpr () v108 - v109 + let v109 : string = "inline_colorization::color_bright_red" + let v110 : Ref = Fable.Core.RustInterop.emitRustExpr () v109 + v110 | US0_1 -> (* Debug *) - let v102 : string = "inline_colorization::color_bright_blue" - let v103 : Ref = Fable.Core.RustInterop.emitRustExpr () v102 - v103 + let v103 : string = "inline_colorization::color_bright_blue" + let v104 : Ref = Fable.Core.RustInterop.emitRustExpr () v103 + v104 | US0_2 -> (* Info *) - let v104 : string = "inline_colorization::color_bright_green" - let v105 : Ref = Fable.Core.RustInterop.emitRustExpr () v104 - v105 + let v105 : string = "inline_colorization::color_bright_green" + let v106 : Ref = Fable.Core.RustInterop.emitRustExpr () v105 + v106 | US0_0 -> (* Verbose *) - let v100 : string = "inline_colorization::color_bright_black" - let v101 : Ref = Fable.Core.RustInterop.emitRustExpr () v100 - v101 + let v101 : string = "inline_colorization::color_bright_black" + let v102 : Ref = Fable.Core.RustInterop.emitRustExpr () v101 + v102 | US0_3 -> (* Warning *) - let v106 : string = "inline_colorization::color_bright_yellow" - let v107 : Ref = Fable.Core.RustInterop.emitRustExpr () v106 - v107 - let v115 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v116 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v115 - let v117 : string = "inline_colorization::color_reset" - let v118 : Ref = Fable.Core.RustInterop.emitRustExpr () v117 - let v119 : string = "\"{v114}{v116}{v118}\"" - let v120 : string = @$"format!(" + v119 + ")" - let v121 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v120 - let v122 : string = "fable_library_rust::String_::fromString($0)" - let v123 : string = Fable.Core.RustInterop.emitRustExpr v121 v122 - v123 + let v107 : string = "inline_colorization::color_bright_yellow" + let v108 : Ref = Fable.Core.RustInterop.emitRustExpr () v107 + v108 + let v116 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v117 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v116 + let v118 : string = "inline_colorization::color_reset" + let v119 : Ref = Fable.Core.RustInterop.emitRustExpr () v118 + let v120 : string = "\"{v115}{v117}{v119}\"" + let v121 : string = @$"format!(" + v120 + ")" + let v122 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v121 + let v123 : string = "fable_library_rust::String_::fromString($0)" + let v124 : string = Fable.Core.RustInterop.emitRustExpr v122 v123 + v124 #endif #if FABLE_COMPILER_RUST && CONTRACT - let v138 : Ref = + let v139 : Ref = match v0 with | US0_4 -> (* Critical *) - let v132 : string = "inline_colorization::color_bright_red" - let v133 : Ref = Fable.Core.RustInterop.emitRustExpr () v132 - v133 + let v133 : string = "inline_colorization::color_bright_red" + let v134 : Ref = Fable.Core.RustInterop.emitRustExpr () v133 + v134 | US0_1 -> (* Debug *) - let v126 : string = "inline_colorization::color_bright_blue" - let v127 : Ref = Fable.Core.RustInterop.emitRustExpr () v126 - v127 + let v127 : string = "inline_colorization::color_bright_blue" + let v128 : Ref = Fable.Core.RustInterop.emitRustExpr () v127 + v128 | US0_2 -> (* Info *) - let v128 : string = "inline_colorization::color_bright_green" - let v129 : Ref = Fable.Core.RustInterop.emitRustExpr () v128 - v129 + let v129 : string = "inline_colorization::color_bright_green" + let v130 : Ref = Fable.Core.RustInterop.emitRustExpr () v129 + v130 | US0_0 -> (* Verbose *) - let v124 : string = "inline_colorization::color_bright_black" - let v125 : Ref = Fable.Core.RustInterop.emitRustExpr () v124 - v125 + let v125 : string = "inline_colorization::color_bright_black" + let v126 : Ref = Fable.Core.RustInterop.emitRustExpr () v125 + v126 | US0_3 -> (* Warning *) - let v130 : string = "inline_colorization::color_bright_yellow" - let v131 : Ref = Fable.Core.RustInterop.emitRustExpr () v130 - v131 - let v139 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v140 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v139 - let v141 : string = "inline_colorization::color_reset" - let v142 : Ref = Fable.Core.RustInterop.emitRustExpr () v141 - let v143 : string = "\"{v138}{v140}{v142}\"" - let v144 : string = @$"format!(" + v143 + ")" - let v145 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v144 - let v146 : string = "fable_library_rust::String_::fromString($0)" - let v147 : string = Fable.Core.RustInterop.emitRustExpr v145 v146 - v147 + let v131 : string = "inline_colorization::color_bright_yellow" + let v132 : Ref = Fable.Core.RustInterop.emitRustExpr () v131 + v132 + let v140 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v141 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v140 + let v142 : string = "inline_colorization::color_reset" + let v143 : Ref = Fable.Core.RustInterop.emitRustExpr () v142 + let v144 : string = "\"{v139}{v141}{v143}\"" + let v145 : string = @$"format!(" + v144 + ")" + let v146 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v145 + let v147 : string = "fable_library_rust::String_::fromString($0)" + let v148 : string = Fable.Core.RustInterop.emitRustExpr v146 v147 + v148 #endif #if !FABLE_COMPILER && !FABLE_COMPILER_RUST && !FABLE_COMPILER_TYPESCRIPT && !WASM && !CONTRACT - v73 + v74 #endif #if FABLE_COMPILER_TYPESCRIPT - v73 + v74 #endif #if FABLE_COMPILER_PYTHON || FABLE_COMPILER_PHP || FABLE_COMPILER_DART - let v148 : string = Unchecked.defaultof - v148 -#endif - |> fun x -> _v74 <- Some x - let v149 : string = _v74.Value - let v150 : string = $"{v61} {v149} #{v62} %s{v1 ()} / %s{v2 ()}" - let v151 : (char []) = [||] - let v152 : string = v150.TrimStart v151 - let v153 : (char []) = [|' '; '/'|] - let v154 : string = v152.TrimEnd v153 - v154 + let v149 : string = Unchecked.defaultof + v149 +#endif + |> fun x -> _v75 <- Some x + let v150 : string = _v75.Value + let v151 : string = $"{v61} {v150} #{v62} %s{v1 ()} / %s{v2 ()}" + let v152 : (char []) = [||] + let v153 : string = v151.TrimStart v152 + let v154 : (char []) = [|' '; '/'|] + let v155 : string = v153.TrimEnd v154 + v155 and method5 (v0 : US0, v1 : (unit -> string)) : unit = let v2 : (unit -> struct (Mut0 * Mut1 * Mut2 * int64 option * Mut3)) = closure0() if State.trace_state.IsNone then State.trace_state <- v2 () |> Some diff --git a/lib/spiral/networking.rs b/lib/spiral/networking.rs index 0d1732e0..21091a9b 100644 --- a/lib/spiral/networking.rs +++ b/lib/spiral/networking.rs @@ -20,6 +20,7 @@ pub mod Networking { use fable_library_rust::Option_::getValue; use fable_library_rust::Option_::map; use fable_library_rust::Seq_::ofList; + use fable_library_rust::String_::padRight; use fable_library_rust::String_::sprintf; use fable_library_rust::String_::string; use fable_library_rust::String_::toLower; @@ -415,35 +416,39 @@ pub mod Networking { { let v61: string = getValue(_v9.get().clone()); let v62: i64 = (patternInput.0.clone()).l0.get().clone(); - let v73: string = toLower(match &v0_1 { - Networking::US0::US0_1 => string("Debug"), - Networking::US0::US0_2 => string("Info"), - Networking::US0::US0_0 => string("Verbose"), - Networking::US0::US0_3 => string("Warning"), - _ => string("Critical"), - }); - let _v74: MutCell> = MutCell::new(None::); - let v90: &str = match &v0_1 { + let v74: string = padRight( + toLower(match &v0_1 { + Networking::US0::US0_1 => string("Debug"), + Networking::US0::US0_2 => string("Info"), + Networking::US0::US0_0 => string("Verbose"), + Networking::US0::US0_3 => string("Warning"), + _ => string("Critical"), + }), + 7_i32, + ' ', + ); + let _v75: MutCell> = MutCell::new(None::); + let v91: &str = match &v0_1 { Networking::US0::US0_1 => inline_colorization::color_bright_blue, Networking::US0::US0_2 => inline_colorization::color_bright_green, Networking::US0::US0_0 => inline_colorization::color_bright_black, Networking::US0::US0_3 => inline_colorization::color_bright_yellow, _ => inline_colorization::color_bright_red, }; - let v92: &str = fable_library_rust::String_::LrcStr::as_str(&v73); - let v94: &str = inline_colorization::color_reset; - let v96: string = string("format!(\"{v90}{v92}{v94}\")"); - let v97: std::string::String = format!("{v90}{v92}{v94}"); + let v93: &str = fable_library_rust::String_::LrcStr::as_str(&v74); + let v95: &str = inline_colorization::color_reset; + let v97: string = string("format!(\"{v91}{v93}{v95}\")"); + let v98: std::string::String = format!("{v91}{v93}{v95}"); { - let x_1: string = fable_library_rust::String_::fromString(v97); - _v74.set(Some(x_1)) + let x_1: string = fable_library_rust::String_::fromString(v98); + _v75.set(Some(x_1)) } trimEndChars( trimStartChars( sprintf!( "{} {} #{} {} / {}", v61, - getValue(_v74.get().clone()), + getValue(_v75.get().clone()), v62, v1_1(), v2_1() diff --git a/lib/spiral/runtime.dib b/lib/spiral/runtime.dib index 6a9ffea7..c04ea740 100644 --- a/lib/spiral/runtime.dib +++ b/lib/spiral/runtime.dib @@ -482,6 +482,24 @@ inl arg_required (value : bool) (arg : arg) : arg = #!markdown +## arg_short + +#!spiral + +inl arg_short (value : char) (arg : arg) : arg = + !\\((arg, value), $'"$0.short($1)"') + +#!markdown + +## arg_long + +#!spiral + +inl arg_long (value : rust.static_ref' sm'.str) (arg : arg) : arg = + !\\((arg, value), $'"$0.long($1)"') + +#!markdown + ## arg_index #!spiral diff --git a/lib/spiral/runtime.fsx b/lib/spiral/runtime.fsx index f6f1dca6..a2b09966 100644 --- a/lib/spiral/runtime.fsx +++ b/lib/spiral/runtime.fsx @@ -480,128 +480,129 @@ and closure10 (v0 : US0, v1 : (unit -> string), v2 : (unit -> string)) () : stri let v66 : string = "Warning" v66 let v73 : string = v72.ToLower () - let v74 : string option = None - let v75 : bool = true in let mutable _v74 = v74 + let v74 : string = v73.PadRight (7, ' ') + let v75 : string option = None + let v76 : bool = true in let mutable _v75 = v75 #if FABLE_COMPILER_RUST && !WASM && !CONTRACT - let v90 : Ref = + let v91 : Ref = match v0 with | US0_4 -> (* Critical *) - let v84 : string = "inline_colorization::color_bright_red" - let v85 : Ref = Fable.Core.RustInterop.emitRustExpr () v84 - v85 + let v85 : string = "inline_colorization::color_bright_red" + let v86 : Ref = Fable.Core.RustInterop.emitRustExpr () v85 + v86 | US0_1 -> (* Debug *) - let v78 : string = "inline_colorization::color_bright_blue" - let v79 : Ref = Fable.Core.RustInterop.emitRustExpr () v78 - v79 + let v79 : string = "inline_colorization::color_bright_blue" + let v80 : Ref = Fable.Core.RustInterop.emitRustExpr () v79 + v80 | US0_2 -> (* Info *) - let v80 : string = "inline_colorization::color_bright_green" - let v81 : Ref = Fable.Core.RustInterop.emitRustExpr () v80 - v81 + let v81 : string = "inline_colorization::color_bright_green" + let v82 : Ref = Fable.Core.RustInterop.emitRustExpr () v81 + v82 | US0_0 -> (* Verbose *) - let v76 : string = "inline_colorization::color_bright_black" - let v77 : Ref = Fable.Core.RustInterop.emitRustExpr () v76 - v77 + let v77 : string = "inline_colorization::color_bright_black" + let v78 : Ref = Fable.Core.RustInterop.emitRustExpr () v77 + v78 | US0_3 -> (* Warning *) - let v82 : string = "inline_colorization::color_bright_yellow" - let v83 : Ref = Fable.Core.RustInterop.emitRustExpr () v82 - v83 - let v91 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v92 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v91 - let v93 : string = "inline_colorization::color_reset" - let v94 : Ref = Fable.Core.RustInterop.emitRustExpr () v93 - let v95 : string = "\"{v90}{v92}{v94}\"" - let v96 : string = @$"format!(" + v95 + ")" - let v97 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v96 - let v98 : string = "fable_library_rust::String_::fromString($0)" - let v99 : string = Fable.Core.RustInterop.emitRustExpr v97 v98 - v99 + let v83 : string = "inline_colorization::color_bright_yellow" + let v84 : Ref = Fable.Core.RustInterop.emitRustExpr () v83 + v84 + let v92 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v93 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v92 + let v94 : string = "inline_colorization::color_reset" + let v95 : Ref = Fable.Core.RustInterop.emitRustExpr () v94 + let v96 : string = "\"{v91}{v93}{v95}\"" + let v97 : string = @$"format!(" + v96 + ")" + let v98 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v97 + let v99 : string = "fable_library_rust::String_::fromString($0)" + let v100 : string = Fable.Core.RustInterop.emitRustExpr v98 v99 + v100 #endif #if FABLE_COMPILER_RUST && WASM - let v114 : Ref = + let v115 : Ref = match v0 with | US0_4 -> (* Critical *) - let v108 : string = "inline_colorization::color_bright_red" - let v109 : Ref = Fable.Core.RustInterop.emitRustExpr () v108 - v109 + let v109 : string = "inline_colorization::color_bright_red" + let v110 : Ref = Fable.Core.RustInterop.emitRustExpr () v109 + v110 | US0_1 -> (* Debug *) - let v102 : string = "inline_colorization::color_bright_blue" - let v103 : Ref = Fable.Core.RustInterop.emitRustExpr () v102 - v103 + let v103 : string = "inline_colorization::color_bright_blue" + let v104 : Ref = Fable.Core.RustInterop.emitRustExpr () v103 + v104 | US0_2 -> (* Info *) - let v104 : string = "inline_colorization::color_bright_green" - let v105 : Ref = Fable.Core.RustInterop.emitRustExpr () v104 - v105 + let v105 : string = "inline_colorization::color_bright_green" + let v106 : Ref = Fable.Core.RustInterop.emitRustExpr () v105 + v106 | US0_0 -> (* Verbose *) - let v100 : string = "inline_colorization::color_bright_black" - let v101 : Ref = Fable.Core.RustInterop.emitRustExpr () v100 - v101 + let v101 : string = "inline_colorization::color_bright_black" + let v102 : Ref = Fable.Core.RustInterop.emitRustExpr () v101 + v102 | US0_3 -> (* Warning *) - let v106 : string = "inline_colorization::color_bright_yellow" - let v107 : Ref = Fable.Core.RustInterop.emitRustExpr () v106 - v107 - let v115 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v116 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v115 - let v117 : string = "inline_colorization::color_reset" - let v118 : Ref = Fable.Core.RustInterop.emitRustExpr () v117 - let v119 : string = "\"{v114}{v116}{v118}\"" - let v120 : string = @$"format!(" + v119 + ")" - let v121 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v120 - let v122 : string = "fable_library_rust::String_::fromString($0)" - let v123 : string = Fable.Core.RustInterop.emitRustExpr v121 v122 - v123 + let v107 : string = "inline_colorization::color_bright_yellow" + let v108 : Ref = Fable.Core.RustInterop.emitRustExpr () v107 + v108 + let v116 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v117 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v116 + let v118 : string = "inline_colorization::color_reset" + let v119 : Ref = Fable.Core.RustInterop.emitRustExpr () v118 + let v120 : string = "\"{v115}{v117}{v119}\"" + let v121 : string = @$"format!(" + v120 + ")" + let v122 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v121 + let v123 : string = "fable_library_rust::String_::fromString($0)" + let v124 : string = Fable.Core.RustInterop.emitRustExpr v122 v123 + v124 #endif #if FABLE_COMPILER_RUST && CONTRACT - let v138 : Ref = + let v139 : Ref = match v0 with | US0_4 -> (* Critical *) - let v132 : string = "inline_colorization::color_bright_red" - let v133 : Ref = Fable.Core.RustInterop.emitRustExpr () v132 - v133 + let v133 : string = "inline_colorization::color_bright_red" + let v134 : Ref = Fable.Core.RustInterop.emitRustExpr () v133 + v134 | US0_1 -> (* Debug *) - let v126 : string = "inline_colorization::color_bright_blue" - let v127 : Ref = Fable.Core.RustInterop.emitRustExpr () v126 - v127 + let v127 : string = "inline_colorization::color_bright_blue" + let v128 : Ref = Fable.Core.RustInterop.emitRustExpr () v127 + v128 | US0_2 -> (* Info *) - let v128 : string = "inline_colorization::color_bright_green" - let v129 : Ref = Fable.Core.RustInterop.emitRustExpr () v128 - v129 + let v129 : string = "inline_colorization::color_bright_green" + let v130 : Ref = Fable.Core.RustInterop.emitRustExpr () v129 + v130 | US0_0 -> (* Verbose *) - let v124 : string = "inline_colorization::color_bright_black" - let v125 : Ref = Fable.Core.RustInterop.emitRustExpr () v124 - v125 + let v125 : string = "inline_colorization::color_bright_black" + let v126 : Ref = Fable.Core.RustInterop.emitRustExpr () v125 + v126 | US0_3 -> (* Warning *) - let v130 : string = "inline_colorization::color_bright_yellow" - let v131 : Ref = Fable.Core.RustInterop.emitRustExpr () v130 - v131 - let v139 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v140 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v139 - let v141 : string = "inline_colorization::color_reset" - let v142 : Ref = Fable.Core.RustInterop.emitRustExpr () v141 - let v143 : string = "\"{v138}{v140}{v142}\"" - let v144 : string = @$"format!(" + v143 + ")" - let v145 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v144 - let v146 : string = "fable_library_rust::String_::fromString($0)" - let v147 : string = Fable.Core.RustInterop.emitRustExpr v145 v146 - v147 + let v131 : string = "inline_colorization::color_bright_yellow" + let v132 : Ref = Fable.Core.RustInterop.emitRustExpr () v131 + v132 + let v140 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v141 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v140 + let v142 : string = "inline_colorization::color_reset" + let v143 : Ref = Fable.Core.RustInterop.emitRustExpr () v142 + let v144 : string = "\"{v139}{v141}{v143}\"" + let v145 : string = @$"format!(" + v144 + ")" + let v146 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v145 + let v147 : string = "fable_library_rust::String_::fromString($0)" + let v148 : string = Fable.Core.RustInterop.emitRustExpr v146 v147 + v148 #endif #if !FABLE_COMPILER && !FABLE_COMPILER_RUST && !FABLE_COMPILER_TYPESCRIPT && !WASM && !CONTRACT - v73 + v74 #endif #if FABLE_COMPILER_TYPESCRIPT - v73 + v74 #endif #if FABLE_COMPILER_PYTHON || FABLE_COMPILER_PHP || FABLE_COMPILER_DART - let v148 : string = Unchecked.defaultof - v148 -#endif - |> fun x -> _v74 <- Some x - let v149 : string = _v74.Value - let v150 : string = $"{v61} {v149} #{v62} %s{v1 ()} / %s{v2 ()}" - let v151 : (char []) = [||] - let v152 : string = v150.TrimStart v151 - let v153 : (char []) = [|' '; '/'|] - let v154 : string = v152.TrimEnd v153 - v154 + let v149 : string = Unchecked.defaultof + v149 +#endif + |> fun x -> _v75 <- Some x + let v150 : string = _v75.Value + let v151 : string = $"{v61} {v150} #{v62} %s{v1 ()} / %s{v2 ()}" + let v152 : (char []) = [||] + let v153 : string = v151.TrimStart v152 + let v154 : (char []) = [|' '; '/'|] + let v155 : string = v153.TrimEnd v154 + v155 and method10 (v0 : US0, v1 : (unit -> string)) : unit = let v2 : (unit -> struct (Mut0 * Mut1 * Mut2 * int64 option * Mut3)) = closure0() if State.trace_state.IsNone then State.trace_state <- v2 () |> Some diff --git a/lib/spiral/runtime.rs b/lib/spiral/runtime.rs index 5b3fb5e4..1f265cb7 100644 --- a/lib/spiral/runtime.rs +++ b/lib/spiral/runtime.rs @@ -22,6 +22,7 @@ pub mod Runtime { use fable_library_rust::Option_::map; use fable_library_rust::Seq_::ofList; use fable_library_rust::String_::length; + use fable_library_rust::String_::padRight; use fable_library_rust::String_::replace; use fable_library_rust::String_::sprintf; use fable_library_rust::String_::string; @@ -848,35 +849,39 @@ pub mod Runtime { { let v61: string = getValue(_v9.get().clone()); let v62: i64 = (patternInput.0.clone()).l0.get().clone(); - let v73: string = toLower(match &v0_1 { - Runtime::US0::US0_1 => string("Debug"), - Runtime::US0::US0_2 => string("Info"), - Runtime::US0::US0_0 => string("Verbose"), - Runtime::US0::US0_3 => string("Warning"), - _ => string("Critical"), - }); - let _v74: MutCell> = MutCell::new(None::); - let v90: &str = match &v0_1 { + let v74: string = padRight( + toLower(match &v0_1 { + Runtime::US0::US0_1 => string("Debug"), + Runtime::US0::US0_2 => string("Info"), + Runtime::US0::US0_0 => string("Verbose"), + Runtime::US0::US0_3 => string("Warning"), + _ => string("Critical"), + }), + 7_i32, + ' ', + ); + let _v75: MutCell> = MutCell::new(None::); + let v91: &str = match &v0_1 { Runtime::US0::US0_1 => inline_colorization::color_bright_blue, Runtime::US0::US0_2 => inline_colorization::color_bright_green, Runtime::US0::US0_0 => inline_colorization::color_bright_black, Runtime::US0::US0_3 => inline_colorization::color_bright_yellow, _ => inline_colorization::color_bright_red, }; - let v92: &str = fable_library_rust::String_::LrcStr::as_str(&v73); - let v94: &str = inline_colorization::color_reset; - let v96: string = string("format!(\"{v90}{v92}{v94}\")"); - let v97: std::string::String = format!("{v90}{v92}{v94}"); + let v93: &str = fable_library_rust::String_::LrcStr::as_str(&v74); + let v95: &str = inline_colorization::color_reset; + let v97: string = string("format!(\"{v91}{v93}{v95}\")"); + let v98: std::string::String = format!("{v91}{v93}{v95}"); { - let x_1: string = fable_library_rust::String_::fromString(v97); - _v74.set(Some(x_1)) + let x_1: string = fable_library_rust::String_::fromString(v98); + _v75.set(Some(x_1)) } trimEndChars( trimStartChars( sprintf!( "{} {} #{} {} / {}", v61, - getValue(_v74.get().clone()), + getValue(_v75.get().clone()), v62, v1_1(), v2_1() diff --git a/lib/spiral/runtime.spi b/lib/spiral/runtime.spi index 11d7b52b..2d0c185b 100644 --- a/lib/spiral/runtime.spi +++ b/lib/spiral/runtime.spi @@ -257,6 +257,14 @@ inl command_arg (arg : arg) (command : command) : command = inl arg_required (value : bool) (arg : arg) : arg = !\\((arg, value), $'"$0.required($1)"') +// // ## arg_short +inl arg_short (value : char) (arg : arg) : arg = + !\\((arg, value), $'"$0.short($1)"') + +// // ## arg_long +inl arg_long (value : rust.static_ref' sm'.str) (arg : arg) : arg = + !\\((arg, value), $'"$0.long($1)"') + // // ## arg_index inl arg_index (value : i32) (arg : arg) : arg = !\\((arg, value), $'"$0.index($1)"') diff --git a/lib/spiral/sm'.dib b/lib/spiral/sm'.dib index ca98e610..65f27b6b 100644 --- a/lib/spiral/sm'.dib +++ b/lib/spiral/sm'.dib @@ -90,8 +90,16 @@ inl pad_left (total_width : i32) (padding_char : char) (s : string) : string = #!spiral -inl pad_right (pad : i32) (s : string) : string = - $"!s.PadRight !pad" +inl pad_right (total_width : i32) (padding_char : char) (s : string) : string = + $"!s.PadRight (!total_width, !padding_char)" + +#!spiral + +// // test + +"123" +|> pad_right 6 ' ' +|> _assert_eq "123 " #!markdown diff --git a/lib/spiral/sm'.spi b/lib/spiral/sm'.spi index 7c7915a2..4da41861 100644 --- a/lib/spiral/sm'.spi +++ b/lib/spiral/sm'.spi @@ -40,8 +40,8 @@ inl pad_left (total_width : i32) (padding_char : char) (s : string) : string = $"!s.PadLeft (!total_width, !padding_char)" // // ## pad_right -inl pad_right (pad : i32) (s : string) : string = - $"!s.PadRight !pad" +inl pad_right (total_width : i32) (padding_char : char) (s : string) : string = + $"!s.PadRight (!total_width, !padding_char)" // // ## replace inl replace (old_value : string) (new_value : string) (s : string) : string = diff --git a/lib/spiral/sm.fsx b/lib/spiral/sm.fsx index fbff4c03..2b89a3a2 100644 --- a/lib/spiral/sm.fsx +++ b/lib/spiral/sm.fsx @@ -17,34 +17,36 @@ and closure5 (v0 : int32) (v1 : char) : (string -> string) = closure6(v0, v1) and closure4 () (v0 : int32) : (char -> (string -> string)) = closure5(v0) -and closure8 (v0 : int32) (v1 : string) : string = - let v2 : string = v1.PadRight v0 - v2 -and closure7 () (v0 : int32) : (string -> string) = +and closure9 (v0 : int32, v1 : char) (v2 : string) : string = + let v3 : string = v2.PadRight (v0, v1) + v3 +and closure8 (v0 : int32) (v1 : char) : (string -> string) = + closure9(v0, v1) +and closure7 () (v0 : int32) : (char -> (string -> string)) = closure8(v0) -and closure11 (v0 : string, v1 : string) (v2 : string) : string = +and closure12 (v0 : string, v1 : string) (v2 : string) : string = let v3 : string = v2.Replace (v0, v1) v3 -and closure10 (v0 : string) (v1 : string) : (string -> string) = - closure11(v0, v1) -and closure9 () (v0 : string) : (string -> (string -> string)) = - closure10(v0) -and closure14 (v0 : int32, v1 : int32) (v2 : string) : string = +and closure11 (v0 : string) (v1 : string) : (string -> string) = + closure12(v0, v1) +and closure10 () (v0 : string) : (string -> (string -> string)) = + closure11(v0) +and closure15 (v0 : int32, v1 : int32) (v2 : string) : string = let v3 : string = v2.[int v0..int v1] v3 -and closure13 (v0 : int32) (v1 : int32) : (string -> string) = - closure14(v0, v1) -and closure12 () (v0 : int32) : (int32 -> (string -> string)) = - closure13(v0) -and closure16 (v0 : string) (v1 : string) : (string []) = +and closure14 (v0 : int32) (v1 : int32) : (string -> string) = + closure15(v0, v1) +and closure13 () (v0 : int32) : (int32 -> (string -> string)) = + closure14(v0) +and closure17 (v0 : string) (v1 : string) : (string []) = let v2 : (string []) = v1.Split v0 v2 -and closure15 () (v0 : string) : (string -> (string [])) = - closure16(v0) +and closure16 () (v0 : string) : (string -> (string [])) = + closure17(v0) and method0 () : string = let v0 : string = "" v0 -and closure18 (v0 : (string [])) (v1 : string) : (string []) = +and closure19 (v0 : (string [])) (v1 : string) : (string []) = let v2 : (string []) option = None let v3 : bool = true in let mutable _v2 = v2 #if FABLE_COMPILER_RUST && !WASM && !CONTRACT @@ -98,40 +100,40 @@ and closure18 (v0 : (string [])) (v1 : string) : (string []) = |> fun x -> _v2 <- Some x let v34 : (string []) = _v2.Value v34 -and closure17 () (v0 : (string [])) : (string -> (string [])) = - closure18(v0) -and closure20 (v0 : string) (v1 : string) : bool = +and closure18 () (v0 : (string [])) : (string -> (string [])) = + closure19(v0) +and closure21 (v0 : string) (v1 : string) : bool = let v2 : bool = v1.StartsWith v0 v2 -and closure19 () (v0 : string) : (string -> bool) = - closure20(v0) -and closure23 (v0 : int32, v1 : int32) (v2 : string) : string = +and closure20 () (v0 : string) : (string -> bool) = + closure21(v0) +and closure24 (v0 : int32, v1 : int32) (v2 : string) : string = let v3 : string = v2.Substring (v0, v1) v3 -and closure22 (v0 : int32) (v1 : int32) : (string -> string) = - closure23(v0, v1) -and closure21 () (v0 : int32) : (int32 -> (string -> string)) = - closure22(v0) -and closure24 () (v0 : string) : string = +and closure23 (v0 : int32) (v1 : int32) : (string -> string) = + closure24(v0, v1) +and closure22 () (v0 : int32) : (int32 -> (string -> string)) = + closure23(v0) +and closure25 () (v0 : string) : string = let v1 : string = v0.ToLower () v1 -and closure25 () (v0 : string) : string = +and closure26 () (v0 : string) : string = let v1 : string = v0.ToUpper () v1 -and closure26 () (v0 : string) : string = +and closure27 () (v0 : string) : string = let v1 : string = v0.Trim () v1 -and closure28 (v0 : (char [])) (v1 : string) : string = +and closure29 (v0 : (char [])) (v1 : string) : string = let v2 : string = v1.TrimEnd v0 v2 -and closure27 () (v0 : (char [])) : (string -> string) = - closure28(v0) -and closure30 (v0 : (char [])) (v1 : string) : string = +and closure28 () (v0 : (char [])) : (string -> string) = + closure29(v0) +and closure31 (v0 : (char [])) (v1 : string) : string = let v2 : string = v1.TrimStart v0 v2 -and closure29 () (v0 : (char [])) : (string -> string) = - closure30(v0) -and closure32 (v0 : int32) (v1 : string) : string = +and closure30 () (v0 : (char [])) : (string -> string) = + closure31(v0) +and closure33 (v0 : int32) (v1 : string) : string = let v2 : int32 = v1.Length let v3 : bool = v2 <= v0 if v3 then @@ -141,9 +143,9 @@ and closure32 (v0 : int32) (v1 : string) : string = let v5 : string = v1.[int 0..int v4] let v6 : string = v5 + "..." v6 -and closure31 () (v0 : int32) : (string -> string) = - closure32(v0) -and closure34 (v0 : int64) (v1 : string) : string = +and closure32 () (v0 : int32) : (string -> string) = + closure33(v0) +and closure35 (v0 : int64) (v1 : string) : string = let v2 : int64 = System.Convert.ToInt64 v1.Length let v3 : bool = v2 <= v0 if v3 then @@ -170,9 +172,9 @@ and closure34 (v0 : int64) (v1 : string) : string = let v22 : (string -> (string seq -> string)) = String.concat let v23 : (string seq -> string) = v22 v21 v23 v20 -and closure33 () (v0 : int64) : (string -> string) = - closure34(v0) -and closure35 () (v0 : exn) : string = +and closure34 () (v0 : int64) : (string -> string) = + closure35(v0) +and closure36 () (v0 : exn) : string = let v1 : string option = None let v2 : bool = true in let mutable _v1 = v1 #if FABLE_COMPILER_RUST && !WASM && !CONTRACT @@ -206,7 +208,7 @@ and method1 (v0 : int32, v1 : Mut0) : bool = let v2 : int32 = v1.l0 let v3 : bool = v2 < v0 v3 -and closure37 (v0 : string) (v1 : (string [])) : string = +and closure38 (v0 : string) (v1 : (string [])) : string = let v2 : int32 = v1.Length let v3 : string = "" let v4 : Mut0 = {l0 = 0; l1 = v3} : Mut0 @@ -221,27 +223,27 @@ and closure37 (v0 : string) (v1 : (string [])) : string = () let v11 : string = v4.l1 v11 -and closure36 () (v0 : string) : ((string []) -> string) = - closure37(v0) +and closure37 () (v0 : string) : ((string []) -> string) = + closure38(v0) and method2 (v0 : string) : string = v0 -and closure39 (v0 : string) (v1 : string seq) : string = +and closure40 (v0 : string) (v1 : string seq) : string = let v2 : string = method2(v0) let v3 : (string -> (string seq -> string)) = String.concat let v4 : (string seq -> string) = v3 v2 v4 v1 -and closure38 () (v0 : string) : (string seq -> string) = - closure39(v0) -and closure41 (v0 : string) (v1 : (string [])) : string = +and closure39 () (v0 : string) : (string seq -> string) = + closure40(v0) +and closure42 (v0 : string) (v1 : (string [])) : string = let v2 : string = System.String.Join (v0, v1) v2 -and closure40 () (v0 : string) : ((string []) -> string) = - closure41(v0) +and closure41 () (v0 : string) : ((string []) -> string) = + closure42(v0) and method3 (v0 : int32, v1 : Mut1) : bool = let v2 : int32 = v1.l0 let v3 : bool = v2 < v0 v3 -and closure42 () (v0 : string) : (char []) = +and closure43 () (v0 : string) : (char []) = let v1 : int32 = v0.Length let v2 : (char []) = Array.zeroCreate (v1) let v3 : Mut1 = {l0 = 0} : Mut1 @@ -259,42 +261,42 @@ let v1 : (string -> (string -> bool)) = closure2() let ends_with x = v1 x let v2 : (int32 -> (char -> (string -> string))) = closure4() let pad_left x = v2 x -let v3 : (int32 -> (string -> string)) = closure7() +let v3 : (int32 -> (char -> (string -> string))) = closure7() let pad_right x = v3 x -let v4 : (string -> (string -> (string -> string))) = closure9() +let v4 : (string -> (string -> (string -> string))) = closure10() let replace x = v4 x -let v5 : (int32 -> (int32 -> (string -> string))) = closure12() +let v5 : (int32 -> (int32 -> (string -> string))) = closure13() let slice x = v5 x -let v6 : (string -> (string -> (string []))) = closure15() +let v6 : (string -> (string -> (string []))) = closure16() let split x = v6 x -let v7 : ((string []) -> (string -> (string []))) = closure17() +let v7 : ((string []) -> (string -> (string []))) = closure18() let split_string x = v7 x -let v8 : (string -> (string -> bool)) = closure19() +let v8 : (string -> (string -> bool)) = closure20() let starts_with x = v8 x -let v9 : (int32 -> (int32 -> (string -> string))) = closure21() +let v9 : (int32 -> (int32 -> (string -> string))) = closure22() let substring x = v9 x -let v10 : (string -> string) = closure24() +let v10 : (string -> string) = closure25() let to_lower x = v10 x -let v11 : (string -> string) = closure25() +let v11 : (string -> string) = closure26() let to_upper x = v11 x -let v12 : (string -> string) = closure26() +let v12 : (string -> string) = closure27() let trim x = v12 x -let v13 : ((char []) -> (string -> string)) = closure27() +let v13 : ((char []) -> (string -> string)) = closure28() let trim_end x = v13 x -let v14 : ((char []) -> (string -> string)) = closure29() +let v14 : ((char []) -> (string -> string)) = closure30() let trim_start x = v14 x -let v15 : (int32 -> (string -> string)) = closure31() +let v15 : (int32 -> (string -> string)) = closure32() let ellipsis x = v15 x -let v16 : (int64 -> (string -> string)) = closure33() +let v16 : (int64 -> (string -> string)) = closure34() let ellipsis_end x = v16 x -let v17 : (exn -> string) = closure35() +let v17 : (exn -> string) = closure36() let format_exception x = v17 x -let v18 : (string -> ((string []) -> string)) = closure36() +let v18 : (string -> ((string []) -> string)) = closure37() let concat_array_trailing x = v18 x -let v19 : (string -> (string seq -> string)) = closure38() +let v19 : (string -> (string seq -> string)) = closure39() let concat x = v19 x -let v20 : (string -> ((string []) -> string)) = closure40() +let v20 : (string -> ((string []) -> string)) = closure41() let join' x = v20 x -let v21 : (string -> (char [])) = closure42() +let v21 : (string -> (char [])) = closure43() let to_char_array x = v21 x () diff --git a/lib/spiral/sm.rs b/lib/spiral/sm.rs index 2ca2af83..9179ab04 100644 --- a/lib/spiral/sm.rs +++ b/lib/spiral/sm.rs @@ -87,60 +87,67 @@ pub mod Sm { move |v: char| Sm::closure5(v0_1, v) }) } - pub fn closure8(v0_1: i32, v1_1: string) -> string { - padRight(v1_1, v0_1, ' ') + pub fn closure9(v0_1: i32, v1_1: char, v2_1: string) -> string { + padRight(v2_1, v0_1, v1_1) } - pub fn closure7(unitVar: (), v0_1: i32) -> Func1 { + pub fn closure8(v0_1: i32, v1_1: char) -> Func1 { Func1::new({ let v0_1 = v0_1.clone(); - move |v: string| Sm::closure8(v0_1, v) + let v1_1 = v1_1.clone(); + move |v: string| Sm::closure9(v0_1, v1_1, v) + }) + } + pub fn closure7(unitVar: (), v0_1: i32) -> Func1> { + Func1::new({ + let v0_1 = v0_1.clone(); + move |v: char| Sm::closure8(v0_1, v) }) } - pub fn closure11(v0_1: string, v1_1: string, v2_1: string) -> string { + pub fn closure12(v0_1: string, v1_1: string, v2_1: string) -> string { replace_1(v2_1, v0_1, v1_1) } - pub fn closure10(v0_1: string, v1_1: string) -> Func1 { + pub fn closure11(v0_1: string, v1_1: string) -> Func1 { Func1::new({ let v0_1 = v0_1.clone(); let v1_1 = v1_1.clone(); - move |v: string| Sm::closure11(v0_1.clone(), v1_1.clone(), v) + move |v: string| Sm::closure12(v0_1.clone(), v1_1.clone(), v) }) } - pub fn closure9(unitVar: (), v0_1: string) -> Func1> { + pub fn closure10(unitVar: (), v0_1: string) -> Func1> { Func1::new({ let v0_1 = v0_1.clone(); - move |v: string| Sm::closure10(v0_1.clone(), v) + move |v: string| Sm::closure11(v0_1.clone(), v) }) } - pub fn closure14(v0_1: i32, v1_1: i32, v2_1: string) -> string { + pub fn closure15(v0_1: i32, v1_1: i32, v2_1: string) -> string { getSlice(v2_1, Some(v0_1), Some(v1_1)) } - pub fn closure13(v0_1: i32, v1_1: i32) -> Func1 { + pub fn closure14(v0_1: i32, v1_1: i32) -> Func1 { Func1::new({ let v0_1 = v0_1.clone(); let v1_1 = v1_1.clone(); - move |v: string| Sm::closure14(v0_1, v1_1, v) + move |v: string| Sm::closure15(v0_1, v1_1, v) }) } - pub fn closure12(unitVar: (), v0_1: i32) -> Func1> { + pub fn closure13(unitVar: (), v0_1: i32) -> Func1> { Func1::new({ let v0_1 = v0_1.clone(); - move |v: i32| Sm::closure13(v0_1, v) + move |v: i32| Sm::closure14(v0_1, v) }) } - pub fn closure16(v0_1: string, v1_1: string) -> Array { + pub fn closure17(v0_1: string, v1_1: string) -> Array { split_1(v1_1, v0_1, -1_i32, 0_i32) } - pub fn closure15(unitVar: (), v0_1: string) -> Func1> { + pub fn closure16(unitVar: (), v0_1: string) -> Func1> { Func1::new({ let v0_1 = v0_1.clone(); - move |v: string| Sm::closure16(v0_1.clone(), v) + move |v: string| Sm::closure17(v0_1.clone(), v) }) } pub fn method0() -> string { string("") } - pub fn closure18(v0_1: Array, v1_1: string) -> Array { + pub fn closure19(v0_1: Array, v1_1: string) -> Array { let _v2: MutCell>> = MutCell::new(None::>); let v5_1: LrcPtr> = ofArray(v0_1); { @@ -149,65 +156,65 @@ pub mod Sm { } getValue(_v2.get().clone()) } - pub fn closure17(unitVar: (), v0_1: Array) -> Func1> { + pub fn closure18(unitVar: (), v0_1: Array) -> Func1> { Func1::new({ let v0_1 = v0_1.clone(); - move |v: string| Sm::closure18(v0_1.clone(), v) + move |v: string| Sm::closure19(v0_1.clone(), v) }) } - pub fn closure20(v0_1: string, v1_1: string) -> bool { + pub fn closure21(v0_1: string, v1_1: string) -> bool { startsWith(v1_1, v0_1, false) } - pub fn closure19(unitVar: (), v0_1: string) -> Func1 { + pub fn closure20(unitVar: (), v0_1: string) -> Func1 { Func1::new({ let v0_1 = v0_1.clone(); - move |v: string| Sm::closure20(v0_1.clone(), v) + move |v: string| Sm::closure21(v0_1.clone(), v) }) } - pub fn closure23(v0_1: i32, v1_1: i32, v2_1: string) -> string { + pub fn closure24(v0_1: i32, v1_1: i32, v2_1: string) -> string { substring2(v2_1, v0_1, v1_1) } - pub fn closure22(v0_1: i32, v1_1: i32) -> Func1 { + pub fn closure23(v0_1: i32, v1_1: i32) -> Func1 { Func1::new({ let v0_1 = v0_1.clone(); let v1_1 = v1_1.clone(); - move |v: string| Sm::closure23(v0_1, v1_1, v) + move |v: string| Sm::closure24(v0_1, v1_1, v) }) } - pub fn closure21(unitVar: (), v0_1: i32) -> Func1> { + pub fn closure22(unitVar: (), v0_1: i32) -> Func1> { Func1::new({ let v0_1 = v0_1.clone(); - move |v: i32| Sm::closure22(v0_1, v) + move |v: i32| Sm::closure23(v0_1, v) }) } - pub fn closure24(unitVar: (), v0_1: string) -> string { + pub fn closure25(unitVar: (), v0_1: string) -> string { toLower(v0_1) } - pub fn closure25(unitVar: (), v0_1: string) -> string { + pub fn closure26(unitVar: (), v0_1: string) -> string { toUpper(v0_1) } - pub fn closure26(unitVar: (), v0_1: string) -> string { + pub fn closure27(unitVar: (), v0_1: string) -> string { trim_1(v0_1) } - pub fn closure28(v0_1: Array, v1_1: string) -> string { + pub fn closure29(v0_1: Array, v1_1: string) -> string { trimEndChars(v1_1, v0_1) } - pub fn closure27(unitVar: (), v0_1: Array) -> Func1 { + pub fn closure28(unitVar: (), v0_1: Array) -> Func1 { Func1::new({ let v0_1 = v0_1.clone(); - move |v: string| Sm::closure28(v0_1.clone(), v) + move |v: string| Sm::closure29(v0_1.clone(), v) }) } - pub fn closure30(v0_1: Array, v1_1: string) -> string { + pub fn closure31(v0_1: Array, v1_1: string) -> string { trimStartChars(v1_1, v0_1) } - pub fn closure29(unitVar: (), v0_1: Array) -> Func1 { + pub fn closure30(unitVar: (), v0_1: Array) -> Func1 { Func1::new({ let v0_1 = v0_1.clone(); - move |v: string| Sm::closure30(v0_1.clone(), v) + move |v: string| Sm::closure31(v0_1.clone(), v) }) } - pub fn closure32(v0_1: i32, v1_1: string) -> string { + pub fn closure33(v0_1: i32, v1_1: string) -> string { if length(v1_1.clone()) <= v0_1 { v1_1.clone() } else { @@ -217,13 +224,13 @@ pub mod Sm { ) } } - pub fn closure31(unitVar: (), v0_1: i32) -> Func1 { + pub fn closure32(unitVar: (), v0_1: i32) -> Func1 { Func1::new({ let v0_1 = v0_1.clone(); - move |v: string| Sm::closure32(v0_1, v) + move |v: string| Sm::closure33(v0_1, v) }) } - pub fn closure34(v0_1: i64, v1_1: string) -> string { + pub fn closure35(v0_1: i64, v1_1: string) -> string { let v2_1: i64 = length(v1_1.clone()) as i64; if v2_1 <= v0_1 { v1_1.clone() @@ -247,13 +254,13 @@ pub mod Sm { join(Sm::method0(), toArray(v20_1)) } } - pub fn closure33(unitVar: (), v0_1: i64) -> Func1 { + pub fn closure34(unitVar: (), v0_1: i64) -> Func1 { Func1::new({ let v0_1 = v0_1.clone(); - move |v: string| Sm::closure34(v0_1, v) + move |v: string| Sm::closure35(v0_1, v) }) } - pub fn closure35(unitVar: (), v0_1: LrcPtr) -> string { + pub fn closure36(unitVar: (), v0_1: LrcPtr) -> string { let _v1: MutCell> = MutCell::new(None::); { let x: string = sprintf!("{:?}", v0_1); @@ -264,7 +271,7 @@ pub mod Sm { pub fn method1(v0_1: i32, v1_1: LrcPtr) -> bool { v1_1.l0.get().clone() < v0_1 } - pub fn closure37(v0_1: string, v1_1: Array) -> string { + pub fn closure38(v0_1: string, v1_1: Array) -> string { let v2_1: i32 = count(v1_1.clone()); let v4_1: LrcPtr = LrcPtr::new(Sm::Mut0 { l0: MutCell::new(0_i32), @@ -286,40 +293,40 @@ pub mod Sm { } v4_1.l1.get().clone() } - pub fn closure36(unitVar: (), v0_1: string) -> Func1, string> { + pub fn closure37(unitVar: (), v0_1: string) -> Func1, string> { Func1::new({ let v0_1 = v0_1.clone(); - move |v: Array| Sm::closure37(v0_1.clone(), v) + move |v: Array| Sm::closure38(v0_1.clone(), v) }) } pub fn method2(v0_1: string) -> string { v0_1 } - pub fn closure39(v0_1: string, v1_1: LrcPtr>) -> string { + pub fn closure40(v0_1: string, v1_1: LrcPtr>) -> string { join(Sm::method2(v0_1), toArray(v1_1)) } - pub fn closure38( + pub fn closure39( unitVar: (), v0_1: string, ) -> Func1>, string> { Func1::new({ let v0_1 = v0_1.clone(); - move |v: LrcPtr>| Sm::closure39(v0_1.clone(), v) + move |v: LrcPtr>| Sm::closure40(v0_1.clone(), v) }) } - pub fn closure41(v0_1: string, v1_1: Array) -> string { + pub fn closure42(v0_1: string, v1_1: Array) -> string { join(v0_1, v1_1) } - pub fn closure40(unitVar: (), v0_1: string) -> Func1, string> { + pub fn closure41(unitVar: (), v0_1: string) -> Func1, string> { Func1::new({ let v0_1 = v0_1.clone(); - move |v: Array| Sm::closure41(v0_1.clone(), v) + move |v: Array| Sm::closure42(v0_1.clone(), v) }) } pub fn method3(v0_1: i32, v1_1: LrcPtr) -> bool { v1_1.l0.get().clone() < v0_1 } - pub fn closure42(unitVar: (), v0_1: string) -> Array { + pub fn closure43(unitVar: (), v0_1: string) -> Array { let v1_1: i32 = length(v0_1.clone()); let v2_1: Array = new_init(&'\u{0000}', v1_1); let v3_1: LrcPtr = LrcPtr::new(Sm::Mut1 { @@ -361,17 +368,17 @@ pub mod Sm { pub fn pad_left(x: i32) -> Func1> { (Sm::v2())(x) } - pub fn v3() -> Func1> { - static v3: OnceInit>> = OnceInit::new(); + pub fn v3() -> Func1>> { + static v3: OnceInit>>> = OnceInit::new(); v3.get_or_init(|| Func1::new(move |v: i32| Sm::closure7((), v))) .clone() } - pub fn pad_right(x: i32) -> Func1 { + pub fn pad_right(x: i32) -> Func1> { (Sm::v3())(x) } pub fn v4() -> Func1>> { static v4: OnceInit>>> = OnceInit::new(); - v4.get_or_init(|| Func1::new(move |v: string| Sm::closure9((), v))) + v4.get_or_init(|| Func1::new(move |v: string| Sm::closure10((), v))) .clone() } pub fn replace(x: string) -> Func1> { @@ -379,7 +386,7 @@ pub mod Sm { } pub fn v5() -> Func1>> { static v5: OnceInit>>> = OnceInit::new(); - v5.get_or_init(|| Func1::new(move |v: i32| Sm::closure12((), v))) + v5.get_or_init(|| Func1::new(move |v: i32| Sm::closure13((), v))) .clone() } pub fn slice(x: i32) -> Func1> { @@ -387,7 +394,7 @@ pub mod Sm { } pub fn v6() -> Func1>> { static v6: OnceInit>>> = OnceInit::new(); - v6.get_or_init(|| Func1::new(move |v: string| Sm::closure15((), v))) + v6.get_or_init(|| Func1::new(move |v: string| Sm::closure16((), v))) .clone() } pub fn split(x: string) -> Func1> { @@ -395,7 +402,7 @@ pub mod Sm { } pub fn v7() -> Func1, Func1>> { static v7: OnceInit, Func1>>> = OnceInit::new(); - v7.get_or_init(|| Func1::new(move |v: Array| Sm::closure17((), v))) + v7.get_or_init(|| Func1::new(move |v: Array| Sm::closure18((), v))) .clone() } pub fn split_string(x: Array) -> Func1> { @@ -403,7 +410,7 @@ pub mod Sm { } pub fn v8() -> Func1> { static v8: OnceInit>> = OnceInit::new(); - v8.get_or_init(|| Func1::new(move |v: string| Sm::closure19((), v))) + v8.get_or_init(|| Func1::new(move |v: string| Sm::closure20((), v))) .clone() } pub fn starts_with(x: string) -> Func1 { @@ -411,7 +418,7 @@ pub mod Sm { } pub fn v9() -> Func1>> { static v9: OnceInit>>> = OnceInit::new(); - v9.get_or_init(|| Func1::new(move |v: i32| Sm::closure21((), v))) + v9.get_or_init(|| Func1::new(move |v: i32| Sm::closure22((), v))) .clone() } pub fn substring(x: i32) -> Func1> { @@ -419,7 +426,7 @@ pub mod Sm { } pub fn v10() -> Func1 { static v10: OnceInit> = OnceInit::new(); - v10.get_or_init(|| Func1::new(move |v: string| Sm::closure24((), v))) + v10.get_or_init(|| Func1::new(move |v: string| Sm::closure25((), v))) .clone() } pub fn to_lower(x: string) -> string { @@ -427,7 +434,7 @@ pub mod Sm { } pub fn v11() -> Func1 { static v11: OnceInit> = OnceInit::new(); - v11.get_or_init(|| Func1::new(move |v: string| Sm::closure25((), v))) + v11.get_or_init(|| Func1::new(move |v: string| Sm::closure26((), v))) .clone() } pub fn to_upper(x: string) -> string { @@ -435,7 +442,7 @@ pub mod Sm { } pub fn v12() -> Func1 { static v12: OnceInit> = OnceInit::new(); - v12.get_or_init(|| Func1::new(move |v: string| Sm::closure26((), v))) + v12.get_or_init(|| Func1::new(move |v: string| Sm::closure27((), v))) .clone() } pub fn trim(x: string) -> string { @@ -443,7 +450,7 @@ pub mod Sm { } pub fn v13() -> Func1, Func1> { static v13: OnceInit, Func1>> = OnceInit::new(); - v13.get_or_init(|| Func1::new(move |v: Array| Sm::closure27((), v))) + v13.get_or_init(|| Func1::new(move |v: Array| Sm::closure28((), v))) .clone() } pub fn trim_end(x: Array) -> Func1 { @@ -451,7 +458,7 @@ pub mod Sm { } pub fn v14() -> Func1, Func1> { static v14: OnceInit, Func1>> = OnceInit::new(); - v14.get_or_init(|| Func1::new(move |v: Array| Sm::closure29((), v))) + v14.get_or_init(|| Func1::new(move |v: Array| Sm::closure30((), v))) .clone() } pub fn trim_start(x: Array) -> Func1 { @@ -459,7 +466,7 @@ pub mod Sm { } pub fn v15() -> Func1> { static v15: OnceInit>> = OnceInit::new(); - v15.get_or_init(|| Func1::new(move |v: i32| Sm::closure31((), v))) + v15.get_or_init(|| Func1::new(move |v: i32| Sm::closure32((), v))) .clone() } pub fn ellipsis(x: i32) -> Func1 { @@ -467,7 +474,7 @@ pub mod Sm { } pub fn v16() -> Func1> { static v16: OnceInit>> = OnceInit::new(); - v16.get_or_init(|| Func1::new(move |v: i64| Sm::closure33((), v))) + v16.get_or_init(|| Func1::new(move |v: i64| Sm::closure34((), v))) .clone() } pub fn ellipsis_end(x: i64) -> Func1 { @@ -475,7 +482,7 @@ pub mod Sm { } pub fn v17() -> Func1, string> { static v17: OnceInit, string>> = OnceInit::new(); - v17.get_or_init(|| Func1::new(move |v: LrcPtr| Sm::closure35((), v))) + v17.get_or_init(|| Func1::new(move |v: LrcPtr| Sm::closure36((), v))) .clone() } pub fn format_exception(x: LrcPtr) -> string { @@ -483,7 +490,7 @@ pub mod Sm { } pub fn v18() -> Func1, string>> { static v18: OnceInit, string>>> = OnceInit::new(); - v18.get_or_init(|| Func1::new(move |v: string| Sm::closure36((), v))) + v18.get_or_init(|| Func1::new(move |v: string| Sm::closure37((), v))) .clone() } pub fn concat_array_trailing(x: string) -> Func1, string> { @@ -492,7 +499,7 @@ pub mod Sm { pub fn v19() -> Func1>, string>> { static v19: OnceInit>, string>>> = OnceInit::new(); - v19.get_or_init(|| Func1::new(move |v: string| Sm::closure38((), v))) + v19.get_or_init(|| Func1::new(move |v: string| Sm::closure39((), v))) .clone() } pub fn concat(x: string) -> Func1>, string> { @@ -500,7 +507,7 @@ pub mod Sm { } pub fn v20() -> Func1, string>> { static v20: OnceInit, string>>> = OnceInit::new(); - v20.get_or_init(|| Func1::new(move |v: string| Sm::closure40((), v))) + v20.get_or_init(|| Func1::new(move |v: string| Sm::closure41((), v))) .clone() } pub fn join_(x: string) -> Func1, string> { @@ -508,7 +515,7 @@ pub mod Sm { } pub fn v21() -> Func1> { static v21: OnceInit>> = OnceInit::new(); - v21.get_or_init(|| Func1::new(move |v: string| Sm::closure42((), v))) + v21.get_or_init(|| Func1::new(move |v: string| Sm::closure43((), v))) .clone() } pub fn to_char_array(x: string) -> Array { diff --git a/lib/spiral/trace.dib b/lib/spiral/trace.dib index 64fc182a..2a9de441 100644 --- a/lib/spiral/trace.dib +++ b/lib/spiral/trace.dib @@ -214,7 +214,7 @@ let trace (level : trace_level) (fn : () -> string) (locals : () -> string) = $'!date_time.ToString !format ' | _ => fun () => join "" inl count = *trace_state.count - inl level_str = level |> to_string |> sm'.to_lower + inl level_str = level |> to_string |> sm'.to_lower |> sm'.pad_right 7 ' ' inl level_str = run_target function | Rust _ => fun () => diff --git a/lib/spiral/trace.fsx b/lib/spiral/trace.fsx index ce0f25db..6c6a3c22 100644 --- a/lib/spiral/trace.fsx +++ b/lib/spiral/trace.fsx @@ -229,128 +229,129 @@ and closure5 (v0 : US0, v1 : (unit -> string), v2 : (unit -> string)) () : strin let v66 : string = "Warning" v66 let v73 : string = v72.ToLower () - let v74 : string option = None - let v75 : bool = true in let mutable _v74 = v74 + let v74 : string = v73.PadRight (7, ' ') + let v75 : string option = None + let v76 : bool = true in let mutable _v75 = v75 #if FABLE_COMPILER_RUST && !WASM && !CONTRACT - let v90 : Ref = + let v91 : Ref = match v0 with | US0_4 -> (* Critical *) - let v84 : string = "inline_colorization::color_bright_red" - let v85 : Ref = Fable.Core.RustInterop.emitRustExpr () v84 - v85 + let v85 : string = "inline_colorization::color_bright_red" + let v86 : Ref = Fable.Core.RustInterop.emitRustExpr () v85 + v86 | US0_1 -> (* Debug *) - let v78 : string = "inline_colorization::color_bright_blue" - let v79 : Ref = Fable.Core.RustInterop.emitRustExpr () v78 - v79 + let v79 : string = "inline_colorization::color_bright_blue" + let v80 : Ref = Fable.Core.RustInterop.emitRustExpr () v79 + v80 | US0_2 -> (* Info *) - let v80 : string = "inline_colorization::color_bright_green" - let v81 : Ref = Fable.Core.RustInterop.emitRustExpr () v80 - v81 + let v81 : string = "inline_colorization::color_bright_green" + let v82 : Ref = Fable.Core.RustInterop.emitRustExpr () v81 + v82 | US0_0 -> (* Verbose *) - let v76 : string = "inline_colorization::color_bright_black" - let v77 : Ref = Fable.Core.RustInterop.emitRustExpr () v76 - v77 + let v77 : string = "inline_colorization::color_bright_black" + let v78 : Ref = Fable.Core.RustInterop.emitRustExpr () v77 + v78 | US0_3 -> (* Warning *) - let v82 : string = "inline_colorization::color_bright_yellow" - let v83 : Ref = Fable.Core.RustInterop.emitRustExpr () v82 - v83 - let v91 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v92 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v91 - let v93 : string = "inline_colorization::color_reset" - let v94 : Ref = Fable.Core.RustInterop.emitRustExpr () v93 - let v95 : string = "\"{v90}{v92}{v94}\"" - let v96 : string = @$"format!(" + v95 + ")" - let v97 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v96 - let v98 : string = "fable_library_rust::String_::fromString($0)" - let v99 : string = Fable.Core.RustInterop.emitRustExpr v97 v98 - v99 + let v83 : string = "inline_colorization::color_bright_yellow" + let v84 : Ref = Fable.Core.RustInterop.emitRustExpr () v83 + v84 + let v92 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v93 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v92 + let v94 : string = "inline_colorization::color_reset" + let v95 : Ref = Fable.Core.RustInterop.emitRustExpr () v94 + let v96 : string = "\"{v91}{v93}{v95}\"" + let v97 : string = @$"format!(" + v96 + ")" + let v98 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v97 + let v99 : string = "fable_library_rust::String_::fromString($0)" + let v100 : string = Fable.Core.RustInterop.emitRustExpr v98 v99 + v100 #endif #if FABLE_COMPILER_RUST && WASM - let v114 : Ref = + let v115 : Ref = match v0 with | US0_4 -> (* Critical *) - let v108 : string = "inline_colorization::color_bright_red" - let v109 : Ref = Fable.Core.RustInterop.emitRustExpr () v108 - v109 + let v109 : string = "inline_colorization::color_bright_red" + let v110 : Ref = Fable.Core.RustInterop.emitRustExpr () v109 + v110 | US0_1 -> (* Debug *) - let v102 : string = "inline_colorization::color_bright_blue" - let v103 : Ref = Fable.Core.RustInterop.emitRustExpr () v102 - v103 + let v103 : string = "inline_colorization::color_bright_blue" + let v104 : Ref = Fable.Core.RustInterop.emitRustExpr () v103 + v104 | US0_2 -> (* Info *) - let v104 : string = "inline_colorization::color_bright_green" - let v105 : Ref = Fable.Core.RustInterop.emitRustExpr () v104 - v105 + let v105 : string = "inline_colorization::color_bright_green" + let v106 : Ref = Fable.Core.RustInterop.emitRustExpr () v105 + v106 | US0_0 -> (* Verbose *) - let v100 : string = "inline_colorization::color_bright_black" - let v101 : Ref = Fable.Core.RustInterop.emitRustExpr () v100 - v101 + let v101 : string = "inline_colorization::color_bright_black" + let v102 : Ref = Fable.Core.RustInterop.emitRustExpr () v101 + v102 | US0_3 -> (* Warning *) - let v106 : string = "inline_colorization::color_bright_yellow" - let v107 : Ref = Fable.Core.RustInterop.emitRustExpr () v106 - v107 - let v115 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v116 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v115 - let v117 : string = "inline_colorization::color_reset" - let v118 : Ref = Fable.Core.RustInterop.emitRustExpr () v117 - let v119 : string = "\"{v114}{v116}{v118}\"" - let v120 : string = @$"format!(" + v119 + ")" - let v121 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v120 - let v122 : string = "fable_library_rust::String_::fromString($0)" - let v123 : string = Fable.Core.RustInterop.emitRustExpr v121 v122 - v123 + let v107 : string = "inline_colorization::color_bright_yellow" + let v108 : Ref = Fable.Core.RustInterop.emitRustExpr () v107 + v108 + let v116 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v117 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v116 + let v118 : string = "inline_colorization::color_reset" + let v119 : Ref = Fable.Core.RustInterop.emitRustExpr () v118 + let v120 : string = "\"{v115}{v117}{v119}\"" + let v121 : string = @$"format!(" + v120 + ")" + let v122 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v121 + let v123 : string = "fable_library_rust::String_::fromString($0)" + let v124 : string = Fable.Core.RustInterop.emitRustExpr v122 v123 + v124 #endif #if FABLE_COMPILER_RUST && CONTRACT - let v138 : Ref = + let v139 : Ref = match v0 with | US0_4 -> (* Critical *) - let v132 : string = "inline_colorization::color_bright_red" - let v133 : Ref = Fable.Core.RustInterop.emitRustExpr () v132 - v133 + let v133 : string = "inline_colorization::color_bright_red" + let v134 : Ref = Fable.Core.RustInterop.emitRustExpr () v133 + v134 | US0_1 -> (* Debug *) - let v126 : string = "inline_colorization::color_bright_blue" - let v127 : Ref = Fable.Core.RustInterop.emitRustExpr () v126 - v127 + let v127 : string = "inline_colorization::color_bright_blue" + let v128 : Ref = Fable.Core.RustInterop.emitRustExpr () v127 + v128 | US0_2 -> (* Info *) - let v128 : string = "inline_colorization::color_bright_green" - let v129 : Ref = Fable.Core.RustInterop.emitRustExpr () v128 - v129 + let v129 : string = "inline_colorization::color_bright_green" + let v130 : Ref = Fable.Core.RustInterop.emitRustExpr () v129 + v130 | US0_0 -> (* Verbose *) - let v124 : string = "inline_colorization::color_bright_black" - let v125 : Ref = Fable.Core.RustInterop.emitRustExpr () v124 - v125 + let v125 : string = "inline_colorization::color_bright_black" + let v126 : Ref = Fable.Core.RustInterop.emitRustExpr () v125 + v126 | US0_3 -> (* Warning *) - let v130 : string = "inline_colorization::color_bright_yellow" - let v131 : Ref = Fable.Core.RustInterop.emitRustExpr () v130 - v131 - let v139 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" - let v140 : Ref = Fable.Core.RustInterop.emitRustExpr v73 v139 - let v141 : string = "inline_colorization::color_reset" - let v142 : Ref = Fable.Core.RustInterop.emitRustExpr () v141 - let v143 : string = "\"{v138}{v140}{v142}\"" - let v144 : string = @$"format!(" + v143 + ")" - let v145 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v144 - let v146 : string = "fable_library_rust::String_::fromString($0)" - let v147 : string = Fable.Core.RustInterop.emitRustExpr v145 v146 - v147 + let v131 : string = "inline_colorization::color_bright_yellow" + let v132 : Ref = Fable.Core.RustInterop.emitRustExpr () v131 + v132 + let v140 : string = "fable_library_rust::String_::LrcStr::as_str(&$0)" + let v141 : Ref = Fable.Core.RustInterop.emitRustExpr v74 v140 + let v142 : string = "inline_colorization::color_reset" + let v143 : Ref = Fable.Core.RustInterop.emitRustExpr () v142 + let v144 : string = "\"{v139}{v141}{v143}\"" + let v145 : string = @$"format!(" + v144 + ")" + let v146 : std_string_String = Fable.Core.RustInterop.emitRustExpr () v145 + let v147 : string = "fable_library_rust::String_::fromString($0)" + let v148 : string = Fable.Core.RustInterop.emitRustExpr v146 v147 + v148 #endif #if !FABLE_COMPILER && !FABLE_COMPILER_RUST && !FABLE_COMPILER_TYPESCRIPT && !WASM && !CONTRACT - v73 + v74 #endif #if FABLE_COMPILER_TYPESCRIPT - v73 + v74 #endif #if FABLE_COMPILER_PYTHON || FABLE_COMPILER_PHP || FABLE_COMPILER_DART - let v148 : string = Unchecked.defaultof - v148 + let v149 : string = Unchecked.defaultof + v149 #endif - |> fun x -> _v74 <- Some x - let v149 : string = _v74.Value - let v150 : string = $"{v61} {v149} #{v62} %s{v1 ()} / %s{v2 ()}" - let v151 : (char []) = [||] - let v152 : string = v150.TrimStart v151 - let v153 : (char []) = [|' '; '/'|] - let v154 : string = v152.TrimEnd v153 - v154 + |> fun x -> _v75 <- Some x + let v150 : string = _v75.Value + let v151 : string = $"{v61} {v150} #{v62} %s{v1 ()} / %s{v2 ()}" + let v152 : (char []) = [||] + let v153 : string = v151.TrimStart v152 + let v154 : (char []) = [|' '; '/'|] + let v155 : string = v153.TrimEnd v154 + v155 and method5 (v0 : US0, v1 : (unit -> string)) : unit = let v2 : (unit -> struct (Mut0 * Mut1 * Mut2 * int64 option * Mut3)) = closure0() if State.trace_state.IsNone then State.trace_state <- v2 () |> Some diff --git a/lib/spiral/trace.rs b/lib/spiral/trace.rs index 4874045b..812cea1a 100644 --- a/lib/spiral/trace.rs +++ b/lib/spiral/trace.rs @@ -17,6 +17,7 @@ pub mod Trace { use fable_library_rust::Option_::getValue; use fable_library_rust::Option_::map; use fable_library_rust::Seq_::ofList; + use fable_library_rust::String_::padRight; use fable_library_rust::String_::sprintf; use fable_library_rust::String_::string; use fable_library_rust::String_::toLower; @@ -301,35 +302,39 @@ pub mod Trace { { let v61: string = getValue(_v9.get().clone()); let v62: i64 = (patternInput.0.clone()).l0.get().clone(); - let v73: string = toLower(match &v0_1 { - Trace::US0::US0_1 => string("Debug"), - Trace::US0::US0_2 => string("Info"), - Trace::US0::US0_0 => string("Verbose"), - Trace::US0::US0_3 => string("Warning"), - _ => string("Critical"), - }); - let _v74: MutCell> = MutCell::new(None::); - let v90: &str = match &v0_1 { + let v74: string = padRight( + toLower(match &v0_1 { + Trace::US0::US0_1 => string("Debug"), + Trace::US0::US0_2 => string("Info"), + Trace::US0::US0_0 => string("Verbose"), + Trace::US0::US0_3 => string("Warning"), + _ => string("Critical"), + }), + 7_i32, + ' ', + ); + let _v75: MutCell> = MutCell::new(None::); + let v91: &str = match &v0_1 { Trace::US0::US0_1 => inline_colorization::color_bright_blue, Trace::US0::US0_2 => inline_colorization::color_bright_green, Trace::US0::US0_0 => inline_colorization::color_bright_black, Trace::US0::US0_3 => inline_colorization::color_bright_yellow, _ => inline_colorization::color_bright_red, }; - let v92: &str = fable_library_rust::String_::LrcStr::as_str(&v73); - let v94: &str = inline_colorization::color_reset; - let v96: string = string("format!(\"{v90}{v92}{v94}\")"); - let v97: std::string::String = format!("{v90}{v92}{v94}"); + let v93: &str = fable_library_rust::String_::LrcStr::as_str(&v74); + let v95: &str = inline_colorization::color_reset; + let v97: string = string("format!(\"{v91}{v93}{v95}\")"); + let v98: std::string::String = format!("{v91}{v93}{v95}"); { - let x_1: string = fable_library_rust::String_::fromString(v97); - _v74.set(Some(x_1)) + let x_1: string = fable_library_rust::String_::fromString(v98); + _v75.set(Some(x_1)) } trimEndChars( trimStartChars( sprintf!( "{} {} #{} {} / {}", v61, - getValue(_v74.get().clone()), + getValue(_v75.get().clone()), v62, v1_1(), v2() diff --git a/lib/spiral/trace.spi b/lib/spiral/trace.spi index b40c475f..385e6433 100644 --- a/lib/spiral/trace.spi +++ b/lib/spiral/trace.spi @@ -139,7 +139,7 @@ let trace (level : trace_level) (fn : () -> string) (locals : () -> string) = $'!date_time.ToString !format ' | _ => fun () => join "" inl count = *trace_state.count - inl level_str = level |> to_string |> sm'.to_lower + inl level_str = level |> to_string |> sm'.to_lower |> sm'.pad_right 7 ' ' inl level_str = run_target function | Rust _ => fun () =>