diff options
author | Eduardo Julian | 2019-03-16 01:45:58 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-03-16 01:45:58 -0400 |
commit | 3589348d31a21e3d8e670c1d3e7a0bf83ef3e420 (patch) | |
tree | 016994f20083948e36ca5f474928d117333a5979 /stdlib/source/lux.lux | |
parent | c2bc59de623699dcb338e74a822ce02cb8deee19 (diff) |
Got serial imports fully working.
Diffstat (limited to 'stdlib/source/lux.lux')
-rw-r--r-- | stdlib/source/lux.lux | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index c6e14e66b..2b99f51f8 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -1487,7 +1487,7 @@ #Nil))))))) _ - (fail "Wrong syntax for def'''")} + (fail "Wrong syntax for def:'''")} tokens)) (def:''' (as-pairs xs) @@ -4173,16 +4173,16 @@ (def: #export module-separator "/") -(def: (count-ups ups input) +(def: (count-relatives relatives input) (-> Nat Text Nat) - (case ("lux text index" input ..module-separator ups) + (case ("lux text index" input ..module-separator relatives) #None - ups + relatives (#Some found) - (if (n/= ups found) - (count-ups (n/+ 1 ups) input) - ups))) + (if (n/= relatives found) + (count-relatives (n/+ 1 relatives) input) + relatives))) (def: (list;take amount list) (All [a] (-> Nat (List a) (List a))) @@ -4204,22 +4204,23 @@ (def: (clean-module nested? relative-root module) (-> Bit Text Text (Meta Text)) - (case (count-ups 0 module) + (case (count-relatives 0 module) 0 (return (if nested? ($_ "lux text concat" relative-root ..module-separator module) module)) - ups - (let [parts (text;split-all-with ..module-separator relative-root)] - (if (n/< (list;size parts) (n/- 1 ups)) + relatives + (let [parts (text;split-all-with ..module-separator relative-root) + jumps (n/- 1 relatives)] + (if (n/< (list;size parts) jumps) (let [prefix (|> parts list;reverse - (list;drop (n/- 1 ups)) + (list;drop jumps) list;reverse (interpose ..module-separator) (text;join-with "")) - clean ("lux text clip" module ups ("lux text size" module)) + clean ("lux text clip" module relatives ("lux text size" module)) output (case ("lux text size" clean) 0 prefix _ ($_ text;compose prefix ..module-separator clean))] @@ -4931,8 +4932,8 @@ imports) =meta (process-def-meta (list& [(` #.imports) (` [(~+ =imports)])] _meta)) - =module (` ("lux module" [(~ cursor-code) - (#.Record (~ =meta))]))]] + =module (` ("lux def module" [(~ cursor-code) + (#.Record (~ =meta))]))]] (wrap (#Cons =module =refers)))) (macro: #export (:: tokens) |