summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/zx/basic.h1
-rw-r--r--src/basic.c9
2 files changed, 6 insertions, 4 deletions
diff --git a/include/zx/basic.h b/include/zx/basic.h
index fd1c4bf..701bb02 100644
--- a/include/zx/basic.h
+++ b/include/zx/basic.h
@@ -26,6 +26,7 @@ enum zx_basic_token_type {
ZX81_BASIC_TOKEN_WORD,
ZX81_BASIC_TOKEN_INTEGRAL,
ZX81_BASIC_TOKEN_FLOAT,
+ ZX81_BASIC_TOKEN_NEWLINE,
};
ssize_t zx81_basic_dump(int fd, FILE *stream);
diff --git a/src/basic.c b/src/basic.c
index d823ec7..9c71374 100644
--- a/src/basic.c
+++ b/src/basic.c
@@ -51,6 +51,8 @@ static inline enum zx_basic_token_type zx_basic_token_type_get(uint8_t b) {
return ZX81_BASIC_TOKEN_INTEGRAL;
} else if (ZX81_CHAR_TOKEN_FLOAT(b)) {
return ZX81_BASIC_TOKEN_FLOAT;
+ } else if (ZX81_CHAR_NEWLINE(b)) {
+ return ZX81_BASIC_TOKEN_NEWLINE;
}
return ZX81_BASIC_TOKEN_UNKNOWN;
@@ -158,6 +160,9 @@ ssize_t zx81_basic_dump(int fd, FILE *stream) {
i += 5;
break;
+ case ZX81_BASIC_TOKEN_NEWLINE:
+ break;
+
case ZX81_BASIC_TOKEN_UNKNOWN:
continue;
}
@@ -172,10 +177,6 @@ ssize_t zx81_basic_dump(int fd, FILE *stream) {
last = c;
}
-
- if (fputc('\n', stream) < 0) {
- goto error_io;
- }
}
free(buf);