(error)
| 26 | }; |
| 27 | |
| 28 | function createParseError(error) { |
| 29 | let { message, loc } = error; |
| 30 | |
| 31 | /* c8 ignore next 3 */ |
| 32 | if (!loc) { |
| 33 | return error; |
| 34 | } |
| 35 | |
| 36 | const { line, column } = loc; |
| 37 | const suffix = ` (${line}:${column})`; |
| 38 | if (message.endsWith(suffix)) { |
| 39 | message = message.slice(0, -suffix.length); |
| 40 | } |
| 41 | |
| 42 | return createError(message, { |
| 43 | loc: { |
| 44 | start: { line, column: column + 1 }, |
| 45 | }, |
| 46 | cause: error, |
| 47 | }); |
| 48 | } |
| 49 | |
| 50 | function parse(text, options) { |
| 51 | const filepath = options?.filepath; |