-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
Hi! I am trying to replace underlying library for php diagnostics for ace-linters, and meet this bug.
Minimal reproducible example:
<?php
fu1nction nfact($n) {
if ($n == 0) {
return 1;
}
else {
return $n * nfact($n - 1);
}
}
?>on
{
parser: {
extractDoc: false,
suppressErrors: true,
},
ast: {
withPositions: true,
withSource: false,
},
lexer: {
all_tokens: false,
comment_tokens: false,
mode_eval: false,
asp_tags: false,
short_tags: true, // allow `<?` if needed
},
}will cause
TypeError: Cannot read properties of undefined (reading 'loc')
at AST.swapLocations (php-parser.js:189:30)
at AST.resolvePrecedence (php-parser.js:323:10)
at result (php-parser.js:381:17)
at Parser$1.read_statement (php-parser.js:10206:18)
at Parser$1.read_top_statement (php-parser.js:9896:21)
at Parser$1.read_start (php-parser.js:9175:19)
at Parser.parse (php-parser.js:6566:22)
at Engine.parseCode (php-parser.js:4349:22)
at PhpService.doValidation (php-service.ts:61:38)
at service-manager.ts:57:31
on my service using your lib as an engine.
Setting withPositions to false or suppressErrors to false would lead to normal behaviour, though without precise positions of course.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels