aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-11-25 15:59:35 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-11-25 15:59:35 -0500
commit922b5857005be0609ecc59149748947a5c8b4b10 (patch)
tree6e72a0048fbae736756f4a25727af2ada70aa534
parent32532836b91032f2dfe8258b3b4fcc6288609961 (diff)
Tweaks to NONE parsing and tests
-rw-r--r--parse.c5
-rw-r--r--test/nums.tm4
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