Implemented define-sigil.
h3rald h3rald@h3rald.com
Sat, 26 Oct 2024 20:07:50 +0200
7 files changed,
29 insertions(+),
77 deletions(-)
M
min.nimble
→
min.nimble
@@ -1,6 +1,6 @@
# Package -version = "0.45.0" +version = "0.46.0" author = "Fabio Cevasco" description = "A small but practical concatenative programming language and shell." license = "MIT"@@ -17,3 +17,4 @@ requires "checksums >= 0.2.1"
requires "zippy >= 0.5.6 & < 0.6.0" requires "nimquery >= 2.0.1 & < 3.0.0" requires "minline >= 0.1.2 & < 0.2.0" +requires "htmlparser >= 0.1.0 & < 0.2.0"
M
minpkg/lib/min_global.nim
→
minpkg/lib/min_global.nim
@@ -579,6 +579,20 @@ raiseUndefined("Attempting to redefine sealed symbol '$1'" % [symbol])
i.scope.symbols[symbol] = MinOperator(kind: minValOp, val: q1, sealed: false, quotation: true) + def.symbol("define-sigil") do (i: In): + let vals = i.expect("'sym", "quot") + let sym = vals[0] + var q1 = vals[1] + var symbol: string + symbol = sym.getString + if not symbol.contains re(USER_SYMBOL_REGEX): + raiseInvalid("Sigil identifier '$1' contains invalid characters." % symbol) + info "[define-sigil] $1 = $2" % [symbol, $q1] + if i.scope.sigils.hasKey(symbol) and i.scope.sigils[symbol].sealed: + raiseUndefined("Attempting to redefine sealed sigil '$1'" % [symbol]) + i.scope.sigils[symbol] = MinOperator(kind: minValOp, val: q1, sealed: false, + quotation: true) + def.symbol("bind") do (i: In): let vals = i.expect("'sym", "a") let sym = vals[0]
M
minpkg/lib/min_xml.nim
→
minpkg/lib/min_xml.nim
@@ -3,11 +3,11 @@ import
std/[xmlparser, xmltree, parsexml, - htmlparser, strtabs, critbits] import - nimquery + pkg/htmlparser, + pkg/nimquery import ../core/parser, ../core/value,
M
next-release.md
→
next-release.md
@@ -1,74 +1,4 @@
-### BREAKING CHANGES - -- All symbols defined in the **num** module have been moved to the **global** module. -- 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). -- 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). -- The **fs** module is no longer imported. -- **fs** module: renamed **fperms** to **fs.permissions** -- **fs** module: renamed **fsize** to **fs.size** -- **fs** module: renamed **fstats** to **fs.stats** -- **fs** module: renamed **ftype** to **fs.type** -- The **time** module is no longer imported. -- **time** module: renamed **tformat** to **time.format** -- **time** module: renamed **timeinfo** to **time.info** -- **time** module: renamed **timestamp** to **time.stamp** -- The **dict** module is no longer imported. -- **dict** module: renamed **dhas?** to **dict.has?** -- **dict** module: renamed **dget** to **dict.get** -- **dict** module: renamed **dget-raw** to **dict.get-raw** -- **dict** module: renamed **dset** to **dict.set** -- **dict** module: renamed **dset-sym** to **dict.set-sym** -- **dict** module: renamed **ddel** to **dict.del** -- **dict** module: renamed **dkeys** to **dict.keys** -- **dict** module: renamed **dvalues** to **dict.values** -- **dict** module: renamed **dpairs** to **dict.pairs** -- **dict** module: renamed **ddup** to **dict.dup** -- **dict** module: renamed **dpick** to **dict.pick** -- **dict** module: renamed **dtype** to **dict.type** -- The **sys** module is no longer imported. -- The **dstore** module has been renamed to **store**, and is no longer imported. -- **store** module: renamed **dsinit** to **store.init** -- **store** module: renamed **dsget** to **store.get** -- **store** module: renamed **dshas?** to **store.has?** -- **store** module: renamed **dsput** to **store.put** -- **store** module: renamed **dspost** to **store.post** -- **store** module: renamed **dsdelete** to **store.delete** -- **store** module: renamed **dsquery** to **store.query** -- **store** module: renamed **dswrite** to **store.write** -- **store** module: renamed **dsread** to **store.read** -- The **crypto** module is no longer imported. -- The **math** module is no longer imported. -- **math** module: renamed **r2g** to **math.r2d** -- The **net** module is no longer imported. -- The **http** module is no longer imported. -- The **xml** module is no longer imported. -- **xml** module: renamed **xcomment** to **xml.comment** -- **xml** module: renamed **xentity** to **xml.entity** -- **xml** module: renamed **xtext** to **xml.text** -- **xml** module: renamed **xentity2utf8** to **xml.entity2utf8** -- **xml** module: renamed **xcdata** to **xml.cdata** -- **xml** module: renamed **xescape** to **xml.escape** -- **xml** module: renamed **xelement** to **xml.element** -- **xml** module: renamed **xquery** to **xml.query** -- **xml** module: renamed **xqueryall** to **xml.query-all** -- The **prompt** symbol is no longer unsealed. +### Fixes and Improvements -### Fixes and Improvements +* Implemented `define-sigil` (was documented but not actually implemented). -* Upgraded OpenSSL to v3.3.2.
M
site/settings.json
→
site/settings.json
@@ -6,5 +6,5 @@ "rules": "rules.min",
"temp": "temp", "templates": "templates", "title": "min language", - "version": "0.45.0" + "version": "0.46.0" }
M
tests/global.min
→
tests/global.min
@@ -221,6 +221,13 @@ ) ::
'x unseal-sigil 'x delete-sigil 'x defined-sigil? false == ) test.assert + + ( + 'from-json 'j define-sigil + j"{\"test\": true}" + 'j delete-sigil + {true :test} == + ) test.assert ( {{100 :b} :a} :test test.a.b 100 ==