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 = {
/*
* 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.
* Names of passes that will get run during the compilation (in the specified
* order).
*/
compile: function(ast) {
var PASS_NAMES = [
appliedPassNames: [
"reportMissingRules",
"reportLeftRecursion",
"removeProxyRules",
"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);

Loading…
Cancel
Save