aboutsummaryrefslogtreecommitdiff
path: root/src/js_lexer_tables.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-04-26 21:07:40 -0700
committerGravatar GitHub <noreply@github.com> 2023-04-26 21:07:40 -0700
commit6c6118e2103c4d6a64b45f4970044277936f0fa4 (patch)
tree64d0dd6a8e19e8b26575fd8fbe991d5b13c866b3 /src/js_lexer_tables.zig
parent55c05c0a1fad507b9be2209dbc26a61ec2e01df3 (diff)
downloadbun-6c6118e2103c4d6a64b45f4970044277936f0fa4.tar.gz
bun-6c6118e2103c4d6a64b45f4970044277936f0fa4.tar.zst
bun-6c6118e2103c4d6a64b45f4970044277936f0fa4.zip
Fixes #2746 (#2748)
* Fixes #2746 * add test --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/js_lexer_tables.zig')
-rw-r--r--src/js_lexer_tables.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/js_lexer_tables.zig b/src/js_lexer_tables.zig
index 7ca41ca28..dcf04573f 100644
--- a/src/js_lexer_tables.zig
+++ b/src/js_lexer_tables.zig
@@ -10,6 +10,9 @@ const ComptimeStringMap = @import("./comptime_string_map.zig").ComptimeStringMap
pub const T = enum(u8) {
t_end_of_file,
+ // close brace is here so that we can do comparisons against EOF or close brace in one branch
+ t_close_brace,
+
t_syntax_error,
// "#!/usr/bin/env node"
@@ -35,7 +38,6 @@ pub const T = enum(u8) {
t_bar,
t_bar_bar,
t_caret,
- t_close_brace,
t_close_bracket,
t_close_paren,
t_colon,
@@ -151,6 +153,10 @@ pub const T = enum(u8) {
},
}
}
+
+ pub fn isCloseBraceOrEOF(self: T) bool {
+ return @enumToInt(self) <= @enumToInt(T.t_close_brace);
+ }
};
pub const Keywords = ComptimeStringMap(T, .{