diff options
author | mrkutly <mark.sauer.utley@gmail.com> | 2022-06-04 19:48:20 -0400 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2022-06-11 18:39:10 +0100 |
commit | 5b91d543fe78c623608dc48fcb06a11c37639721 (patch) | |
tree | 78c82c5310a498ab47591e185388498660112642 /src/gleam_json_ffi.mjs | |
parent | 454ef1bac35407ca38eb1f3b2348091eb05fb385 (diff) | |
download | gleam_json-5b91d543fe78c623608dc48fcb06a11c37639721.tar.gz gleam_json-5b91d543fe78c623608dc48fcb06a11c37639721.zip |
fix matches
Diffstat (limited to 'src/gleam_json_ffi.mjs')
-rw-r--r-- | src/gleam_json_ffi.mjs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gleam_json_ffi.mjs b/src/gleam_json_ffi.mjs index ef952e5..e34c0e2 100644 --- a/src/gleam_json_ffi.mjs +++ b/src/gleam_json_ffi.mjs @@ -80,7 +80,7 @@ function isUnexpectedEndOfInput(err) { * * Matches the character and its position. */ -const chromiumUnexpectedByteRegex = /unexpected token (.) in JSON at position (\d+)/ +const chromiumUnexpectedByteRegex = /unexpected token (.) in JSON at position (\d+)/i /** * Matches unexpected byte messages in: @@ -96,7 +96,7 @@ const jsCoreUnexpectedByteRegex = /unexpected identifier "(.)"/i * * Matches the position in a 2d grid only and not the character. */ -const spidermonkeyUnexpectedByteRegex = /((unexpected character|expected double-quoted property name) at line (\d+) column (\d+))/i +const spidermonkeyUnexpectedByteRegex = /(unexpected character|expected double-quoted property name) at line (\d+) column (\d+)/i function getUnexpectedByteRuntime(err) { if (chromiumUnexpectedByteRegex.test(err.message)) return Runtime.chromium @@ -142,8 +142,8 @@ function toChromiumUnexpectedByteError(err) { function toSpidermonkeyUnexpectedByteError(err, json) { const match = spidermonkeyUnexpectedByteRegex.exec(err.message) - const line = Number(match[1]) - const column = Number(match[2]) + const line = Number(match[2]) + const column = Number(match[3]) const position = getPositionFromMultiline(line, column, json) const byte = toHex(err.message[position]) return new UnexpectedByte(byte, position) |