Don't use "this" inside peg.generate

This change makes it possible to use "generate" as a module function,
e.g. like this:

  var generate = require("pegjs").generate;
  var parser = generate(...);

Fixes #433.
redux
David Majda 8 years ago
parent 65550965c6
commit 6aa956452e

@ -41,13 +41,13 @@ var peg = {
var plugins = "plugins" in options ? options.plugins : [],
config = {
parser: this.parser,
passes: convertPasses(this.compiler.passes)
parser: peg.parser,
passes: convertPasses(peg.compiler.passes)
};
arrays.each(plugins, function(p) { p.use(config, options); });
return this.compiler.compile(
return peg.compiler.compile(
config.parser.parse(grammar),
config.passes,
options

Loading…
Cancel
Save