Make pass list customizable via |PEG.compiler.appliedPassNames| property

redux
David Majda 13 years ago
parent 8a0276ffb7
commit cd5490dee4

@ -1,20 +1,24 @@
PEG.compiler = { PEG.compiler = {
/* /*
* Generates a parser from a specified grammar AST. Throws |PEG.GrammarError| * Names of passes that will get run during the compilation (in the specified
* if the AST contains a semantic error. Note that not all errors are detected * order).
* during the generation and some may protrude to the generated parser and
* cause its malfunction.
*/ */
compile: function(ast) { appliedPassNames: [
var PASS_NAMES = [
"reportMissingRules", "reportMissingRules",
"reportLeftRecursion", "reportLeftRecursion",
"removeProxyRules", "removeProxyRules",
"computeStackDepths" "computeStackDepths"
]; ],
for (var i = 0; i < PASS_NAMES.length; i++) { /*
this.passes[PASS_NAMES[i]](ast); * Generates a parser from a specified grammar AST. Throws |PEG.GrammarError|
* if the AST contains a semantic error. Note that not all errors are detected
* during the generation and some may protrude to the generated parser and
* cause its malfunction.
*/
compile: function(ast) {
for (var i = 0; i < this.appliedPassNames.length; i++) {
this.passes[this.appliedPassNames[i]](ast);
} }
var source = this.emitter(ast); var source = this.emitter(ast);

Loading…
Cancel
Save