all repos — xyw @ 42cb673cc63313bc806b8cb1fa428334d458f565

A minimal virtual machine and assembler for terminals.

Removed support for binary and decimal numbers for now.
h3rald h3rald@h3rald.com
Sat, 06 Dec 2025 04:16:57 +0000
commit

42cb673cc63313bc806b8cb1fa428334d458f565

parent

888f025e3e05aa69c2901d3d08f872dd4b0ebd11

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

jump to
M xywasm.cxywasm.c

@@ -320,7 +320,6 @@ static int process_number(xyw_context *ctx)

{ xyw_word value = 0; unsigned int i = 0; - int negative = 0; if (token[0] == '$') { for (i = 1; i < token_length; i++)

@@ -347,49 +346,10 @@ }

} xyw_dbg("Hex number:\t%s\t(%04X)\n", token, value); } - else if (token[0] == '%') - { - for (i = 1; i < token_length; i++) - { - char c = token[i]; - value <<= 1; - if (c == '1') - { - value |= 1; - } - else if (c != '0') - { - token_error("Invalid binary digit"); - return -1; - } - } - xyw_dbg("Binary number:\t%s\t(%04X)\n", token, value); - } else { - if (token[0] == '-') - { - negative = 1; - i = 1; - } - for (; i < token_length; i++) - { - char c = token[i]; - if (c >= '0' && c <= '9') - { - value = value * 10 + (c - '0'); - } - else - { - token_error("Invalid decimal digit"); - return -1; - } - } - if (negative) - { - value = -value; - } - xyw_dbg("Decimal number:\t%s\t(%04X)\n", token, value); + token_error("Invalid number."); + return -1; } token_type = TOKEN_TYPE_NUMBER; token_value = value;

@@ -710,7 +670,7 @@ else if (token[0] == '.')

{ return process_directive(ctx); } - else if (token[0] == '$' || token[0] == '%' || token[0] == '"') + else if (token[0] == '$' || token[0] == '"') { if (token[0] == '"') {