Grammar error messages 3/3: Improve the left recursion message

New wording is more explanatory.

Part of #371.
redux
David Majda 8 years ago
parent f5e43f842c
commit ec8ede5bbe

@ -40,7 +40,7 @@ function reportLeftRecursion(ast) {
visitedRules.push(node.name);
throw new GrammarError(
"Possible left recursion detected ("
"Possible infinite loop when parsing (left recursion: "
+ visitedRules.join(" -> ")
+ ").",
node.location

@ -7,7 +7,7 @@ describe("compiler pass |reportLeftRecursion|", function() {
it("reports direct left recursion", function() {
expect(pass).toReportError('start = start', {
message: 'Possible left recursion detected (start -> start).',
message: 'Possible infinite loop when parsing (left recursion: start -> start).',
location: {
start: { offset: 8, line: 1, column: 9 },
end: { offset: 13, line: 1, column: 14 }
@ -20,7 +20,7 @@ describe("compiler pass |reportLeftRecursion|", function() {
'start = stop',
'stop = start'
].join("\n"), {
message: 'Possible left recursion detected (start -> stop -> start).',
message: 'Possible infinite loop when parsing (left recursion: start -> stop -> start).',
location: {
start: { offset: 21, line: 2, column: 9 },
end: { offset: 26, line: 2, column: 14 }

Loading…
Cancel
Save