all repos — xyw @ ab717365d9ebc24b986da6dbf4d06059d0c91d73

A minimal virtual machine and assembler for terminals.

Fixed error reporting for column after directive and comments.
h3rald h3rald@h3rald.com
Wed, 26 Nov 2025 09:57:50 +0100
commit

ab717365d9ebc24b986da6dbf4d06059d0c91d73

parent

cf8a9e21d67f43af1b211a89a3ee4e40360997ec

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

jump to
M xywasm.cxywasm.c

@@ -117,7 +117,7 @@ {

if (c == '\n') { ctx->line++; - ctx->column = 1; + ctx->column = 0; break; } ctx->column++;

@@ -302,11 +302,11 @@ // Parse labels starting with . until end of line

char c; while (fread(&c, 1, 1, ctx->fp) == 1) { - ctx->column++; if (c == '\n') { break; } + ctx->column++; if (directive_data_length < DIRECTIVE_CONTENT_MAX_LENGTH - 1) { directive_data[directive_data_length++] = c;

@@ -328,7 +328,7 @@ result = directive_label(ctx);

} // Advance to next line ctx->line++; - ctx->column = 1; + ctx->column = 0; // Reset directive data directive_data_length = 0; directive_data[0] = '\0';

@@ -414,22 +414,6 @@ ctx->column++;

} else if (c == '\n') { - if (token_length > 0) - { - if (parse_token(ctx) != 0) - { - fclose(ctx->fp); - return -1; - } - token_length = 0; - token[0] = '\0'; - } - ctx->line++; - ctx->column = 1; - } - else if (c == '\r') - { - // Treat CR as line break (handle CRLF gracefully) if (token_length > 0) { if (parse_token(ctx) != 0)