aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-05-11 02:56:46 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-05-11 02:56:46 -0700
commit123267685f57968e3515841a8c2d6991c44dcfa8 (patch)
tree9b000f81aba6178427e2a0152d509c27643e122b /src
parent0bec7001ba35f8bed2af0bce5905e1cce845c277 (diff)
downloadbun-123267685f57968e3515841a8c2d6991c44dcfa8.tar.gz
bun-123267685f57968e3515841a8c2d6991c44dcfa8.tar.zst
bun-123267685f57968e3515841a8c2d6991c44dcfa8.zip
[json] Fix bug with negative integers in json parser
Diffstat (limited to 'src')
-rw-r--r--src/js_lexer.zig9
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) {