module io is no longer imported.
h3rald h3rald@h3rald.com
Sun, 04 Aug 2024 11:38:59 +0200
16 files changed,
53 insertions(+),
63 deletions(-)
M
minpkg/lib/min_fs.nim
→
minpkg/lib/min_fs.nim
@@ -159,4 +159,32 @@ def.symbol("absolute-path?") do (i: In):
let vals = i.expect("'sym") i.push vals[0].getString.isAbsolute.newVal + def.symbol("fread") do (i: In): + let vals = i.expect("str") + let file = vals[0].strVal + var contents = "" + if MINCOMPILED: + var compiledFile = strutils.replace(strutils.replace(file, "\\", "/"), + "./", "") + if COMPILEDASSETS.hasKey(compiledFile): + contents = COMPILEDASSETS[compiledFile] + if contents == "": + contents = file.readFile + i.push newVal(contents) + + def.symbol("fwrite") do (i: In): + let vals = i.expect("str", "str") + let a = vals[0] + let b = vals[1] + a.strVal.writeFile(b.strVal) + + def.symbol("fappend") do (i: In): + let vals = i.expect("str", "str") + let a = vals[0] + let b = vals[1] + var f: File + discard f.open(a.strVal, fmAppend) + f.write(b.strVal) + f.close() + def.finalize("fs")
M
minpkg/lib/min_global.nim
→
minpkg/lib/min_global.nim
@@ -427,6 +427,10 @@ def.symbol("exit") do (i: In):
let vals = i.expect("int") quit(vals[0].intVal.int) + def.symbol("print") do (i: In): + let a = i.peek + a.print + def.symbol("puts") do (i: In): let a = i.peek echo $$a
M
minpkg/lib/min_io.nim
→
minpkg/lib/min_io.nim
@@ -50,9 +50,6 @@ def.symbol("color") do (i: In):
let vals = i.expect("bool") COLOR = vals[0].boolVal - def.symbol("newline") do (i: In): - echo "" - def.symbol("notice") do (i: In): let a = i.peek notice $$a@@ -155,38 +152,6 @@ else:
return choice let choice = choose() i.dequote(q.qVal[choice-1].qVal[1]) - - def.symbol("print") do (i: In): - let a = i.peek - a.print - - def.symbol("fread") do (i: In): - let vals = i.expect("str") - let file = vals[0].strVal - var contents = "" - if MINCOMPILED: - var compiledFile = strutils.replace(strutils.replace(file, "\\", "/"), - "./", "") - if COMPILEDASSETS.hasKey(compiledFile): - contents = COMPILEDASSETS[compiledFile] - if contents == "": - contents = file.readFile - i.push newVal(contents) - - def.symbol("fwrite") do (i: In): - let vals = i.expect("str", "str") - let a = vals[0] - let b = vals[1] - a.strVal.writeFile(b.strVal) - - def.symbol("fappend") do (i: In): - let vals = i.expect("str", "str") - let a = vals[0] - let b = vals[1] - var f: File - discard f.open(a.strVal, fmAppend) - f.write(b.strVal) - f.close() def.symbol("write") do (i: In): i.pushSym("fwrite")
M
next-release.md
→
next-release.md
@@ -6,13 +6,19 @@ - All symbols defined in the **str** module have been moved to the **global** module.
- All symbols defined in the **seq** module have been moved to the **global** module. - Removed **lambdabind** (use **lambda-bind** instead). - The **stack** module is no longer imported. -- **stack** module: Removed symbol **id**. +- **stack** module: removed symbol **id**. - **stack** module: renamed **clear-stack** to **clear**. - **stack** module: removed **clearstack** (use **stack.clear** instead). - **stack** module: renamed **get-stack** to **get**. - **stack** module: removed **getstack** (use **stack.get** instead). - **stack** module: renamed **set-stack** to **set**. - **stack** module: removed **setstack** (use **stack.set** instead). +- The **io** module is no longer imported. +- **io** module: renamed **fwrite** and **write** to **fs.write** +- **io** module: renamed **fread** and **read** to **fs.read** +- **io** module: renamed **fappend** to **fs.append** +- **io** module: moved **print** to the **global** module. +- **io** module: removed **newline** (use `"" puts!` instead). ### New Features
M
prelude.min
→
prelude.min
@@ -1,7 +1,6 @@
; Imports 'dict import 'time import -'io import 'fs import 'sys import 'dstore import
M
site/contents/reference-io.md
→
site/contents/reference-io.md
@@ -70,9 +70,6 @@ > > (clear) 'ctrl+l mapkey
> > > > causes the `CTRL+L` key to clear the screen. #} -{#op||newline||{{none}}||{{none}}|| -Prints a new line to STDOUT.#} - {#op||notice||{{any}}||{{any}}|| Prints {{any}} and a new line to STDOUT, if logging level is set to [notice](class:kwd) (default) or lower.#}
M
tasks/_helpers.min
→
tasks/_helpers.min
@@ -1,1 +1,1 @@
- "min.yml" fread from-yaml :config ".env.yml" fread from-yaml :env ( symbol required ('sym :prog ==>) ( (prog which "" ==) ("$# is not available" (prog) =% error 1 exit) when ) ) ::+ "min.yml" fread from-yaml :config ".env.yml" fread from-yaml :env ( symbol required ('sym :prog ==>) ( (prog which "" ==) ("$# is not available" (prog) =% io.error 1 exit) when ) ) ::
M
tasks/build.min
→
tasks/build.min
@@ -1,1 +1,1 @@
-#!/usr/bin/env minsystemsystemsystem "_helpers" require :helpers 'helpers import ( symbol cz ('sym :stage 'sym :variant 'sym :target-os ==>) ( true :pack-result (stage "^(release-nopack|dev)$" match?) (false @pack-result) when "-d:release" :d-stage (stage "dev" ==) ("-d:dev" @d-stage) when " " :d-variant "min" :o-variant (variant length 0 >) ( "-d:$# " (variant) =% @d-variant "$#min" (variant) =% @o-variant ) when "nim" required "Building $# - $# (x64)" (o-variant target-os) =% notice! "" :musl "musl-gcc" which :musl-gcc (musl-gcc length 0 >) ("--gcc.exe:musl-gcc --gcc.linkerexe:musl-gcc" @musl) when "nim c $# -d:ssl -d:useOpenSsl3 $# --opt:size --cpu:amd64 --os:$# $#-o:$# min" (d-stage musl target-os d-variant o-variant) =% puts system stack.pop (pack-result) ( {} target-os "os" dset config "version" dget "version" dset o-variant "exe" dset pack ) when ) ) :: ;; Builds and packs a min executable. #|| Tasks ||# ( symbol guide (==>) ( "hastyscribe" required "Building - guide" notice! "hastyscribe Min_DeveloperGuide.md --field/version=$#" (version) =% system "cp Min_DeveloperGuide.htm site/output/guide.dev.html" system ) ) :: ;; Builds the developer guide. ( symbol site (==>) ( "hastysite" required "Building - site" notice! "cd site && hastysite build && cd .." system ) ) :: ;; Builds the min site. ( symbol pack (dict :vdata ==>) ( vdata "exe" dget :exe (vdata "os" dget "windows" ==) ("$#.exe" (exe) =% @exe) when "$exe:_v$version:_$os:_x64.zip" :fn fn vdata dpairs % ":" "" replace @fn "Compressing: $#" (fn) =% notice! (exe) => fn zip ) ) :: ;; Compresses a min executable. ( symbol vim (==>) ( config "version" dget :min-version "tasks/data/min.vim" fread :template timestamp "dd MMM YYYY" tformat :date min-symbols ("||" !=) filter " " join :symbols "min.vim" :out-file "Building - min.vim" notice! template ("date" date "version" min-version "symbols" symbols) =% out-file fwrite ) ) :: ;; Generates the min.vim file. ( symbol docs (==>) ( guide site ) ) :: ;; Generate the min development guide and site. ( symbol dev (==>) ("dev" "" os cz) ) :: ;; Builds min (dev version) on the current OS. ( symbol default (==>) ("release-nopack" "" os cz) ) :: ;; Builds min on the current OS. ( symbol linux (==>) ("" "" "linux" cz) ) :: ;; Builds min for Linux. ( symbol macosx (==>) ("" "" "macosx" cz) ) :: ;; Builds min for macOS. ( symbol windows (==>) ("" "" "windows" cz) ) :: ;; Builds min for Windows. +#!/usr/bin/env minsystemsystemsystem "_helpers" require :helpers 'helpers import ( symbol cz ('sym :stage 'sym :variant 'sym :target-os ==>) ( true :pack-result (stage "^(release-nopack|dev)$" match?) (false @pack-result) when "-d:release" :d-stage (stage "dev" ==) ("-d:dev" @d-stage) when " " :d-variant "min" :o-variant (variant length 0 >) ( "-d:$# " (variant) =% @d-variant "$#min" (variant) =% @o-variant ) when "nim" required "Building $# - $# (x64)" (o-variant target-os) =% io.notice! "" :musl "musl-gcc" which :musl-gcc (musl-gcc length 0 >) ("--gcc.exe:musl-gcc --gcc.linkerexe:musl-gcc" @musl) when "nim c $# -d:ssl -d:useOpenSsl3 $# --opt:size --cpu:amd64 --os:$# $#-o:$# min" (d-stage musl target-os d-variant o-variant) =% puts system stack.pop (pack-result) ( {} target-os "os" dset config "version" dget "version" dset o-variant "exe" dset pack ) when ) ) :: ;; Builds and packs a min executable. #|| Tasks ||# ( symbol guide (==>) ( "hastyscribe" required "Building - guide" io.notice! "hastyscribe Min_DeveloperGuide.md --field/version=$#" (version) =% system "cp Min_DeveloperGuide.htm site/output/guide.dev.html" system ) ) :: ;; Builds the developer guide. ( symbol site (==>) ( "hastysite" required "Building - site" io.notice! "cd site && hastysite build && cd .." system ) ) :: ;; Builds the min site. ( symbol pack (dict :vdata ==>) ( vdata "exe" dget :exe (vdata "os" dget "windows" ==) ("$#.exe" (exe) =% @exe) when "$exe:_v$version:_$os:_x64.zip" :fn fn vdata dpairs % ":" "" replace @fn "Compressing: $#" (fn) =% io.notice! (exe) => fn zip ) ) :: ;; Compresses a min executable. ( symbol vim (==>) ( config "version" dget :min-version "tasks/data/min.vim" fread :template timestamp "dd MMM YYYY" tformat :date min-symbols ("||" !=) filter " " join :symbols "min.vim" :out-file "Building - min.vim" io.notice! template ("date" date "version" min-version "symbols" symbols) =% out-file fwrite ) ) :: ;; Generates the min.vim file. ( symbol docs (==>) ( guide site ) ) :: ;; Generate the min development guide and site. ( symbol dev (==>) ("dev" "" os cz) ) :: ;; Builds min (dev version) on the current OS. ( symbol default (==>) ("release-nopack" "" os cz) ) :: ;; Builds min on the current OS. ( symbol linux (==>) ("" "" "linux" cz) ) :: ;; Builds min for Linux. ( symbol macosx (==>) ("" "" "macosx" cz) ) :: ;; Builds min for macOS. ( symbol windows (==>) ("" "" "windows" cz) ) :: ;; Builds min for Windows.
M
tasks/clean.min
→
tasks/clean.min
@@ -1,1 +1,1 @@
-#!/usr/bin/env min #| Tasks |# ( symbol default (==>) ( "Cleaning up build files" notice! pwd ls ("(/(mini|lite)?min|\\.(htm|zip|exe))$" match?) filter :files files 'rm foreach "Done." notice! ) ) :: ;; Deletes min build files +#!/usr/bin/env min #| Tasks |# ( symbol default (==>) ( "Cleaning up build files" io.notice! pwd ls ("(/(mini|lite)?min|\\.(htm|zip|exe))$" match?) filter :files files 'rm foreach "Done." io.notice! ) ) :: ;; Deletes min build files
M
tasks/github.min
→
tasks/github.min
@@ -1,1 +1,1 @@
-#!/usr/bin/env min "_helpers" require :helpers 'helpers import "next-release.md" fread escape :release-body "tasks/data/draft-release.json" fread :draft-release-template config "version" dget :min-version env "github-token" dget :token draft-release-template ("version" min-version "body" release-body) =% :draft-release-body {} "application/vnd.github.v3+json" "Accept" dset "token $#" (token) =% "Authorization" dset :headers ( symbol handle-errors (dict :response ==>) ( response to-json "response.json" fwrite response "status" dget :status (status 300 >) ( response "body" dget from-json :body body "message" dget :message status string @status "Error $#: $#" (status message) =% error status int exit ) when ) ) :: ;; Handles HTTP errors. ( symbol gh-req (dict :data ==> dict|quot :result) ( data "endpoint" dget :endpoint "api" :subdomain (data 'subdomain dhas?) (data "subdomain" dget @subdomain) when "https://$#.github.com/repos/h3rald/min$#" (subdomain endpoint) =% :url {} url "url" dset data "method" dget "method" dset (data 'headers dhas?) (data "headers" dget "headers" dset) (headers "headers" dset) if (data 'body dhas?) (data "body" dget "body" dset) when request :response response "status" dget :status response "body" dget :body response handle-errors (body length 0 >) (body from-json) ({}) if @result ) ) :: ;; Execute a request using the Github API. ( symbol get-assets (dict :data ==> quot :result) ( data "id" dget :id {} "/releases/$#/assets" (id) =% "endpoint" dset "GET" "method" dset gh-req @result ) ) :: ;; Retrieve the assets from an existing Github release. ( symbol delete-assets (dict :config ==>) ( config get-assets :assets config "id" dget :id assets ("id" dget) map :assets-ids assets-ids ( :asset {} "/releases/assets/$#" (asset) =% "endpoint" dset "DELETE" "method" dset gh-req stack.pop ) foreach ) ) :: ;; Delete all assets from an existing Github release. #|| Tasks ||# ( symbol draft (==>) ( {} "/releases" "endpoint" dset "POST" "method" dset draft-release-body "body" dset gh-req "id" dget string :id ;; Save Release ID to min.yml config id "id" dset to-yaml "min.yml" fwrite "Draft release v$# ($#) created successfully" (min-version id) =% notice! ) ) :: ;; Creates a new draft release on Github. ( symbol update (==>) ( config "id" dget :id {} "/releases/$#" (id) =% "endpoint" dset "PATCH" "method" dset draft-release-body "body" dset gh-req "id" dget string :id "Draft release v$# ($#) updated successfully" (min-version id) =% notice! ) ) :: ;; Updates the text of the current draft Github release. ( symbol assets (==>) ( config get-assets =assets assets size :total "are" :verb (total 1 ==) ("is" @verb) when "There $# $# assets in release v$#" (verb total min-version) =% notice! assets ("name" dget () stack.cons "- $#" stack.swap % notice!) foreach ) ) :: ;; Retrieve a list of all the assets of the current draft Github release. ( symbol upload (==>) ( config "id" dget :id config delete-assets pwd ls ("\\.zip$" match?) filter ( filename :file "Uploading: $#" (file) =% notice! file fread :body headers "application/zip" "Content-Type" dset :asset-headers {} "/releases/$#/assets?name=$#" (id file) =% "endpoint" dset asset-headers "headers" dset "uploads" "subdomain" dset "POST" "method" dset body "body" dset gh-req stack.pop ) foreach ) ) :: ;; Uploads all assets to the current draft Github release, deleting any existing asset. +#!/usr/bin/env min "_helpers" require :helpers 'helpers import "next-release.md" fread escape :release-body "tasks/data/draft-release.json" fread :draft-release-template config "version" dget :min-version env "github-token" dget :token draft-release-template ("version" min-version "body" release-body) =% :draft-release-body {} "application/vnd.github.v3+json" "Accept" dset "token $#" (token) =% "Authorization" dset :headers ( symbol handle-errors (dict :response ==>) ( response to-json "response.json" fwrite response "status" dget :status (status 300 >) ( response "body" dget from-json :body body "message" dget :message status string @status "Error $#: $#" (status message) =% io.error status int exit ) when ) ) :: ;; Handles HTTP errors. ( symbol gh-req (dict :data ==> dict|quot :result) ( data "endpoint" dget :endpoint "api" :subdomain (data 'subdomain dhas?) (data "subdomain" dget @subdomain) when "https://$#.github.com/repos/h3rald/min$#" (subdomain endpoint) =% :url {} url "url" dset data "method" dget "method" dset (data 'headers dhas?) (data "headers" dget "headers" dset) (headers "headers" dset) if (data 'body dhas?) (data "body" dget "body" dset) when request :response response "status" dget :status response "body" dget :body response handle-errors (body length 0 >) (body from-json) ({}) if @result ) ) :: ;; Execute a request using the Github API. ( symbol get-assets (dict :data ==> quot :result) ( data "id" dget :id {} "/releases/$#/assets" (id) =% "endpoint" dset "GET" "method" dset gh-req @result ) ) :: ;; Retrieve the assets from an existing Github release. ( symbol delete-assets (dict :config ==>) ( config get-assets :assets config "id" dget :id assets ("id" dget) map :assets-ids assets-ids ( :asset {} "/releases/assets/$#" (asset) =% "endpoint" dset "DELETE" "method" dset gh-req stack.pop ) foreach ) ) :: ;; Delete all assets from an existing Github release. #|| Tasks ||# ( symbol draft (==>) ( {} "/releases" "endpoint" dset "POST" "method" dset draft-release-body "body" dset gh-req "id" dget string :id ;; Save Release ID to min.yml config id "id" dset to-yaml "min.yml" fwrite "Draft release v$# ($#) created successfully" (min-version id) =% io.notice! ) ) :: ;; Creates a new draft release on Github. ( symbol update (==>) ( config "id" dget :id {} "/releases/$#" (id) =% "endpoint" dset "PATCH" "method" dset draft-release-body "body" dset gh-req "id" dget string :id "Draft release v$# ($#) updated successfully" (min-version id) =% io.notice! ) ) :: ;; Updates the text of the current draft Github release. ( symbol assets (==>) ( config get-assets =assets assets size :total "are" :verb (total 1 ==) ("is" @verb) when "There $# $# assets in release v$#" (verb total min-version) =% io.notice! assets ("name" dget () stack.cons "- $#" stack.swap % io.notice!) foreach ) ) :: ;; Retrieve a list of all the assets of the current draft Github release. ( symbol upload (==>) ( config "id" dget :id config delete-assets pwd ls ("\\.zip$" match?) filter ( filename :file "Uploading: $#" (file) =% io.notice! file fread :body headers "application/zip" "Content-Type" dset :asset-headers {} "/releases/$#/assets?name=$#" (id file) =% "endpoint" dset asset-headers "headers" dset "uploads" "subdomain" dset "POST" "method" dset body "body" dset gh-req stack.pop ) foreach ) ) :: ;; Uploads all assets to the current draft Github release, deleting any existing asset.
M
tasks/h3rald.min
→
tasks/h3rald.min
@@ -1,1 +1,1 @@
-#!/usr/bin/env minsystemsystem "_helpers" require :helpers 'helpers import config "version" dget :min-version "Min_DeveloperGuide.htm" :guide-file "../h3rald/assets/min/" guide-file suffix :h3rald-guide "../h3rald/contents/min.md" :h3rald-min-md "version:\\s+\\d+\\.\\d+\\.\\d+" :min-v-reg "version: $#" (min-version) =% :min-v-rep ( symbol update (==>) ( "Updating min Developer Guide and project on H3RALD.com..." notice! guide-file h3rald-guide cp h3rald-min-md fread min-v-reg min-v-rep replace :updated-contents updated-contents h3rald-min-md fwrite "Done." notice! ) ) :: ;; Updates the min Developer Guide and project page on H3RALD.com ( symbol build (==>) ( "git" required "hastysite" required "Pulling content and rebuilding H3RALD.com web site..." notice! ;; Assuming min and h3rald are siblings parent-dir cd "h3rald" cd "git pull" system "hastysite build" system parent-dir cd "min" cd ) ) :: ;; Builds H3RALD.com web site +#!/usr/bin/env minsystemsystem "_helpers" require :helpers 'helpers import config "version" dget :min-version "Min_DeveloperGuide.htm" :guide-file "../h3rald/assets/min/" guide-file suffix :h3rald-guide "../h3rald/contents/min.md" :h3rald-min-md "version:\\s+\\d+\\.\\d+\\.\\d+" :min-v-reg "version: $#" (min-version) =% :min-v-rep ( symbol update (==>) ( "Updating min Developer Guide and project on H3RALD.com..." io.notice! guide-file h3rald-guide cp h3rald-min-md fread min-v-reg min-v-rep replace :updated-contents updated-contents h3rald-min-md fwrite "Done." io.notice! ) ) :: ;; Updates the min Developer Guide and project page on H3RALD.com ( symbol build (==>) ( "git" required "hastysite" required "Pulling content and rebuilding H3RALD.com web site..." io.notice! ;; Assuming min and h3rald are siblings parent-dir cd "h3rald" cd "git pull" system "hastysite build" system parent-dir cd "min" cd ) ) :: ;; Builds H3RALD.com web site
M
tasks/help.min
→
tasks/help.min
@@ -1,1 +1,1 @@
-"tasks/data/doc-snippets.json" fread from-json :snippets "site/contents" ls ("reference-" match?) filter :src-files "(?sm)\\{#op\\|\\|([^|]+)\\|\\|([^|]+)\\|\\|([^|]+)\\|\\|(.+?)#\\}" :op-regex "(?sm)\\{#sig\\|\\|([^|]+)\\|\\|([^#]+)#\\}" :sig-regex "(?sm)\\{#alias\\|\\|([^|]+)\\|\\|([^#]+)#\\}" :alias-regex "(?sm)\\{\\{([^}]+)\\}\\}" :snippet-regex "(?sm)\\>( \\>)*" :block-regex "(?sm)%([^%]+)%" :title-regex "(?sm)\\{@[^@]+@\\}" :incl-regex "(?sm)`([^`]+)`" :code-regex ( symbol fix-name (str :s ==> str :result) ( s "!" (stack.pop "!") replace-apply """ (stack.pop "\"") replace-apply "|" (stack.pop "|") replace-apply "\\[" (stack.pop "") replace-apply "\\]" (stack.pop "") replace-apply "\\(class:kwd\\)" (stack.pop "") replace-apply ">" (stack.pop ">") replace-apply "<" (stack.pop "<") replace-apply "'" (stack.pop "'") replace-apply "*" (stack.pop "*") replace-apply @result ) ) :: ;; Fixes names with special characters ( symbol process-block-markup (str :s ==> str :result) ( s block-regex (stack.pop "") replace-apply title-regex (stack.pop "") replace-apply incl-regex (stack.pop "") replace-apply code-regex (1 get) replace-apply @result ) ) :: ;; Simplify block-level markup ( symbol process-snippets (str :s ==> str :result) ( s snippet-regex ( 1 get :id snippets id dget ) replace-apply @result ) ) :: ;; Resolves documentation snippets. ( symbol process (str :s ==> str :result) ( s process-snippets process-block-markup strip @result ) ) :: ;; Processes documentation snippets and markup. ( symbol process-op (quot :matches ==> dict :data) ( {} matches 1 get process fix-name "name" dset matches 2 get process fix-name :input matches 3 get process fix-name :output "$# ==> $#" (input output) =% "signature" dset matches 4 get process "description" dset "symbol" "kind" dset @data ) ) :: ;; Processes operator reference documentation. ( symbol process-alias (quot :matches ==> dict :data) ( {} matches 1 get process fix-name "name" dset matches 2 get :ref "See $#" (ref) =% "description" dset "symbol" "kind" dset @data ) ) :: ;; Processes alias reference documentation. ( symbol process-sig (quot :matches ==> dict :data) ( {} matches 1 get process fix-name "name" dset matches 2 get :ref "See $#" (ref) =% "description" dset "sigil" "kind" dset @data ) ) :: ;; Processes sigil reference documentation. ( symbol default (==>) ( {} :ref-dict {} :op-dict {} :sig-dict src-files ( :file file "reference-([a-z]+)\\.md" search 1 get :mod-id "Processing: $#" (mod-id) =% notice! file fread :contents contents op-regex search-all ( process-op :op op "name" dget :op-name op mod-id 'module dset @op op-dict op op-name dset @op-dict ) foreach contents alias-regex search-all ( process-alias :alias alias "name" dget :alias-name alias mod-id 'module dset @alias op-dict alias alias-name dset @op-dict ) foreach contents sig-regex search-all ( process-sig :sig sig "name" dget :sig-name sig mod-id 'module dset @sig sig-dict sig sig-name dset @sig-dict ) foreach ref-dict op-dict "symbols" dset sig-dict "sigils" dset @ref-dict ) foreach "Writing help.json" notice! ref-dict to-json "help.json" fwrite ) ) :: ;; Builds the reference help JSON sources. +"tasks/data/doc-snippets.json" fread from-json :snippets "site/contents" ls ("reference-" match?) filter :src-files "(?sm)\\{#op\\|\\|([^|]+)\\|\\|([^|]+)\\|\\|([^|]+)\\|\\|(.+?)#\\}" :op-regex "(?sm)\\{#sig\\|\\|([^|]+)\\|\\|([^#]+)#\\}" :sig-regex "(?sm)\\{#alias\\|\\|([^|]+)\\|\\|([^#]+)#\\}" :alias-regex "(?sm)\\{\\{([^}]+)\\}\\}" :snippet-regex "(?sm)\\>( \\>)*" :block-regex "(?sm)%([^%]+)%" :title-regex "(?sm)\\{@[^@]+@\\}" :incl-regex "(?sm)`([^`]+)`" :code-regex ( symbol fix-name (str :s ==> str :result) ( s "!" (stack.pop "!") replace-apply """ (stack.pop "\"") replace-apply "|" (stack.pop "|") replace-apply "\\[" (stack.pop "") replace-apply "\\]" (stack.pop "") replace-apply "\\(class:kwd\\)" (stack.pop "") replace-apply ">" (stack.pop ">") replace-apply "<" (stack.pop "<") replace-apply "'" (stack.pop "'") replace-apply "*" (stack.pop "*") replace-apply @result ) ) :: ;; Fixes names with special characters ( symbol process-block-markup (str :s ==> str :result) ( s block-regex (stack.pop "") replace-apply title-regex (stack.pop "") replace-apply incl-regex (stack.pop "") replace-apply code-regex (1 get) replace-apply @result ) ) :: ;; Simplify block-level markup ( symbol process-snippets (str :s ==> str :result) ( s snippet-regex ( 1 get :id snippets id dget ) replace-apply @result ) ) :: ;; Resolves documentation snippets. ( symbol process (str :s ==> str :result) ( s process-snippets process-block-markup strip @result ) ) :: ;; Processes documentation snippets and markup. ( symbol process-op (quot :matches ==> dict :data) ( {} matches 1 get process fix-name "name" dset matches 2 get process fix-name :input matches 3 get process fix-name :output "$# ==> $#" (input output) =% "signature" dset matches 4 get process "description" dset "symbol" "kind" dset @data ) ) :: ;; Processes operator reference documentation. ( symbol process-alias (quot :matches ==> dict :data) ( {} matches 1 get process fix-name "name" dset matches 2 get :ref "See $#" (ref) =% "description" dset "symbol" "kind" dset @data ) ) :: ;; Processes alias reference documentation. ( symbol process-sig (quot :matches ==> dict :data) ( {} matches 1 get process fix-name "name" dset matches 2 get :ref "See $#" (ref) =% "description" dset "sigil" "kind" dset @data ) ) :: ;; Processes sigil reference documentation. ( symbol default (==>) ( {} :ref-dict {} :op-dict {} :sig-dict src-files ( :file file "reference-([a-z]+)\\.md" search 1 get :mod-id "Processing: $#" (mod-id) =% io.notice! file fread :contents contents op-regex search-all ( process-op :op op "name" dget :op-name op mod-id 'module dset @op op-dict op op-name dset @op-dict ) foreach contents alias-regex search-all ( process-alias :alias alias "name" dget :alias-name alias mod-id 'module dset @alias op-dict alias alias-name dset @op-dict ) foreach contents sig-regex search-all ( process-sig :sig sig "name" dget :sig-name sig mod-id 'module dset @sig sig-dict sig sig-name dset @sig-dict ) foreach ref-dict op-dict "symbols" dset sig-dict "sigils" dset @ref-dict ) foreach "Writing help.json" io.notice! ref-dict to-json "help.json" fwrite ) ) :: ;; Builds the reference help JSON sources.
M
tasks/version.min
→
tasks/version.min
@@ -52,7 +52,7 @@ "" :new-version
false :valid-semver (valid-semver not) ( - "New version" ask @new-version + "New version" io.ask @new-version new-version semver? @valid-semver ) while new-version update-yaml-config
M
tests/all.min
→
tests/all.min
@@ -12,7 +12,6 @@ 'crypto load
'dict load 'dstore load 'fs load -'io load 'global load 'math load 'stack load
M
tests/fs.min
→
tests/fs.min
@@ -38,7 +38,13 @@
("./test" absolute-path? not) test.assert ("c:/windows" windows-path "c:\\windows" ==) test.assert - + + ("TEST" "test.txt" fwrite + "test.txt" fread "TEST" ==) test.assert + + (" - TEST" "test.txt" fappend + "test.txt" fread "TEST - TEST" ==) test.assert + test.report stack.clear "test.txt" rm
D
tests/io.min
@@ -1,14 +0,0 @@
-'min-test require :test -;;; - -"io" test.describe - - ("TEST" "test.txt" fwrite - "test.txt" fread "TEST" ==) test.assert - - (" - TEST" "test.txt" fappend - "test.txt" fread "TEST - TEST" ==) test.assert - - "test.txt" rm - test.report - stack.clear