Renamed get-stack, set-stack, clear-stack into stack, unstack, newstack.
h3rald h3rald@h3rald.com
Sun, 26 Mar 2017 11:50:02 +0200
13 files changed,
30 insertions(+),
33 deletions(-)
M
lib/min_lang.nim
→
lib/min_lang.nim
@@ -604,21 +604,6 @@ i.push @[m].newVal(i.scope)
i.push s i.push "define".newSym - .symbol("clear-stack") do (i: In): - while i.stack.len > 0: - discard i.pop - - .symbol("dump-stack") do (i: In): - echo i.dump - - .symbol("get-stack") do (i: In): - i.push i.stack.newVal(i.scope) - - .symbol("set-stack") do (i: In): - var q: MinValue - i.reqQuotation q - i.stack = q.qVal - # Sigils .sigil("'") do (i: In):
M
lib/min_stack.nim
→
lib/min_stack.nim
@@ -11,6 +11,18 @@ # Operations on the whole stack
proc stack_module*(i: In)= i.define() + + .symbol("newstack") do (i: In): + while i.stack.len > 0: + discard i.pop + + .symbol("stack") do (i: In): + i.push i.stack.newVal(i.scope) + + .symbol("unstack") do (i: In): + var q: MinValue + i.reqQuotation q + i.stack = q.qVal .symbol("id") do (i: In): discard
M
min.vim
→
min.vim
@@ -11,7 +11,7 @@
setl iskeyword=@,36-39,+,-,/,*,.,:,~,!,48-57,60-65,94-95,192-255 setl iskeyword+=^ -syntax keyword minDefaultSymbol ! != $ & ' * + # - % ^ -> . .. / : < <= == => =~ > >= @ ROOT aes and append ask at atime b bind bool bool? bury1 bury2 bury3 c call call! capitalize case cd chmod choose clear-stack column-print concat confirm cons cp cpu crypto ctime datetime ddel debug decode define delete dget dictionary? dig1 dig2 dig3 dip dir? dirname div dprint dprint! dset dump-stack dup dupd encode env? error eval even? exists? exit fappend fatal file? filename filter first float float? foreach fperms fread from-json format-error fs fsize fstats ftype fwrite gets get-stack getenv hardlink hidden? id ift ifte import indent info inspect int int? interpolate interval io join k keys length linrec load load-symbol logic loglevel loglevel? lowercase ls ls-r map match md5 mkdir mod module module-symbols module-sigils mtime mv newline not notice now num number? odd? os password pop popd pred prepend print print! prompt publish puts puts! putenv q quotation? quote quote-bind quote-define random raise regex remove-symbol repeat replace rest rm rmdir run save-symbol scope scope? seal search set-stack sha1 sha224 sha256 sha384 sha512 sigils sip size sleep sort source split startup stored-symbols str string string? strip succ swap swapd swons symbols symlink symlink? sys system take tformat time timeinfo times timestamp titleize to-json try unquote uppercase unzip values version warn which while with xor zip contains +syntax keyword minDefaultSymbol ! != $ & ' * + # - % ^ -> . .. / : < <= == => =~ > >= @ ROOT aes and append ask at atime b bind bool bool? bury1 bury2 bury3 c call call! capitalize case cd chmod choose column-print concat confirm cons cp cpu crypto ctime datetime ddel debug decode define delete dget dictionary? dig1 dig2 dig3 dip dir? dirname div dprint dprint! dset dup dupd encode env? error eval even? exists? exit fappend fatal file? filename filter first float float? foreach fperms fread from-json format-error fs fsize fstats ftype fwrite gets getenv hardlink hidden? id ift ifte import indent info inspect int int? interpolate interval io join k keys length linrec load load-symbol logic loglevel loglevel? lowercase ls ls-r map match md5 mkdir mod module module-symbols module-sigils mtime mv newline newstack not notice now num number? odd? os password pop popd pred prepend print print! prompt publish puts puts! putenv q quotation? quote quote-bind quote-define random raise regex remove-symbol repeat replace rest rm rmdir run save-symbol scope scope? seal search sha1 sha224 sha256 sha384 sha512 sigils sip size sleep sort source split stack startup stored-symbols str string string? strip succ swap swapd swons symbols symlink symlink? sys system take tformat time timeinfo times timestamp titleize to-json try unquote unstack uppercase unzip values version warn which while with xor zip contains syntax match minDefaultSigil ;\<[:@'~!$%&$=<>#^*#+/]; contained
M
tests/crypto.min
→
tests/crypto.min
@@ -20,4 +20,4 @@
("test" "test" aes "test" aes strip "test" ==) assert report - clear-stack + newstack
M
tests/fs.min
→
tests/fs.min
@@ -16,5 +16,5 @@
("test.txt" fstats 'type dget "file" ==) assert report - clear-stack + newstack "test.txt" rm
M
tests/io.min
→
tests/io.min
@@ -11,4 +11,4 @@ "test.txt" fread "TEST - TEST" ==) assert
"test.txt" rm report - clear-stack + newstack
M
tests/lang.min
→
tests/lang.min
@@ -68,9 +68,9 @@ "tests/testload.min" rm
(2 2 mymath ^myplus 4 ==) assert - (1 2 3 4 get-stack (1 2 3 4) ==) assert + (1 2 3 4 stack (1 2 3 4) ==) assert - ((1 2 3) set-stack get-stack (1 2 3) ==) assert + ((1 2 3) unstack stack (1 2 3) ==) assert ((1 2) (3 4) concat (1 2 3 4) ==) assert@@ -80,7 +80,7 @@ ((1 2 3) rest (2 3) ==) assert
(2 quote (2) ==) assert - ((2 3) unquote get-stack (2 3) ==) assert + ((2 3) unquote stack (2 3) ==) assert (4 (1 2 3) append (1 2 3 4) ==) assert@@ -116,7 +116,7 @@ (
(pop) ('error dget) ("finally") - ) try get-stack ("MinEmptyStackError" "finally") ==) assert + ) try stack ("MinEmptyStackError" "finally") ==) assert ("aaaa" :cd cd "aaaa" ==) assert ;It is possible to shadow sealed symbols in child scopes@@ -136,7 +136,7 @@ ('error dget)
) try "TestError" ==) assert ( - (("test" (1 2) :)) try get-stack ("test") ==) assert + (("test" (1 2) :)) try stack ("test") ==) assert ( (@@ -192,4 +192,4 @@ (sys module-sigils ("!" "$" "&") ==) assert
report ; Tidy up - clear-stack + newstack
M
tests/logic.min
→
tests/logic.min
@@ -133,4 +133,4 @@ (false quotation? false ==) assert
(("a" 2 c) quotation?) assert report - clear-stack + newstack
M
tests/num.min
→
tests/num.min
@@ -31,4 +31,4 @@
(1000 random 1000 <) assert report - clear-stack + newstack
M
tests/stack.min
→
tests/stack.min
@@ -7,9 +7,9 @@ (1 id 1 ==) assert
(2 id 2 ==) assert - (2 pop get-stack () ==) assert + (2 pop stack () ==) assert - (1 dup get-stack (1 1) ==) assert + (1 dup stack (1 1) ==) assert (3 2 (1 +) dip + 6 ==) assert@@ -18,4 +18,4 @@
(1 (2 3) cons (1 2 3) ==) assert report - clear-stack + newstack
M
tests/str.min
→
tests/str.min
@@ -68,4 +68,4 @@
("3.678" float 3.678 ==) assert report - clear-stack + newstack
M
tests/time.min
→
tests/time.min
@@ -14,4 +14,4 @@
(1464951736 timeinfo 'second dget 16 ==) assert report - clear-stack + newstack