From 922b5857005be0609ecc59149748947a5c8b4b10 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 25 Nov 2024 15:59:35 -0500 Subject: Tweaks to NONE parsing and tests --- parse.c | 5 ++++- test/nums.tm | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/parse.c b/parse.c index d92df34d..275155bc 100644 --- a/parse.c +++ b/parse.c @@ -1535,9 +1535,12 @@ PARSER(parse_none) { if (!match_word(&pos, "NONE")) return NULL; + const char *none_end = pos; + spaces(&pos); if (!match(&pos, ":")) - return NewAST(ctx->file, start, pos, None, .type=NULL); + return NewAST(ctx->file, start, none_end, None, .type=NULL); + spaces(&pos); type_ast_t *type = parse_type(ctx, pos); if (!type) return NULL; return NewAST(ctx->file, start, type->end, None, .type=type); diff --git a/test/nums.tm b/test/nums.tm index 9d3e9a6e..3a66ffe3 100644 --- a/test/nums.tm +++ b/test/nums.tm @@ -22,9 +22,7 @@ func main(): >> Num.INF:isinf() = yes - >> Num.NAN - = NONE : Num? - >> nan := Num.NAN + >> nan := NONE : Num = NONE : Num? >> nan == nan = yes -- cgit v1.2.3