all repos — min @ 877cfd95409ab21b1ec1ec77c24249bf1411b2fb

A small but practical concatenative programming language.

stack module is no longer imported.
h3rald h3rald@h3rald.com
Sat, 03 Aug 2024 15:04:45 +0200
commit

877cfd95409ab21b1ec1ec77c24249bf1411b2fb

parent

7e67cd88c1be12ebcd1ee4bbed1d2ee68056559e

M minpkg/lib/min_stack.nimminpkg/lib/min_stack.nim

@@ -1,31 +1,28 @@

-import - ../core/parser, - ../core/value, - ../core/interpreter, +import + ../core/parser, + ../core/value, + ../core/interpreter, ../core/utils -proc stack_module*(i: In)= +proc stack_module*(i: In) = let def = i.define() - def.symbol("clear-stack") do (i: In): + def.symbol("clear") do (i: In): while i.stack.len > 0: discard i.pop - def.symbol("get-stack") do (i: In): + def.symbol("get") do (i: In): i.push i.stack.newVal - def.symbol("set-stack") do (i: In): + def.symbol("set") do (i: In): let vals = i.expect("quot") let q = vals[0] i.stack = q.qVal - - def.symbol("id") do (i: In): - discard - + def.symbol("pop") do (i: In): discard i.pop - + def.symbol("dup") do (i: In): i.push i.peek

@@ -40,7 +37,7 @@ def.symbol("nip") do (i: In):

let vals = i.expect("a", "a") let a = vals[0] i.push a - + def.symbol("cleave") do (i: In): var q: MinValue i.reqQuotationOfQuotations q

@@ -49,7 +46,7 @@ for s in q.qVal:

var s1 = s i.push v i.dequote(s1) - + def.symbol("spread") do (i: In): var q: MinValue i.reqQuotationOfQuotations q

@@ -62,7 +59,7 @@ var s1 = s

i.push els[count] i.dequote(s1) count.dec - + def.symbol("keep") do (i: In): let vals = i.expect("quot", "a") var q = vals[0]

@@ -70,7 +67,7 @@ let v = vals[1]

i.push v i.dequote(q) i.push v - + def.symbol("swap") do (i: In): let vals = i.expect("a", "a") let a = vals[0]

@@ -123,7 +120,7 @@

def.symbol("swons") do (i: In): i.pushSym "swap" i.pushSym "cons" - + def.symbol("sip") do (i: In): let vals = i.expect("quot", "quot") var a = vals[0]

@@ -131,11 +128,5 @@ let b = vals[1]

i.push b i.dequote(a) i.push b - - def.symbol("getstack") do (i: In): - i.pushSym("get-stack") - - def.symbol("setstack") do (i: In): - i.pushSym("set-stack") def.finalize("stack")
M next-release.mdnext-release.md

@@ -5,6 +5,14 @@ - All symbols defined in the **logic** module have been moved to the **global** module.

- 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: 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). ### New Features
M prelude.minprelude.min

@@ -1,5 +1,4 @@

; Imports -'stack import 'dict import 'time import 'io import
M site/contents/reference-stack.mdsite/contents/reference-stack.md

@@ -4,7 +4,7 @@ title: "stack Module"

