Skip to content

Commit

Permalink
Grammar error messages 3/3: Improve the left recursion message
Browse files Browse the repository at this point in the history
New wording is more explanatory.

Part of #371.
  • Loading branch information
dmajda committed Jul 3, 2016
1 parent f5e43f8 commit ec8ede5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/compiler/passes/report-left-recursion.js
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/compiler/passes/report-left-recursion.spec.js
Expand Up @@ -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 }
Expand All @@ -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 }
Expand Down

0 comments on commit ec8ede5

Please sign in to comment.