all repos — min @ 1456f290e02e96e6641c042ff229a7e3f52e4db2

A small but practical concatenative programming language.

Fixes, started testing.
h3rald h3rald@h3rald.com
Sat, 07 Oct 2023 14:56:44 +0200
commit

1456f290e02e96e6641c042ff229a7e3f52e4db2

parent

609568c81dacb1afe0ead252249ceedf1dc5cba3

3 files changed, 27 insertions(+), 19 deletions(-)

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

@@ -285,30 +285,29 @@ elif base == 'x':

while buf[pos] in HexDigits: add(my.a, buf[pos]) inc(pos) + if buf[pos] == '.': + add(my.a, ".") + inc(pos) else: + while buf[pos] in Digits: + add(my.a, buf[pos]) + inc(pos) if buf[pos] == '.': - add(my.a, "0.") + add(my.a, '.') inc(pos) - else: - while buf[pos] in Digits: - add(my.a, buf[pos]) - inc(pos) - if buf[pos] == '.': - add(my.a, '.') - inc(pos) - # digits after the dot: - while buf[pos] in Digits: + # digits after the dot: + while buf[pos] in Digits: + add(my.a, buf[pos]) + inc(pos) + if buf[pos] in {'E', 'e'}: + add(my.a, buf[pos]) + inc(pos) + if buf[pos] in {'+', '-'}: add(my.a, buf[pos]) inc(pos) - if buf[pos] in {'E', 'e'}: + while buf[pos] in Digits: add(my.a, buf[pos]) inc(pos) - if buf[pos] in {'+', '-'}: - add(my.a, buf[pos]) - inc(pos) - while buf[pos] in Digits: - add(my.a, buf[pos]) - inc(pos) my.bufpos = pos proc handleHexChar(c: char, x: var int): bool =
M minpkg/lib/min_logic.nimminpkg/lib/min_logic.nim

@@ -21,7 +21,6 @@ let

absA = abs(a) absB = abs(b) diff = abs(a - b) - if a == b: return true elif a == 0 or b == 0 or diff < FLOAT_MIN_NORMAL:
M tests/num.mintests/num.min

@@ -73,5 +73,15 @@ ((1 2 3 4 5) (even?) any?) *test/assert

((2 4 6 8) (even?) all?) *test/assert + (base? "dec" ==) *test/assert + + ('bin base "bin" base? == 'dec base) *test/assert + + (0b10010 18 ==) *test/assert + + (0b101010 0b100110 bitand 0b100010 ==) *test/assert + + (0b101010 0b010101 bitor 0b111111 ==) *test/assert + *test/report - clear-stack+ clear-stack