----- {@ _defs_.md || 0 @} -{#op||clear-stack||{{any}}||{{none}}|| +{#op||clear||{{any}}||{{none}}|| Empties the stack.#} {#op||cleave||{{a1}} ({{q}}{{0p}})||{{a0p}}||

@@ -25,9 +25,7 @@

{#op||dup||{{a1}}||{{a1}} {{a1}}|| Duplicates the first element on the stack.#} -{#alias||getstack||get-stack#} - -{#op||get-stack||{{none}}||({{a0p}})|| +{#op||get||{{none}}||({{a0p}})|| Puts a quotation containing the contents of the stack on the stack.#} {#op||id||{{none}}||{{none}}||

@@ -60,9 +58,7 @@

{#op||rollup||{{a1}} {{a2}} {{a3}}||{{a3}} {{a2}} {{a1}}|| Moves the third and second element into second and third position and moves the first element into third position.#} -{#alias||setstack||set-stack#} - -{#op||set-stack||{{q}}||{{a0p}}|| +{#op||set||{{q}}||{{a0p}}|| Substitute the existing stack with the contents of {{q}}.#} {#op||sip||{{q1}} {{q2}}||{{a0p}} {{q1}}||
M tasks/build.mintasks/build.min

@@ -1,137 +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 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) =% 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.
M tasks/github.mintasks/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 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 () cons "- $#" 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 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) =% 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.
M tasks/h3rald.mintasks/h3rald.min

@@ -1,39 +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..." 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
M tasks/help.mintasks/help.min

@@ -1,155 +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 - "&excl;" (pop "!") replace-apply - "&quot;" (pop "\"") replace-apply - "&#124;" (pop "|") replace-apply - "\\[" (pop "") replace-apply - "\\]" (pop "") replace-apply - "\\(class:kwd\\)" (pop "") replace-apply - "&gt;" (pop ">") replace-apply - "&lt;" (pop "<") replace-apply - "&apos;" (pop "'") replace-apply - "&ast;" (pop "*") replace-apply - @result - ) -) :: -;; Fixes names with special characters -( - symbol process-block-markup - (str :s ==> str :result) - ( - s - block-regex (pop "") replace-apply - title-regex (pop "") replace-apply - incl-regex (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 "&excl;" (stack.pop "!") replace-apply "&quot;" (stack.pop "\"") replace-apply "&#124;" (stack.pop "|") replace-apply "\\[" (stack.pop "") replace-apply "\\]" (stack.pop "") replace-apply "\\(class:kwd\\)" (stack.pop "") replace-apply "&gt;" (stack.pop ">") replace-apply "&lt;" (stack.pop "<") replace-apply "&apos;" (stack.pop "'") replace-apply "&ast;" (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.
M tasks/version.mintasks/version.min

@@ -36,7 +36,7 @@ ('sym :new-version ==>)

( "(version\\s+=\\s*)([^\\s]+)(\\s*)" :version-regexp nimble-data version-regexp - (dup 1 get :start 3 get :end "$#\"$#\"$#" (start new-version end) =%) replace-apply @nimble-data + (stack.dup 1 get :start 3 get :end "$#\"$#\"$#" (start new-version end) =%) replace-apply @nimble-data nimble-data nimble-cfg fwrite ) ) ::
M tests/crypto.mintests/crypto.min

@@ -22,4 +22,4 @@

("test" "test" aes "test" aes strip "test" ==) test.assert test.report - clear-stack + stack.clear
M tests/dict.mintests/dict.min

@@ -51,4 +51,4 @@ {1 :a 2 :b 3 :c} dpairs ((1 "a") (2 "b") (3 "c")) ==

) test.assert test.report - clear-stack + stack.clear
M tests/dstore.mintests/dstore.min

@@ -12,7 +12,7 @@ {}

1 "test1" dset 2 "test2" dset dspost dswrite - "tests" (pop true) dsquery size 1 == + "tests" (stack.pop true) dsquery size 1 == ) test.assert (

@@ -34,4 +34,4 @@

"dstore.json" rm test.report - clear-stack + stack.clear
M tests/fs.mintests/fs.min

@@ -40,5 +40,5 @@

("c:/windows" windows-path "c:\\windows" ==) test.assert test.report - clear-stack + stack.clear "test.txt" rm
M tests/global.mintests/global.min

@@ -19,7 +19,7 @@

( :item "_$1" (item) => % :namesym - item (dup *) cons namesym define + item (stack.dup *) stack.cons namesym define namesym global publish ) :def

@@ -30,7 +30,7 @@ 30 ==

) test.assert ( - (dup *) ^square + (stack.dup *) ^square 3 square 9 == ) test.assert

@@ -47,7 +47,7 @@ "tests/testrequire.min" rm

(2 quote (2) ==) test.assert - ((2 3) dequote get-stack (2 3) ==) test.assert + ((2 3) dequote stack.get (2 3) ==) test.assert (3 (succ) 3 times 6 ==) test.assert

@@ -64,14 +64,14 @@ (1 type "int" ==) test.assert

({} type "dict" ==) test.assert (global type "dict:module" ==) test.assert - (5 (dup 0 ==) (1 +) (dup 1 -) ( * ) linrec 120 ==) test.assert ;;factorial of 5 + (5 (stack.dup 0 ==) (1 +) (stack.dup 1 -) ( * ) linrec 120 ==) test.assert ;;factorial of 5 ( ( - (pop) + (stack.pop) ('error dget) ("finally") - ) try get-stack ("MinEmptyStackError" "finally") ==) test.assert + ) try stack.get ("MinEmptyStackError" "finally") ==) test.assert ("aaaa" :cd cd "aaaa" ==) test.assert ;;It is possible to shadow sealed symbols in child scopes

@@ -91,7 +91,7 @@ ("error" dget)

) try "TestError" ==) test.assert ( - (("test" °test :)) try get-stack ("test") ==) test.assert + (("test" °test :)) try stack.get ("test") ==) test.assert ( (

@@ -170,8 +170,8 @@ ("3.678" float 3.678 ==) test.assert

( {1 :a 2 :b 3 :c} ( - (dup "a" dget succ succ "a" dset) - (dup "b" dget succ "b" dset) + (stack.dup "a" dget succ succ "a" dset) + (stack.dup "b" dget succ "b" dset) ) tap {3 :a 3 :b 3 :c} == ) test.assert

@@ -188,9 +188,9 @@

( "" :s1 "test" ( - (' "1" swap append "" join) - (' "2" swap append "" join) - (' "3" swap append "" join @s1 s1) + (' "1" stack.swap append "" join) + (' "2" stack.swap append "" join) + (' "3" stack.swap append "" join @s1 s1) ) tap! s1 "test123" == ) test.assert

@@ -235,7 +235,7 @@ (num :base int :exp ==> num :pr num :mr)

( exp 1 - :n base exp * @mr - base (dup) n times (*) n times @pr + base (stack.dup) n times (*) n times @pr ) ) operator 2 4 pow-mul - 8 ==

@@ -281,7 +281,7 @@ (

(3 -3 natural-sum) (@err) ) try - pop ;;Remove 3 that was left on the stack. + stack.pop ;;Remove 3 that was left on the stack. (err format-error "expected: natural natural natural-sum" match?) test.assert (2 3 natural-sum 5 ==) test.assert )

@@ -370,7 +370,7 @@ ) test.assert

( {} :obj - (dup *) ^square + (stack.dup *) ^square 3 obj.square 9 == ) test.assert

@@ -714,10 +714,10 @@ ("http%3A%2F%2Ftest.com%3F%E2%82%AC%25%2C%2C%21%7B%7D" decode-url "http://test.com?€%,,!{}" ==) test.assert

("http://h3rald.com/a/b/c?test=1#123" parse-url {"123" :anchor "h3rald.com" :hostname "" :password "/a/b/c" :path "" :port "test=1" :query "http" :scheme "" :username} ==) test.assert - ("0b00101101" dup from-bin to-bin ==) test.assert - ("0x00FF0000" dup from-hex to-hex ==) test.assert - ("0o00007473" dup from-oct to-oct ==) test.assert - ("123" dup from-dec to-dec ==) test.assert + ("0b00101101" stack.dup from-bin to-bin ==) test.assert + ("0x00FF0000" stack.dup from-hex to-hex ==) test.assert + ("0o00007473" stack.dup from-oct to-oct ==) test.assert + ("123" stack.dup from-dec to-dec ==) test.assert ;; Sequence operations

@@ -773,9 +773,9 @@ ((1 2 3 4 5) (2 >) find 2 ==) test.assert

((1 2 3 4 5) 1 (*) reduce 120 ==) test.assert - ((1 3 5) (dup *) (+) map-reduce 35 ==) test.assert + ((1 3 5) (stack.dup *) (+) map-reduce 35 ==) test.assert - ((1 2 3 4 5 6) (odd?) partition get-stack ((1 3 5) (2 4 6)) ==) test.assert + ((1 2 3 4 5 6) (odd?) partition stack.get ((1 3 5) (2 4 6)) ==) test.assert ((1 2 3 4 5 6) (odd?) reject (2 4 6) ==) test.assert

@@ -809,4 +809,4 @@ ((1 2 "test") ("test" "a" true 1) symmetric-difference (true "a" 2) ==) test.assert

test.report ;; Tidy up - clear-stack + stack.clear
M tests/http.mintests/http.min

@@ -57,4 +57,4 @@ ) tap "body" dget from-json "url" dget "https?:\\/\\/$1/delete" (host) => % match?

) test.assert test.report - clear-stack + stack.clear
M tests/io.mintests/io.min

