Improve comment describing the |reportLeftRecursion| pass
This commit is contained in:
parent
6ce97457bf
commit
25ed2b7ee2
|
@ -3,7 +3,18 @@ var arrays = require("../../utils/arrays"),
|
|||
asts = require("../asts"),
|
||||
visitor = require("../visitor");
|
||||
|
||||
/* Checks that no left recursion is present. */
|
||||
/*
|
||||
* Reports left recursion in the grammar, which prevents infinite recursion in
|
||||
* the generated parser.
|
||||
*
|
||||
* Both direct and indirect recursion is detected. The pass also correctly
|
||||
* reports cases like this:
|
||||
*
|
||||
* start = "a"? start
|
||||
*
|
||||
* In general, if a rule reference can be reached without consuming any input,
|
||||
* it can lead to left recursion.
|
||||
*/
|
||||
function reportLeftRecursion(ast) {
|
||||
function matchesEmptyTrue() { return true; }
|
||||
function matchesEmptyFalse() { return false; }
|
||||
|
|
Loading…
Reference in a new issue