all repos — min @ c5f03c63cd8879f5d8e7e92e3df5b2b05ef252ce

A small but practical concatenative programming language.

Regenerated help.
h3rald h3rald@h3rald.com
Sat, 15 Jun 2024 15:27:44 +0200
commit

c5f03c63cd8879f5d8e7e92e3df5b2b05ef252ce

parent

6ea28dd09a5ab9b9d1d1246bd4a045e953475066

3 files changed, 222 insertions(+), 129 deletions(-)

jump to
M help.jsonhelp.json

@@ -1,11 +1,49 @@

{ - "operators": { - "!": { - "description": "See system", - "kind": "symbol", - "module": "sys", - "name": "!" + "sigils": { + "$": { + "description": "See get-env", + "kind": "sigil", + "module": "global", + "name": "$" + }, + "'": { + "description": "See quotesym", + "kind": "sigil", + "module": "global", + "name": "'" + }, + ":": { + "description": "See define", + "kind": "sigil", + "module": "global", + "name": ":" + }, + "?": { + "description": "See help", + "kind": "sigil", + "module": "global", + "name": "?" + }, + "@": { + "description": "See bind", + "kind": "sigil", + "module": "global", + "name": "@" }, + "^": { + "description": "See lambda", + "kind": "sigil", + "module": "global", + "name": "^" + }, + "~": { + "description": "See lambda-bind", + "kind": "sigil", + "module": "global", + "name": "~" + } + }, + "symbols": { "!=": { "description": "Returns true if a1 is not equal to a2, false otherwise.", "kind": "symbol",

@@ -16,7 +54,7 @@ },

"$": { "description": "See get-env", "kind": "symbol", - "module": "sys", + "module": "global", "name": "$" }, "%": {

@@ -24,12 +62,6 @@ "description": "See interpolate",

"kind": "symbol", "module": "str", "name": "%" - }, - "&": { - "description": "See run", - "kind": "symbol", - "module": "sys", - "name": "&" }, "&&": { "description": "See expect-all",

@@ -75,20 +107,6 @@ "kind": "symbol",

"module": "num", "name": "-inf", "signature": " ==> num" - }, - ".": { - "description": "Returns the full path to the current directory.", - "kind": "symbol", - "module": "sys", - "name": ".", - "signature": " ==> str" - }, - "..": { - "description": "Returns the full path to the parent directory.", - "kind": "symbol", - "module": "sys", - "name": "..", - "signature": " ==> str" }, "/": { "description": "Divides num1 by num2.",

@@ -1189,7 +1207,7 @@ },

"get-env": { "description": "Returns environment variable 'sym.", "kind": "symbol", - "module": "sys", + "module": "global", "name": "get-env", "signature": "'sym ==> str" },

@@ -1345,13 +1363,6 @@ "kind": "symbol",

"module": "seq", "name": "intersection", "signature": "quot1 quot2 ==> quot3" - }, - "invoke": { - "description": "Assuming that 'sym is a formatted like *dictionary*/*symbol*, calls *symbol* defined in *dictionary* (note that this also works for nested dictionaries. \n \n \n Example\n \n The following program leaves 100 on the stack:\n \n {{100 :b} :a} :test *test/a/b", - "kind": "symbol", - "module": "global", - "name": "invoke", - "signature": "'sym ==> a*" }, "join": { "description": "Joins the elements of quot using separator 'sym, producing str.",

@@ -1695,6 +1706,13 @@ "module": "stack",

"name": "over", "signature": "a1 a2 ==> a1 a2 a1" }, + "parent-dir": { + "description": "Returns the full path to the parent directory.", + "kind": "symbol", + "module": "sys", + "name": "parent-dir", + "signature": " ==> str" + }, "parent-scope": { "description": "Returns a dictionary dict2 holding a reference to the parent scope of dict1 or null if dict1 is global.", "kind": "symbol",

@@ -1817,7 +1835,7 @@ },

"put-env": { "description": "Sets environment variable 'sym2 to 'sym1.", "kind": "symbol", - "module": "sys", + "module": "global", "name": "put-env", "signature": "'sym1 'sym2 ==> str" },

@@ -1835,6 +1853,13 @@ "module": "global",

"name": "puts", "signature": "a ==> a" }, + "pwd": { + "description": "Returns the full path to the current directory.", + "kind": "symbol", + "module": "sys", + "name": "pwd", + "signature": " ==> str" + }, "quit": { "description": "Exits the program or shell with 0 as return code.", "kind": "symbol",

@@ -2857,92 +2882,6 @@ },

"~": { "description": "See lambda-bind", "kind": "symbol", - "module": "global", - "name": "~" - } - }, - "sigils": { - "!": { - "description": "See system", - "kind": "sigil", - "module": "sys", - "name": "!" - }, - "$": { - "description": "See get-env", - "kind": "sigil", - "module": "sys", - "name": "$" - }, - "%": { - "description": "See dset", - "kind": "sigil", - "module": "dict", - "name": "%" - }, - "&": { - "description": "See run", - "kind": "sigil", - "module": "sys", - "name": "&" - }, - "'": { - "description": "See quotesym", - "kind": "sigil", - "module": "global", - "name": "'" - }, - "*": { - "description": "See invoke", - "kind": "sigil", - "module": "global", - "name": "*" - }, - "/": { - "description": "See dget", - "kind": "sigil", - "module": "dict", - "name": "/" - }, - ":": { - "description": "See define", - "kind": "sigil", - "module": "global", - "name": ":" - }, - "<": { - "description": "See load-symbol", - "kind": "sigil", - "module": "global", - "name": "<" - }, - ">": { - "description": "See save-symbol", - "kind": "sigil", - "module": "global", - "name": ">" - }, - "?": { - "description": "See help", - "kind": "sigil", - "module": "global", - "name": "?" - }, - "@": { - "description": "See bind", - "kind": "sigil", - "module": "global", - "name": "@" - }, - "^": { - "description": "See lambda", - "kind": "sigil", - "module": "global", - "name": "^" - }, - "~": { - "description": "See lambda-bind", - "kind": "sigil", "module": "global", "name": "~" }
M minpkg/lib/min_global.nimminpkg/lib/min_global.nim

@@ -616,8 +616,8 @@ var doc = i.fromJson(sym.doc)

doc.objType = "help" i.push doc return - elif HELP["operators"].hasKey(s): - var doc = i.fromJson(HELP["operators"][s]) + elif HELP["symbols"].hasKey(s): + var doc = i.fromJson(HELP["symbols"][s]) doc.objType = "help" i.push doc return

@@ -633,8 +633,8 @@ var doc = i.fromJson(sym.doc)

doc.objType = "help" i.push doc return - elif HELP["operators"].hasKey(s): - var doc = i.fromJson(HELP["operators"][s]) + elif HELP["symbols"].hasKey(s): + var doc = i.fromJson(HELP["symbols"][s]) doc.objType = "help" i.push doc return

@@ -674,10 +674,10 @@ if s.contains('.'):

let parts = s.split(".") mdl = parts[0] s = parts[1] - if HELP["operators"].hasKey(s) and (mdl == "" or mdl == HELP["operators"][ + if HELP["symbols"].hasKey(s) and (mdl == "" or mdl == HELP["symbols"][ s]["module"].getStr): foundDoc = true - displayDoc HELP["operators"][s] + displayDoc HELP["symbols"][s] if i.scope.hasSigil(s): found = true let sym = i.scope.getSigil(s)
M tasks/help.mintasks/help.min

@@ -1,1 +1,155 @@

-"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 "operators" 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;" (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.