diff options
author | 2022-05-11 02:56:46 -0700 | |
---|---|---|
committer | 2022-05-11 02:56:46 -0700 | |
commit | 123267685f57968e3515841a8c2d6991c44dcfa8 (patch) | |
tree | 9b000f81aba6178427e2a0152d509c27643e122b | |
parent | 0bec7001ba35f8bed2af0bce5905e1cce845c277 (diff) | |
download | bun-123267685f57968e3515841a8c2d6991c44dcfa8.tar.gz bun-123267685f57968e3515841a8c2d6991c44dcfa8.tar.zst bun-123267685f57968e3515841a8c2d6991c44dcfa8.zip |
[json] Fix bug with negative integers in json parser
-rw-r--r-- | src/js_lexer.zig | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/js_lexer.zig b/src/js_lexer.zig index d771b919a..030ddcdf7 100644 --- a/src/js_lexer.zig +++ b/src/js_lexer.zig @@ -1350,19 +1350,22 @@ fn NewLexer_( }, '-' => { - if (comptime is_json) { - return lexer.addUnsupportedSyntaxError("Operators are not allowed in JSON"); - } // '+' or '+=' or '++' lexer.step(); switch (lexer.code_point) { '=' => { + if (comptime is_json) { + return lexer.addUnsupportedSyntaxError("Operators are not allowed in JSON"); + } lexer.step(); lexer.token = T.t_minus_equals; }, '-' => { + if (comptime is_json) { + return lexer.addUnsupportedSyntaxError("Operators are not allowed in JSON"); + } lexer.step(); if (lexer.code_point == '>' and lexer.has_newline_before) { |