@intend-it/parser 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9554,7 +9554,13 @@ function parse(text) {
|
|
|
9554
9554
|
function parseToAST(text) {
|
|
9555
9555
|
const result = parse(text);
|
|
9556
9556
|
if (result.lexingErrors.length > 0 || result.parsingErrors.length > 0) {
|
|
9557
|
-
|
|
9557
|
+
const errors = [
|
|
9558
|
+
...result.lexingErrors.map((e) => `Lexing Error: ${e.message} at line ${e.line}:${e.column}`),
|
|
9559
|
+
...result.parsingErrors.map((e) => `Parsing Error: ${e.message} at line ${e.token.startLine}:${e.token.startColumn}`)
|
|
9560
|
+
].join(`
|
|
9561
|
+
`);
|
|
9562
|
+
throw new Error(`Cannot generate AST: parsing failed
|
|
9563
|
+
${errors}`);
|
|
9558
9564
|
}
|
|
9559
9565
|
const ast = astVisitor.visit(result.cst);
|
|
9560
9566
|
return {
|