diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-12-01 12:10:05 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-12-01 12:10:05 +0100 |
commit | 07802f37ddb13489cfde314716ad6181dd9b1671 (patch) | |
tree | 0a119aafdbfdbdcc5fd7cf87f513c525c27e6d2a /lexer.c | |
parent | 54ef6c09116430e5ce35777bd899f750d84e4dc1 (diff) |
syntax: disallow keywords in object property shorthand notation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lexer.c')
-rw-r--r-- | lexer.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -1273,3 +1273,18 @@ uc_tokenname(unsigned type) return "?"; } + +bool +uc_lexer_is_keyword(uc_value_t *label) +{ + size_t i; + + if (ucv_type(label) != UC_STRING) + return false; + + for (i = 0; i < ARRAY_SIZE(reserved_words); i++) + if (!strcmp(reserved_words[i].pat, ucv_string_get(label))) + return true; + + return false; +} |