all repos — min @ d54af16f3ff74d1d170e00c8b292f4e2fdbf395e

A small but practical concatenative programming language.

Corrections for #140
h3rald h3rald@h3rald.com
Sun, 07 Feb 2021 22:15:53 +0000
commit

d54af16f3ff74d1d170e00c8b292f4e2fdbf395e

parent

768d9cd8afce138c2f3edf1bba8fd33ba62f024c

3 files changed, 8 insertions(+), 6 deletions(-)

jump to
M minpkg/core/utils.nimminpkg/core/utils.nim

@@ -45,14 +45,14 @@ proc dget*(i: In, q: MinValue, s: MinValue): MinValue =

if not q.isDictionary: raiseInvalid("Value is not a dictionary") if q.dVal[s.getString].kind == minProcOp: - raiseInvalid("Key '$1' is set to a native value that cannot be retrieved." % [s.getString]) + raiseInvalid("Key '$1' is set to an operator and it cannot be retrieved." % [s.getString]) result = q.dVal[s.getString].val proc dget*(i: In, q: MinValue, s: string): MinValue = if not q.isDictionary: raiseInvalid("Value is not a dictionary") if q.dVal[s].kind == minProcOp: - raiseInvalid("Key $1 is set to a native value that cannot be retrieved." % [s]) + raiseInvalid("Key $1 is set to an operator and it cannot be retrieved." % [s]) result = q.dVal[s].val proc dhas*(q: MinValue, s: MinValue): bool =

@@ -103,7 +103,7 @@ # Assumes q is a dictionary

var r = newSeq[MinValue](0) for item in q.dVal.values: if item.kind == minProcOp: - raiseInvalid("Dictionary contains native values that cannot be accessed.") + raiseInvalid("Dictionary contains operators that cannot be accessed.") r.add item.val return r.newVal

@@ -112,7 +112,7 @@ # Assumes q is a dictionary

var r = newSeq[MinValue](0) for key, value in q.dVal.pairs: if value.kind == minProcOp: - raiseInvalid("Dictionary contains native values that cannot be accessed.") + raiseInvalid("Dictionary contains operators that cannot be accessed.") r.add key.newVal r.add value.val return r.newVal
M minpkg/lib/min_lang.nimminpkg/lib/min_lang.nim

@@ -686,7 +686,7 @@ let sym = i.scope.getSymbol(str)

if sym.kind == minValOp: i.push sym.val else: - raiseInvalid("No source available for native symbol '$1'." % str) + raiseInvalid("Unable to display source: '$1' is an operator." % str) def.symbol("invoke") do (i: In): let vals = i.expect("'sym")

@@ -701,7 +701,8 @@ let mdl = vals[0]

let symId = parts[p+1] let origScope = i.scope i.scope = mdl.scope - i.scope.parent = origScope + if not i.scope.parent.isNil: + i.scope.parent = origScope let sym = i.scope.getSymbol(symId) i.apply(sym) i.scope = origScope
M next-release.mdnext-release.md

@@ -4,6 +4,7 @@ * #141 - The **'** symbol is now an alias of the **quotesym** symbol (but its behavior remains the same: it can be used to created quotes symbols from a string), and the **'** sigil is equivalent to the new **quotesym** symbol, not **quote**.

### Fixes +* #140 - It is now possible to invoke symbols on ROOT. * #147 - Fixed an error when processing operator output values. * Now adding **help.json** to installation folder when installing via nimble. * #151 - Added documentation for **integer**.