diff options
Diffstat (limited to '')
-rw-r--r-- | .gitmodules | 6 | ||||
m--------- | mycology | 0 | ||||
m--------- | spec | 0 | ||||
-rw-r--r-- | src/field.nim | 8 | ||||
-rw-r--r-- | tests/mycology.nim | 14 |
5 files changed, 24 insertions, 4 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..efdb3a1 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "spec"] + path = spec + url = https://github.com/catseye/Funge-98 +[submodule "mycology"] + path = mycology + url = https://github.com/Deewiant/Mycology diff --git a/mycology b/mycology new file mode 160000 +Subproject 3787e42c3d4f0b735a09129a205e3e4df848558 diff --git a/spec b/spec new file mode 160000 +Subproject 7b4330df1a624c464f01c80090b60621ce5a330 diff --git a/src/field.nim b/src/field.nim index 47c94b5..e63a64e 100644 --- a/src/field.nim +++ b/src/field.nim @@ -116,11 +116,11 @@ proc Load*(filename: string): ref Field = f.lines.add(Line()) l = addr f.lines[^1] trailingSpaces = 0 - if i+1 < n: - if data[i] == '\r' and data[i+1] == '\n': + if data[i] == '\r': + if i+1 < n and data[i+1] == '\n': inc i - else: - lastReadIsCR = true + else: + lastReadIsCR = true else: if data[i] == ' ': if l.l == 0: # trim leading spaces diff --git a/tests/mycology.nim b/tests/mycology.nim new file mode 100644 index 0000000..54650a2 --- /dev/null +++ b/tests/mycology.nim @@ -0,0 +1,14 @@ +import ../src/field +import ../src/interpreter +import ../src/pointer + +import unittest + +suite "Mycology": + const filename = "mycology/mycology.b98" + var f = Load(filename) + check f != nil + let argv = @[filename] + var p = NewPointer(argv = argv) + let v = NewInterpreter(f, p)[].Run() + check v == 15 |