@@ -11,4 +11,4 @@ "test.txt" fread "TEST - TEST" ==) test.assert

"test.txt" rm test.report - clear-stack + stack.clear
M tests/logic.mintests/logic.min

@@ -5,4 +5,4 @@ "logic" test.describe

test.report - clear-stack + stack.clear
M tests/math.mintests/math.min

@@ -32,4 +32,4 @@

(-2.87 abs 2.87 ==) test.assert test.report - clear-stack + stack.clear
M tests/net.mintests/net.min

@@ -32,7 +32,7 @@ (srv1 srv2 ==) test.assert

(cli1 cli2 !=) test.assert test.report - clear-stack + stack.clear srv1 close srv2 close cli1 close
M tests/stack.mintests/stack.min

@@ -3,35 +3,34 @@ ;;;

"stack" test.describe - (1 2 3 4 get-stack (1 2 3 4) ==) test.assert + (1 2 3 4 stack.get (1 2 3 4) ==) test.assert - ((1 2 3) set-stack get-stack (1 2 3) ==) test.assert + ((1 2 3) stack.set stack.get (1 2 3) ==) test.assert - (1 id 1 ==) test.assert - (2 pop get-stack () ==) test.assert + (2 stack.pop stack.get () ==) test.assert - (1 dup get-stack (1 1) ==) test.assert + (1 stack.dup stack.get (1 1) ==) test.assert - (3 2 (1 +) dip + 6 ==) test.assert + (3 2 (1 +) stack.dip + 6 ==) test.assert - (1 2 nip get-stack (2) ==) test.assert + (1 2 stack.nip stack.get (2) ==) test.assert - (1 2 4 '+ dip get-stack (3 4) ==) test.assert + (1 2 4 '+ stack.dip stack.get (3 4) ==) test.assert - (1 2 4 '+ keep get-stack (1 6 4) ==) test.assert + (1 2 4 '+ stack.keep stack.get (1 6 4) ==) test.assert - ((1) (2 swap append) sip concat (1 2 1) ==) test.assert + ((1) (2 stack.swap append) stack.sip concat (1 2 1) ==) test.assert - (1 (2 3) cons (1 2 3) ==) test.assert + (1 (2 3) stack.cons (1 2 3) ==) test.assert - (1 2 over get-stack (1 2 1) ==) test.assert + (1 2 stack.over stack.get (1 2 1) ==) test.assert - (1 2 3 pick get-stack (1 2 3 1) ==) test.assert + (1 2 3 stack.pick stack.get (1 2 3 1) ==) test.assert - ((1 2 3) ('sum 'size) => cleave / 2 ==) test.assert + ((1 2 3) ('sum 'size) => stack.cleave / 2 ==) test.assert - ((1 2) (3 4) ((0 get) (1 get)) spread get-stack (1 4) ==) test.assert + ((1 2) (3 4) ((0 get) (1 get)) stack.spread stack.get (1 4) ==) test.assert test.report - clear-stack + stack.clear
M tests/sys.mintests/sys.min

@@ -66,5 +66,5 @@

([ls] "ls" run "output" dget ==) test.assert test.report - clear-stack + stack.clear "systest" rmdir
M tests/time.mintests/time.min

@@ -18,4 +18,4 @@

(1464951736 timeinfo 'timezone dget integer?) test.assert test.report - clear-stack + stack.clear
M tests/xml.mintests/xml.min

@@ -49,4 +49,4 @@ "This is a <i>test</i>" xescape "This is a &lt;i&gt;test&lt;/i&gt;" ==

) test.assert test.report - clear-stack + stack.clear