From 1468cc406bf9b46ae7942791eaa78f74a185062e Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 6 Nov 2023 15:59:17 +0100 Subject: syntax: don't treat `as` and `from` as reserved keywords ECMAScript allows using `as` and `from` as identifiers so follow suit and don't treat them specially while parsing. Extend the compiler logic instead to check for TK_LABEL tokens with the expected value to properly parse import and export statements. Signed-off-by: Jo-Philipp Wich --- lexer.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'lexer.c') diff --git a/lexer.c b/lexer.c index 28188c3..53f00f5 100644 --- a/lexer.c +++ b/lexer.c @@ -68,13 +68,11 @@ static const struct keyword reserved_words[] = { { TK_THIS, "this", 4 }, { TK_NULL, "null", 4 }, { TK_CASE, "case", 4 }, - { TK_FROM, "from", 4 }, { TK_TRY, "try", 3 }, { TK_FOR, "for", 3 }, { TK_LOCAL, "let", 3 }, { TK_IF, "if", 2 }, { TK_IN, "in", 2 }, - { TK_AS, "as", 2 }, }; -- cgit v1.2.3