cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject [12/15] ios commit: Update bundled ios-sim to 6.0.0
Date Mon, 19 Jun 2017 00:27:58 GMT
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4490abf2/node_modules/pegjs/README.md
----------------------------------------------------------------------
diff --git a/node_modules/pegjs/README.md b/node_modules/pegjs/README.md
deleted file mode 100644
index 52ca9f2..0000000
--- a/node_modules/pegjs/README.md
+++ /dev/null
@@ -1,479 +0,0 @@
-PEG.js
-======
-
-PEG.js is a simple parser generator for JavaScript that produces fast parsers
-with excellent error reporting. You can use it to process complex data or
-computer languages and build transformers, interpreters, compilers and other
-tools easily.
-
-Features
---------
-
-  * Simple and expressive grammar syntax
-  * Integrates both lexical and syntactical analysis
-  * Parsers have excellent error reporting out of the box
-  * Based on [parsing expression
-    grammar](http://en.wikipedia.org/wiki/Parsing_expression_grammar) formalism
-    — more powerful than traditional LL(*k*) and LR(*k*) parsers
-  * Usable [from your browser](http://pegjs.org/online), from the command line,
-    or via JavaScript API
-
-Getting Started
----------------
-
-[Online version](http://pegjs.org/online) is the easiest way to generate a
-parser. Just enter your grammar, try parsing few inputs, and download generated
-parser code.
-
-Installation
-------------
-
-### Node.js
-
-To use the `pegjs` command, install PEG.js globally:
-
-    $ npm install -g pegjs
-
-To use the JavaScript API, install PEG.js locally:
-
-    $ npm install pegjs
-
-If you need both the `pegjs` command and the JavaScript API, install PEG.js both
-ways.
-
-### Browser
-
-[Download](http://pegjs.org/#download) the PEG.js library (regular or minified
-version) or install it using Bower:
-
-    $ bower install pegjs
-
-Generating a Parser
--------------------
-
-PEG.js generates parser from a grammar that describes expected input and can
-specify what the parser returns (using semantic actions on matched parts of the
-input). Generated parser itself is a JavaScript object with a simple API.
-
-### Command Line
-
-To generate a parser from your grammar, use the `pegjs` command:
-
-    $ pegjs arithmetics.pegjs
-
-This writes parser source code into a file with the same name as the grammar
-file but with “.js” extension. You can also specify the output file explicitly:
-
-    $ pegjs arithmetics.pegjs arithmetics-parser.js
-
-If you omit both input and output file, standard input and output are used.
-
-By default, the parser object is assigned to `module.exports`, which makes the
-output a Node.js module. You can assign it to another variable by passing a
-variable name using the `-e`/`--export-var` option. This may be helpful if you
-want to use the parser in browser environment.
-
-You can tweak the generated parser with several options:
-
-  * `--cache` — makes the parser cache results, avoiding exponential parsing
-    time in pathological cases but making the parser slower
-  * `--allowed-start-rules` — comma-separated list of rules the parser will be
-    allowed to start parsing from (default: the first rule in the grammar)
-  * `--plugin` — makes PEG.js use a specified plugin (can be specified multiple
-    times)
-  * `--extra-options` — additional options (in JSON format) to pass to
-    `PEG.buildParser`
-  * `--extra-options-file` — file with additional options (in JSON format) to
-    pass to `PEG.buildParser`
-  * `--trace` — makes the parser trace its progress
-
-### JavaScript API
-
-In Node.js, require the PEG.js parser generator module:
-
-    var PEG = require("pegjs");
-
-In browser, include the PEG.js library in your web page or application using the
-`<script>` tag. The API will be available in the `PEG` global object.
-
-To generate a parser, call the `PEG.buildParser` method and pass your grammar as
-a parameter:
-
-    var parser = PEG.buildParser("start = ('a' / 'b')+");
-
-The method will return generated parser object or its source code as a string
-(depending on the value of the `output` option — see below). It will throw an
-exception if the grammar is invalid. The exception will contain `message`
-property with more details about the error.
-
-You can tweak the generated parser by passing a second parameter with an options
-object to `PEG.buildParser`. The following options are supported:
-
-  * `cache` — if `true`, makes the parser cache results, avoiding exponential
-    parsing time in pathological cases but making the parser slower (default:
-    `false`)
-  * `allowedStartRules` — rules the parser will be allowed to start parsing from
-    (default: the first rule in the grammar)
-  * `output` — if set to `"parser"`, the method will return generated parser
-    object; if set to `"source"`, it will return parser source code as a string
-    (default: `"parser"`)
-  * `optimize`— selects between optimizing the generated parser for parsing
-    speed (`"speed"`) or code size (`"size"`) (default: `"speed"`)
-  * `plugins` — plugins to use
-
-Using the Parser
-----------------
-
-Using the generated parser is simple — just call its `parse` method and pass an
-input string as a parameter. The method will return a parse result (the exact
-value depends on the grammar used to build the parser) or throw an exception if
-the input is invalid. The exception will contain `location`, `expected`, `found`
-and `message` properties with more details about the error.
-
-    parser.parse("abba"); // returns ["a", "b", "b", "a"]
-
-    parser.parse("abcd"); // throws an exception
-
-You can tweak parser behavior by passing a second parameter with an options
-object to the `parse` method. The following options are supported:
-
-  * `startRule` — name of the rule to start parsing from
-  * `tracer` — tracer to use
-
-Parsers can also support their own custom options.
-
-Grammar Syntax and Semantics
-----------------------------
-
-The grammar syntax is similar to JavaScript in that it is not line-oriented and
-ignores whitespace between tokens. You can also use JavaScript-style comments
-(`// ...` and `/* ... */`).
-
-Let's look at example grammar that recognizes simple arithmetic expressions like
-`2*(3+4)`. A parser generated from this grammar computes their values.
-
-    start
-      = additive
-
-    additive
-      = left:multiplicative "+" right:additive { return left + right; }
-      / multiplicative
-
-    multiplicative
-      = left:primary "*" right:multiplicative { return left * right; }
-      / primary
-
-    primary
-      = integer
-      / "(" additive:additive ")" { return additive; }
-
-    integer "integer"
-      = digits:[0-9]+ { return parseInt(digits.join(""), 10); }
-
-On the top level, the grammar consists of *rules* (in our example, there are
-five of them). Each rule has a *name* (e.g. `integer`) that identifies the rule,
-and a *parsing expression* (e.g. `digits:[0-9]+ { return
-parseInt(digits.join(""), 10); }`) that defines a pattern to match against the
-input text and possibly contains some JavaScript code that determines what
-happens when the pattern matches successfully. A rule can also contain
-*human-readable name* that is used in error messages (in our example, only the
-`integer` rule has a human-readable name). The parsing starts at the first rule,
-which is also called the *start rule*.
-
-A rule name must be a JavaScript identifier. It is followed by an equality sign
-(“=”) and a parsing expression. If the rule has a human-readable name, it is
-written as a JavaScript string between the name and separating equality sign.
-Rules need to be separated only by whitespace (their beginning is easily
-recognizable), but a semicolon (“;”) after the parsing expression is allowed.
-
-The first rule can be preceded by an *initializer* — a piece of JavaScript code
-in curly braces (“{” and “}”). This code is executed before the generated parser
-starts parsing. All variables and functions defined in the initializer are
-accessible in rule actions and semantic predicates. The code inside the
-initializer can access the parser object using the `parser` variable and options
-passed to the parser using the `options` variable. Curly braces in the
-initializer code must be balanced. Let's look at the example grammar from above
-using a simple initializer.
-
-    {
-      function makeInteger(o) {
-        return parseInt(o.join(""), 10);
-      }
-    }
-
-    start
-      = additive
-
-    additive
-      = left:multiplicative "+" right:additive { return left + right; }
-      / multiplicative
-
-    multiplicative
-      = left:primary "*" right:multiplicative { return left * right; }
-      / primary
-
-    primary
-      = integer
-      / "(" additive:additive ")" { return additive; }
-
-    integer "integer"
-      = digits:[0-9]+ { return makeInteger(digits); }
-
-The parsing expressions of the rules are used to match the input text to the
-grammar. There are various types of expressions — matching characters or
-character classes, indicating optional parts and repetition, etc. Expressions
-can also contain references to other rules. See detailed description below.
-
-If an expression successfully matches a part of the text when running the
-generated parser, it produces a *match result*, which is a JavaScript value. For
-example:
-
-  * An expression matching a literal string produces a JavaScript string
-    containing matched part of the input.
-  * An expression matching repeated occurrence of some subexpression produces a
-    JavaScript array with all the matches.
-
-The match results propagate through the rules when the rule names are used in
-expressions, up to the start rule. The generated parser returns start rule's
-match result when parsing is successful.
-
-One special case of parser expression is a *parser action* — a piece of
-JavaScript code inside curly braces (“{” and “}”) that takes match results of
-some of the the preceding expressions and returns a JavaScript value. This value
-is considered match result of the preceding expression (in other words, the
-parser action is a match result transformer).
-
-In our arithmetics example, there are many parser actions. Consider the action
-in expression `digits:[0-9]+ { return parseInt(digits.join(""), 10); }`. It
-takes the match result of the expression [0-9]+, which is an array of strings
-containing digits, as its parameter. It joins the digits together to form a
-number and converts it to a JavaScript `number` object.
-
-### Parsing Expression Types
-
-There are several types of parsing expressions, some of them containing
-subexpressions and thus forming a recursive structure:
-
-#### "*literal*"<br>'*literal*'
-
-Match exact literal string and return it. The string syntax is the same as in
-JavaScript. Appending `i` right after the literal makes the match
-case-insensitive.
-
-#### .
-
-Match exactly one character and return it as a string.
-
-#### [*characters*]
-
-Match one character from a set and return it as a string. The characters in the
-list can be escaped in exactly the same way as in JavaScript string. The list of
-characters can also contain ranges (e.g. `[a-z]` means “all lowercase letters”).
-Preceding the characters with `^` inverts the matched set (e.g. `[^a-z]` means
-“all character but lowercase letters”). Appending `i` right after the right
-bracket makes the match case-insensitive.
-
-#### *rule*
-
-Match a parsing expression of a rule recursively and return its match result.
-
-#### ( *expression* )
-
-Match a subexpression and return its match result.
-
-#### *expression* \*
-
-Match zero or more repetitions of the expression and return their match results
-in an array. The matching is greedy, i.e. the parser tries to match the
-expression as many times as possible. Unlike in regular expressions, there is no
-backtracking.
-
-#### *expression* +
-
-Match one or more repetitions of the expression and return their match results
-in an array. The matching is greedy, i.e. the parser tries to match the
-expression as many times as possible. Unlike in regular expressions, there is no
-backtracking.
-
-#### *expression* ?
-
-Try to match the expression. If the match succeeds, return its match result,
-otherwise return `null`. Unlike in regular expressions, there is no
-backtracking.
-
-#### & *expression*
-
-Try to match the expression. If the match succeeds, just return `undefined` and
-do not advance the parser position, otherwise consider the match failed.
-
-#### ! *expression*
-
-Try to match the expression. If the match does not succeed, just return
-`undefined` and do not advance the parser position, otherwise consider the match
-failed.
-
-#### & { *predicate* }
-
-The predicate is a piece of JavaScript code that is executed as if it was inside
-a function. It gets the match results of labeled expressions in preceding
-expression as its arguments. It should return some JavaScript value using the
-`return` statement. If the returned value evaluates to `true` in boolean
-context, just return `undefined` and do not advance the parser position;
-otherwise consider the match failed.
-
-The code inside the predicate can access all variables and functions defined in
-the initializer at the beginning of the grammar.
-
-The code inside the predicate can also access location information using the
-`location` function. It returns an object like this:
-
-    {
-      start: { offset: 23, line: 5, column: 6 },
-      end:   { offset: 23, line: 5, column: 6 }
-    }
-
-The `start` and `end` properties both refer to the current parse position. The
-`offset` property contains an offset as a zero-based index and `line` and
-`column` properties contain a line and a column as one-based indices.
-
-The code inside the predicate can also access the parser object using the
-`parser` variable and options passed to the parser using the `options` variable.
-
-Note that curly braces in the predicate code must be balanced.
-
-#### ! { *predicate* }
-
-The predicate is a piece of JavaScript code that is executed as if it was inside
-a function. It gets the match results of labeled expressions in preceding
-expression as its arguments. It should return some JavaScript value using the
-`return` statement. If the returned value evaluates to `false` in boolean
-context, just return `undefined` and do not advance the parser position;
-otherwise consider the match failed.
-
-The code inside the predicate can access all variables and functions defined in
-the initializer at the beginning of the grammar.
-
-The code inside the predicate can also access location information using the
-`location` function. It returns an object like this:
-
-    {
-      start: { offset: 23, line: 5, column: 6 },
-      end:   { offset: 23, line: 5, column: 6 }
-    }
-
-The `start` and `end` properties both refer to the current parse position. The
-`offset` property contains an offset as a zero-based index and `line` and
-`column` properties contain a line and a column as one-based indices.
-
-The code inside the predicate can also access the parser object using the
-`parser` variable and options passed to the parser using the `options` variable.
-
-Note that curly braces in the predicate code must be balanced.
-
-#### $ *expression*
-
-Try to match the expression. If the match succeeds, return the matched string
-instead of the match result.
-
-#### *label* : *expression*
-
-Match the expression and remember its match result under given label. The label
-must be a JavaScript identifier.
-
-Labeled expressions are useful together with actions, where saved match results
-can be accessed by action's JavaScript code.
-
-#### *expression<sub>1</sub>* *expression<sub>2</sub>* ...  *expression<sub>n</sub>*
-
-Match a sequence of expressions and return their match results in an array.
-
-#### *expression* { *action* }
-
-Match the expression. If the match is successful, run the action, otherwise
-consider the match failed.
-
-The action is a piece of JavaScript code that is executed as if it was inside a
-function. It gets the match results of labeled expressions in preceding
-expression as its arguments. The action should return some JavaScript value
-using the `return` statement. This value is considered match result of the
-preceding expression.
-
-To indicate an error, the code inside the action can invoke the `expected`
-function, which makes the parser throw an exception. The function takes one
-parameter — a description of what was expected at the current position. This
-description will be used as part of a message of the thrown exception.
-
-The code inside an action can also invoke the `error` function, which also makes
-the parser throw an exception. The function takes one parameter — an error
-message. This message will be used by the thrown exception.
-
-The code inside the action can access all variables and functions defined in the
-initializer at the beginning of the grammar. Curly braces in the action code
-must be balanced.
-
-The code inside the action can also access the string matched by the expression
-using the `text` function.
-
-
-The code inside the action can also access location information using the
-`location` function. It returns an object like this:
-
-    {
-      start: { offset: 23, line: 5, column: 6 },
-      end:   { offset: 25, line: 5, column: 8 }
-    }
-
-The `start` property refers to the position at the beginning of the expression,
-the `end` property refers to position after the end of the expression. The
-`offset` property contains an offset as a zero-based index and `line` and
-`column` properties contain a line and a column as one-based indices.
-
-The code inside the action can also access the parser object using the `parser`
-variable and options passed to the parser using the `options` variable.
-
-Note that curly braces in the action code must be balanced.
-
-#### *expression<sub>1</sub>* / *expression<sub>2</sub>* / ... / *expression<sub>n</sub>*
-
-Try to match the first expression, if it does not succeed, try the second one,
-etc. Return the match result of the first successfully matched expression. If no
-expression matches, consider the match failed.
-
-Compatibility
--------------
-
-Both the parser generator and generated parsers should run well in the following
-environments:
-
-  * Node.js 0.10.0+
-  * io.js
-  * Internet Explorer 8+
-  * Edge
-  * Firefox
-  * Chrome
-  * Safari
-  * Opera
-
-Development
------------
-
-  * [Project website](http://pegjs.org/)
-  * [Wiki](https://github.com/pegjs/pegjs/wiki)
-  * [Source code](https://github.com/pegjs/pegjs)
-  * [Trello board](https://trello.com/board/peg-js/50a8eba48cf95d4957006b01)
-  * [Issue tracker](https://github.com/pegjs/pegjs/issues)
-  * [Google Group](http://groups.google.com/group/pegjs)
-  * [Twitter](http://twitter.com/peg_js)
-
-PEG.js is developed by [David Majda](http://majda.cz/)
-([@dmajda](http://twitter.com/dmajda)). The [Bower
-package](https://github.com/pegjs/bower) is maintained by [Michel
-Krämer](http://www.michel-kraemer.com/)
-([@michelkraemer](https://twitter.com/michelkraemer)).
-
-You are welcome to contribute code.  Unless your contribution is really trivial
-you should get in touch with me first — this can prevent wasted effort on both
-sides. You can send code both as a patch or a GitHub pull request.
-
-Note that PEG.js is still very much work in progress. There are no compatibility
-guarantees until version 1.0.

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4490abf2/node_modules/pegjs/VERSION
----------------------------------------------------------------------
diff --git a/node_modules/pegjs/VERSION b/node_modules/pegjs/VERSION
index ac39a10..78bc1ab 100644
--- a/node_modules/pegjs/VERSION
+++ b/node_modules/pegjs/VERSION
@@ -1 +1 @@
-0.9.0
+0.10.0

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4490abf2/node_modules/pegjs/bin/pegjs
----------------------------------------------------------------------
diff --git a/node_modules/pegjs/bin/pegjs b/node_modules/pegjs/bin/pegjs
index e934ed9..1807da2 100755
--- a/node_modules/pegjs/bin/pegjs
+++ b/node_modules/pegjs/bin/pegjs
@@ -2,46 +2,45 @@
 
 "use strict";
 
-var fs   = require("fs");
-var path = require("path");
-var PEG  = require("../lib/peg");
+var fs      = require("fs");
+var path    = require("path");
+var peg     = require("../lib/peg");
+var objects = require("../lib/utils/objects");
 
 /* Helpers */
 
 function printVersion() {
-  console.log("PEG.js " + PEG.VERSION);
+  console.log("PEG.js " + peg.VERSION);
 }
 
 function printHelp() {
-  console.log("Usage: pegjs [options] [--] [<input_file>] [<output_file>]");
-  console.log("");
-  console.log("Generates a parser from the PEG grammar specified in the <input_file> and writes");
-  console.log("it to the <output_file>.");
-  console.log("");
-  console.log("If the <output_file> is omitted, its name is generated by changing the");
-  console.log("<input_file> extension to \".js\". If both <input_file> and <output_file> are");
-  console.log("omitted, standard input and output are used.");
+  console.log("Usage: pegjs [options] [--] [<input_file>]");
   console.log("");
   console.log("Options:");
-  console.log("  -e, --export-var <variable>        name of the variable where the parser");
-  console.log("                                     object will be stored (default:");
-  console.log("                                     \"module.exports\")");
-  console.log("      --cache                        make generated parser cache results");
   console.log("      --allowed-start-rules <rules>  comma-separated list of rules the generated");
   console.log("                                     parser will be allowed to start parsing");
   console.log("                                     from (default: the first rule in the");
   console.log("                                     grammar)");
-  console.log("  -o, --optimize <goal>              select optimization for speed or size");
-  console.log("                                     (default: speed)");
-  console.log("      --trace                        enable tracing in generated parser");
-  console.log("      --plugin <plugin>              use a specified plugin (can be specified");
+  console.log("      --cache                        make generated parser cache results");
+  console.log("  -d, --dependency <dependency>      use specified dependency (can be specified");
   console.log("                                     multiple times)");
+  console.log("  -e, --export-var <variable>        name of a global variable into which the");
+  console.log("                                     parser object is assigned to when no module");
+  console.log("                                     loader is detected");
   console.log("      --extra-options <options>      additional options (in JSON format) to pass");
-  console.log("                                     to PEG.buildParser");
+  console.log("                                     to peg.generate");
   console.log("      --extra-options-file <file>    file with additional options (in JSON");
-  console.log("                                     format) to pass to PEG.buildParser");
-  console.log("  -v, --version                      print version information and exit");
+  console.log("                                     format) to pass to peg.generate");
+  console.log("      --format <format>              format of the generated parser: amd,");
+  console.log("                                     commonjs, globals, umd (default: commonjs)");
   console.log("  -h, --help                         print help and exit");
+  console.log("  -O, --optimize <goal>              select optimization for speed or size");
+  console.log("                                     (default: speed)");
+  console.log("  -o, --output <file>                output file");
+  console.log("      --plugin <plugin>              use a specified plugin (can be specified");
+  console.log("                                     multiple times)");
+  console.log("      --trace                        enable tracing in generated parser");
+  console.log("  -v, --version                      print version information and exit");
 }
 
 function exitSuccess() {
@@ -91,7 +90,7 @@ function trim(s) {
 var args = process.argv.slice(2); // Trim "node" and the script path.
 
 function isOption(arg) {
-  return (/^-/).test(arg);
+  return (/^-.+/).test(arg);
 }
 
 function nextArg() {
@@ -108,31 +107,22 @@ function readStream(inputStream, callback) {
 
 /* Main */
 
-/* This makes the generated parser a CommonJS module by default. */
-var exportVar = "module.exports";
+var inputFile = null;
+var outputFile = null;
+
 var options = {
-  cache:    false,
-  output:   "source",
-  optimize: "speed",
-  trace:    false,
-  plugins:  []
+  cache:        false,
+  dependencies: {},
+  exportVar:    null,
+  format:       "commonjs",
+  optimize:     "speed",
+  output:       "source",
+  plugins:      [],
+  trace:        false
 };
 
 while (args.length > 0 && isOption(args[0])) {
   switch (args[0]) {
-    case "-e":
-    case "--export-var":
-      nextArg();
-      if (args.length === 0) {
-        abort("Missing parameter of the -e/--export-var option.");
-      }
-      exportVar = args[0];
-      break;
-
-    case "--cache":
-      options.cache = true;
-      break;
-
     case "--allowed-start-rules":
       nextArg();
       if (args.length === 0) {
@@ -143,37 +133,31 @@ while (args.length > 0 && isOption(args[0])) {
         .map(trim);
       break;
 
-    case "--trace":
-      options.trace = true;
+    case "--cache":
+      options.cache = true;
       break;
 
-    case "-o":
-    case "--optimize":
+    case "-d":
+    case "--dependency":
       nextArg();
       if (args.length === 0) {
-        abort("Missing parameter of the -o/--optimize option.");
+        abort("Missing parameter of the -d/--dependency option.");
       }
-      if (args[0] !== "speed" && args[0] !== "size") {
-        abort("Optimization goal must be either \"speed\" or \"size\".");
+      if (args[0].indexOf(":") !== -1) {
+        var parts = args[0].split(":");
+        options.dependencies[parts[0]] = parts[1];
+      } else {
+        options.dependencies[args[0]] = args[0];
       }
-      options.optimize = args[0];
       break;
 
-    case "--plugin":
+    case "-e":
+    case "--export-var":
       nextArg();
       if (args.length === 0) {
-        abort("Missing parameter of the --plugin option.");
-      }
-      var id = /^(\.\/|\.\.\/)/.test(args[0]) ? path.resolve(args[0]) : args[0];
-      var mod;
-      try {
-        mod = require(id);
-      } catch (e) {
-        if (e.code !== "MODULE_NOT_FOUND") { throw e; }
-
-        abort("Can't load module \"" + id + "\".");
+        abort("Missing parameter of the -e/--export-var option.");
       }
-      options.plugins.push(mod);
+      options.exportVar = args[0];
       break;
 
     case "--extra-options":
@@ -197,10 +181,15 @@ while (args.length > 0 && isOption(args[0])) {
       addExtraOptions(options, json);
       break;
 
-    case "-v":
-    case "--version":
-      printVersion();
-      exitSuccess();
+    case "--format":
+      nextArg();
+      if (args.length === 0) {
+        abort("Missing parameter of the --format option.");
+      }
+      if (args[0] !== "amd" && args[0] !== "commonjs" && args[0] !== "globals" && args[0] !== "umd") {
+        abort("Module format must be one of \"amd\", \"commonjs\", \"globals\", and \"umd\".");
+      }
+      options.format = args[0];
       break;
 
     case "-h":
@@ -209,6 +198,54 @@ while (args.length > 0 && isOption(args[0])) {
       exitSuccess();
       break;
 
+    case "-O":
+    case "--optimize":
+      nextArg();
+      if (args.length === 0) {
+        abort("Missing parameter of the -O/--optimize option.");
+      }
+      if (args[0] !== "speed" && args[0] !== "size") {
+        abort("Optimization goal must be either \"speed\" or \"size\".");
+      }
+      options.optimize = args[0];
+      break;
+
+    case "-o":
+    case "--output":
+      nextArg();
+      if (args.length === 0) {
+        abort("Missing parameter of the -o/--output option.");
+      }
+      outputFile = args[0];
+      break;
+
+    case "--plugin":
+      nextArg();
+      if (args.length === 0) {
+        abort("Missing parameter of the --plugin option.");
+      }
+      var id = /^(\.\/|\.\.\/)/.test(args[0]) ? path.resolve(args[0]) : args[0];
+      var mod;
+      try {
+        mod = require(id);
+      } catch (e) {
+        if (e.code !== "MODULE_NOT_FOUND") { throw e; }
+
+        abort("Can't load module \"" + id + "\".");
+      }
+      options.plugins.push(mod);
+      break;
+
+    case "--trace":
+      options.trace = true;
+      break;
+
+    case "-v":
+    case "--version":
+      printVersion();
+      exitSuccess();
+      break;
+
     case "--":
       nextArg();
       break;
@@ -219,40 +256,66 @@ while (args.length > 0 && isOption(args[0])) {
   nextArg();
 }
 
+if (objects.keys(options.dependencies).length > 0) {
+  if (options.format !== "amd" && options.format !== "commonjs" && options.format !== "umd") {
+      abort("Can't use the -d/--dependency option with the \"" + options.format + "\" module format.");
+  }
+}
+
+if (options.exportVar !== null) {
+  if (options.format !== "globals" && options.format !== "umd") {
+      abort("Can't use the -e/--export-var option with the \"" + options.format + "\" module format.");
+  }
+}
+
+var inputStream;
+var outputStream;
+
 switch (args.length) {
   case 0:
-    process.stdin.resume();
-    var inputStream = process.stdin;
-    var outputStream = process.stdout;
+    inputFile = "-";
     break;
 
   case 1:
-  case 2:
-    var inputFile = args[0];
-    var inputStream = fs.createReadStream(inputFile);
-    inputStream.on("error", function() {
-      abort("Can't read from file \"" + inputFile + "\".");
-    });
-
-    var outputFile = args.length === 1
-      ? args[0].replace(/\.[^.]*$/, ".js")
-      : args[1];
-    var outputStream = fs.createWriteStream(outputFile);
-    outputStream.on("error", function() {
-      abort("Can't write to file \"" + outputFile + "\".");
-    });
-
+    inputFile = args[0];
     break;
 
   default:
     abort("Too many arguments.");
 }
 
+if (outputFile === null) {
+  if (inputFile === "-") {
+    outputFile = "-";
+  } else {
+    outputFile = inputFile.substr(0, inputFile.length - path.extname(inputFile).length) + ".js";
+  }
+}
+
+if (inputFile === "-") {
+  process.stdin.resume();
+  inputStream = process.stdin;
+  inputStream.on("error", function() {
+    abort("Can't read from file \"" + inputFile + "\".");
+  });
+} else {
+  inputStream = fs.createReadStream(inputFile);
+}
+
+if (outputFile === "-") {
+  outputStream = process.stdout;
+} else {
+  outputStream = fs.createWriteStream(outputFile);
+  outputStream.on("error", function() {
+    abort("Can't write to file \"" + outputFile + "\".");
+  });
+}
+
 readStream(inputStream, function(input) {
   var source;
 
   try {
-    source = PEG.buildParser(input, options);
+    source = peg.generate(input, options);
   } catch (e) {
     if (e.location !== undefined) {
       abort(e.location.start.line + ":" + e.location.start.column + ": " + e.message);
@@ -261,9 +324,7 @@ readStream(inputStream, function(input) {
     }
   }
 
-  outputStream.write(
-    exportVar !== "" ? exportVar + " = " + source + ";\n" : source + "\n"
-  );
+  outputStream.write(source);
   if (outputStream !== process.stdout) {
     outputStream.end();
   }

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4490abf2/node_modules/pegjs/examples/arithmetics.pegjs
----------------------------------------------------------------------
diff --git a/node_modules/pegjs/examples/arithmetics.pegjs b/node_modules/pegjs/examples/arithmetics.pegjs
index 597f7d4..e7bdc44 100644
--- a/node_modules/pegjs/examples/arithmetics.pegjs
+++ b/node_modules/pegjs/examples/arithmetics.pegjs
@@ -5,32 +5,28 @@
  * Accepts expressions like "2 * (3 + 4)" and computes their value.
  */
 
-{
-  function combine(first, rest, combiners) {
-    var result = first, i;
-
-    for (i = 0; i < rest.length; i++) {
-      result = combiners[rest[i][1]](result, rest[i][3]);
-    }
+Expression
+  = head:Term tail:(_ ("+" / "-") _ Term)* {
+      var result = head, i;
 
-    return result;
-  }
-}
+      for (i = 0; i < tail.length; i++) {
+        if (tail[i][1] === "+") { result += tail[i][3]; }
+        if (tail[i][1] === "-") { result -= tail[i][3]; }
+      }
 
-Expression
-  = first:Term rest:(_ ("+" / "-") _ Term)* {
-      return combine(first, rest, {
-        "+": function(left, right) { return left + right; },
-        "-": function(left, right) { return left - right; }
-      });
+      return result;
     }
 
 Term
-  = first:Factor rest:(_ ("*" / "/") _ Factor)* {
-      return combine(first, rest, {
-        "*": function(left, right) { return left * right; },
-        "/": function(left, right) { return left / right; }
-      });
+  = head:Factor tail:(_ ("*" / "/") _ Factor)* {
+      var result = head, i;
+
+      for (i = 0; i < tail.length; i++) {
+        if (tail[i][1] === "*") { result *= tail[i][3]; }
+        if (tail[i][1] === "/") { result /= tail[i][3]; }
+      }
+
+      return result;
     }
 
 Factor

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4490abf2/node_modules/pegjs/examples/css.pegjs
----------------------------------------------------------------------
diff --git a/node_modules/pegjs/examples/css.pegjs b/node_modules/pegjs/examples/css.pegjs
index 24f9298..60e26d0 100644
--- a/node_modules/pegjs/examples/css.pegjs
+++ b/node_modules/pegjs/examples/css.pegjs
@@ -36,19 +36,19 @@
     return result;
   }
 
-  function buildList(first, rest, index) {
-    return (first !== null ? [first] : []).concat(extractList(rest, index));
+  function buildList(head, tail, index) {
+    return (head !== null ? [head] : []).concat(extractList(tail, index));
   }
 
-  function buildExpression(first, rest) {
-    var result = first, i;
+  function buildExpression(head, tail) {
+    var result = head, i;
 
-    for (i = 0; i < rest.length; i++) {
+    for (i = 0; i < tail.length; i++) {
       result = {
         type:     "Expression",
-        operator: rest[i][0],
+        operator: tail[i][0],
         left:     result,
-        right:    rest[i][1]
+        right:    tail[i][1]
       };
     }
 
@@ -93,7 +93,7 @@ media
     }
 
 media_list
-  = first:medium rest:("," S* medium)* { return buildList(first, rest, 2); }
+  = head:medium tail:("," S* medium)* { return buildList(head, tail, 2); }
 
 medium
   = name:IDENT S* { return name; }
@@ -228,7 +228,7 @@ prio
   = IMPORTANT_SYM S*
 
 expr
-  = first:term rest:(operator? term)* { return buildExpression(first, rest); }
+  = head:term tail:(operator? term)* { return buildExpression(head, tail); }
 
 term
   = quantity:(PERCENTAGE / LENGTH / EMS / EXS / ANGLE / TIME / FREQ / NUMBER)

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4490abf2/node_modules/pegjs/examples/javascript.pegjs
----------------------------------------------------------------------
diff --git a/node_modules/pegjs/examples/javascript.pegjs b/node_modules/pegjs/examples/javascript.pegjs
index 75f13e8..2e56a0f 100644
--- a/node_modules/pegjs/examples/javascript.pegjs
+++ b/node_modules/pegjs/examples/javascript.pegjs
@@ -63,22 +63,22 @@
     return result;
   }
 
-  function buildList(first, rest, index) {
-    return [first].concat(extractList(rest, index));
+  function buildList(head, tail, index) {
+    return [head].concat(extractList(tail, index));
   }
 
-  function buildTree(first, rest, builder) {
-    var result = first, i;
+  function buildTree(head, tail, builder) {
+    var result = head, i;
 
-    for (i = 0; i < rest.length; i++) {
-      result = builder(result, rest[i]);
+    for (i = 0; i < tail.length; i++) {
+      result = builder(result, tail[i]);
     }
 
     return result;
   }
 
-  function buildBinaryExpression(first, rest) {
-    return buildTree(first, rest, function(result, element) {
+  function buildBinaryExpression(head, tail) {
+    return buildTree(head, tail, function(result, element) {
       return {
         type:     "BinaryExpression",
         operator: element[1],
@@ -88,8 +88,8 @@
     });
   }
 
-  function buildLogicalExpression(first, rest) {
-    return buildTree(first, rest, function(result, element) {
+  function buildLogicalExpression(head, tail) {
+    return buildTree(head, tail, function(result, element) {
       return {
         type:     "LogicalExpression",
         operator: element[1],
@@ -148,10 +148,10 @@ Identifier
   = !ReservedWord name:IdentifierName { return name; }
 
 IdentifierName "identifier"
-  = first:IdentifierStart rest:IdentifierPart* {
+  = head:IdentifierStart tail:IdentifierPart* {
       return {
         type: "Identifier",
-        name: first + rest.join("")
+        name: head + tail.join("")
       };
     }
 
@@ -550,17 +550,17 @@ ArrayLiteral
     }
 
 ElementList
-  = first:(
+  = head:(
       elision:(Elision __)? element:AssignmentExpression {
         return optionalList(extractOptional(elision, 0)).concat(element);
       }
     )
-    rest:(
+    tail:(
       __ "," __ elision:(Elision __)? element:AssignmentExpression {
         return optionalList(extractOptional(elision, 0)).concat(element);
       }
     )*
-    { return Array.prototype.concat.apply(first, rest); }
+    { return Array.prototype.concat.apply(head, tail); }
 
 Elision
   = "," commas:(__ ",")* { return filledArray(commas.length + 1, null); }
@@ -574,8 +574,8 @@ ObjectLiteral
        return { type: "ObjectExpression", properties: properties };
      }
 PropertyNameAndValueList
-  = first:PropertyAssignment rest:(__ "," __ PropertyAssignment)* {
-      return buildList(first, rest, 3);
+  = head:PropertyAssignment tail:(__ "," __ PropertyAssignment)* {
+      return buildList(head, tail, 3);
     }
 
 PropertyAssignment
@@ -622,14 +622,14 @@ PropertySetParameterList
   = id:Identifier { return [id]; }
 
 MemberExpression
-  = first:(
+  = head:(
         PrimaryExpression
       / FunctionExpression
       / NewToken __ callee:MemberExpression __ args:Arguments {
           return { type: "NewExpression", callee: callee, arguments: args };
         }
     )
-    rest:(
+    tail:(
         __ "[" __ property:Expression __ "]" {
           return { property: property, computed: true };
         }
@@ -638,7 +638,7 @@ MemberExpression
         }
     )*
     {
-      return buildTree(first, rest, function(result, element) {
+      return buildTree(head, tail, function(result, element) {
         return {
           type:     "MemberExpression",
           object:   result,
@@ -655,12 +655,12 @@ NewExpression
     }
 
 CallExpression
-  = first:(
+  = head:(
       callee:MemberExpression __ args:Arguments {
         return { type: "CallExpression", callee: callee, arguments: args };
       }
     )
-    rest:(
+    tail:(
         __ args:Arguments {
           return { type: "CallExpression", arguments: args };
         }
@@ -680,7 +680,7 @@ CallExpression
         }
     )*
     {
-      return buildTree(first, rest, function(result, element) {
+      return buildTree(head, tail, function(result, element) {
         element[TYPES_TO_PROPERTY_NAMES[element.type]] = result;
 
         return element;
@@ -693,8 +693,8 @@ Arguments
     }
 
 ArgumentList
-  = first:AssignmentExpression rest:(__ "," __ AssignmentExpression)* {
-      return buildList(first, rest, 3);
+  = head:AssignmentExpression tail:(__ "," __ AssignmentExpression)* {
+      return buildList(head, tail, 3);
     }
 
 LeftHandSideExpression
@@ -743,9 +743,9 @@ UnaryOperator
   / "!"
 
 MultiplicativeExpression
-  = first:UnaryExpression
-    rest:(__ MultiplicativeOperator __ UnaryExpression)*
-    { return buildBinaryExpression(first, rest); }
+  = head:UnaryExpression
+    tail:(__ MultiplicativeOperator __ UnaryExpression)*
+    { return buildBinaryExpression(head, tail); }
 
 MultiplicativeOperator
   = $("*" !"=")
@@ -753,18 +753,18 @@ MultiplicativeOperator
   / $("%" !"=")
 
 AdditiveExpression
-  = first:MultiplicativeExpression
-    rest:(__ AdditiveOperator __ MultiplicativeExpression)*
-    { return buildBinaryExpression(first, rest); }
+  = head:MultiplicativeExpression
+    tail:(__ AdditiveOperator __ MultiplicativeExpression)*
+    { return buildBinaryExpression(head, tail); }
 
 AdditiveOperator
   = $("+" ![+=])
   / $("-" ![-=])
 
 ShiftExpression
-  = first:AdditiveExpression
-    rest:(__ ShiftOperator __ AdditiveExpression)*
-    { return buildBinaryExpression(first, rest); }
+  = head:AdditiveExpression
+    tail:(__ ShiftOperator __ AdditiveExpression)*
+    { return buildBinaryExpression(head, tail); }
 
 ShiftOperator
   = $("<<"  !"=")
@@ -772,9 +772,9 @@ ShiftOperator
   / $(">>"  !"=")
 
 RelationalExpression
-  = first:ShiftExpression
-    rest:(__ RelationalOperator __ ShiftExpression)*
-    { return buildBinaryExpression(first, rest); }
+  = head:ShiftExpression
+    tail:(__ RelationalOperator __ ShiftExpression)*
+    { return buildBinaryExpression(head, tail); }
 
 RelationalOperator
   = "<="
@@ -785,9 +785,9 @@ RelationalOperator
   / $InToken
 
 RelationalExpressionNoIn
-  = first:ShiftExpression
-    rest:(__ RelationalOperatorNoIn __ ShiftExpression)*
-    { return buildBinaryExpression(first, rest); }
+  = head:ShiftExpression
+    tail:(__ RelationalOperatorNoIn __ ShiftExpression)*
+    { return buildBinaryExpression(head, tail); }
 
 RelationalOperatorNoIn
   = "<="
@@ -797,14 +797,14 @@ RelationalOperatorNoIn
   / $InstanceofToken
 
 EqualityExpression
-  = first:RelationalExpression
-    rest:(__ EqualityOperator __ RelationalExpression)*
-    { return buildBinaryExpression(first, rest); }
+  = head:RelationalExpression
+    tail:(__ EqualityOperator __ RelationalExpression)*
+    { return buildBinaryExpression(head, tail); }
 
 EqualityExpressionNoIn
-  = first:RelationalExpressionNoIn
-    rest:(__ EqualityOperator __ RelationalExpressionNoIn)*
-    { return buildBinaryExpression(first, rest); }
+  = head:RelationalExpressionNoIn
+    tail:(__ EqualityOperator __ RelationalExpressionNoIn)*
+    { return buildBinaryExpression(head, tail); }
 
 EqualityOperator
   = "==="
@@ -813,66 +813,66 @@ EqualityOperator
   / "!="
 
 BitwiseANDExpression
-  = first:EqualityExpression
-    rest:(__ BitwiseANDOperator __ EqualityExpression)*
-    { return buildBinaryExpression(first, rest); }
+  = head:EqualityExpression
+    tail:(__ BitwiseANDOperator __ EqualityExpression)*
+    { return buildBinaryExpression(head, tail); }
 
 BitwiseANDExpressionNoIn
-  = first:EqualityExpressionNoIn
-    rest:(__ BitwiseANDOperator __ EqualityExpressionNoIn)*
-    { return buildBinaryExpression(first, rest); }
+  = head:EqualityExpressionNoIn
+    tail:(__ BitwiseANDOperator __ EqualityExpressionNoIn)*
+    { return buildBinaryExpression(head, tail); }
 
 BitwiseANDOperator
   = $("&" ![&=])
 
 BitwiseXORExpression
-  = first:BitwiseANDExpression
-    rest:(__ BitwiseXOROperator __ BitwiseANDExpression)*
-    { return buildBinaryExpression(first, rest); }
+  = head:BitwiseANDExpression
+    tail:(__ BitwiseXOROperator __ BitwiseANDExpression)*
+    { return buildBinaryExpression(head, tail); }
 
 BitwiseXORExpressionNoIn
-  = first:BitwiseANDExpressionNoIn
-    rest:(__ BitwiseXOROperator __ BitwiseANDExpressionNoIn)*
-    { return buildBinaryExpression(first, rest); }
+  = head:BitwiseANDExpressionNoIn
+    tail:(__ BitwiseXOROperator __ BitwiseANDExpressionNoIn)*
+    { return buildBinaryExpression(head, tail); }
 
 BitwiseXOROperator
   = $("^" !"=")
 
 BitwiseORExpression
-  = first:BitwiseXORExpression
-    rest:(__ BitwiseOROperator __ BitwiseXORExpression)*
-    { return buildBinaryExpression(first, rest); }
+  = head:BitwiseXORExpression
+    tail:(__ BitwiseOROperator __ BitwiseXORExpression)*
+    { return buildBinaryExpression(head, tail); }
 
 BitwiseORExpressionNoIn
-  = first:BitwiseXORExpressionNoIn
-    rest:(__ BitwiseOROperator __ BitwiseXORExpressionNoIn)*
-    { return buildBinaryExpression(first, rest); }
+  = head:BitwiseXORExpressionNoIn
+    tail:(__ BitwiseOROperator __ BitwiseXORExpressionNoIn)*
+    { return buildBinaryExpression(head, tail); }
 
 BitwiseOROperator
   = $("|" ![|=])
 
 LogicalANDExpression
-  = first:BitwiseORExpression
-    rest:(__ LogicalANDOperator __ BitwiseORExpression)*
-    { return buildBinaryExpression(first, rest); }
+  = head:BitwiseORExpression
+    tail:(__ LogicalANDOperator __ BitwiseORExpression)*
+    { return buildBinaryExpression(head, tail); }
 
 LogicalANDExpressionNoIn
-  = first:BitwiseORExpressionNoIn
-    rest:(__ LogicalANDOperator __ BitwiseORExpressionNoIn)*
-    { return buildBinaryExpression(first, rest); }
+  = head:BitwiseORExpressionNoIn
+    tail:(__ LogicalANDOperator __ BitwiseORExpressionNoIn)*
+    { return buildBinaryExpression(head, tail); }
 
 LogicalANDOperator
   = "&&"
 
 LogicalORExpression
-  = first:LogicalANDExpression
-    rest:(__ LogicalOROperator __ LogicalANDExpression)*
-    { return buildBinaryExpression(first, rest); }
+  = head:LogicalANDExpression
+    tail:(__ LogicalOROperator __ LogicalANDExpression)*
+    { return buildBinaryExpression(head, tail); }
 
 LogicalORExpressionNoIn
-  = first:LogicalANDExpressionNoIn
-    rest:(__ LogicalOROperator __ LogicalANDExpressionNoIn)*
-    { return buildBinaryExpression(first, rest); }
+  = head:LogicalANDExpressionNoIn
+    tail:(__ LogicalOROperator __ LogicalANDExpressionNoIn)*
+    { return buildBinaryExpression(head, tail); }
 
 LogicalOROperator
   = "||"
@@ -969,17 +969,17 @@ AssignmentOperator
   / "|="
 
 Expression
-  = first:AssignmentExpression rest:(__ "," __ AssignmentExpression)* {
-      return rest.length > 0
-        ? { type: "SequenceExpression", expressions: buildList(first, rest, 3) }
-        : first;
+  = head:AssignmentExpression tail:(__ "," __ AssignmentExpression)* {
+      return tail.length > 0
+        ? { type: "SequenceExpression", expressions: buildList(head, tail, 3) }
+        : head;
     }
 
 ExpressionNoIn
-  = first:AssignmentExpressionNoIn rest:(__ "," __ AssignmentExpressionNoIn)* {
-      return rest.length > 0
-        ? { type: "SequenceExpression", expressions: buildList(first, rest, 3) }
-        : first;
+  = head:AssignmentExpressionNoIn tail:(__ "," __ AssignmentExpressionNoIn)* {
+      return tail.length > 0
+        ? { type: "SequenceExpression", expressions: buildList(head, tail, 3) }
+        : head;
     }
 
 /* ----- A.4 Statements ----- */
@@ -1010,7 +1010,7 @@ Block
     }
 
 StatementList
-  = first:Statement rest:(__ Statement)* { return buildList(first, rest, 1); }
+  = head:Statement tail:(__ Statement)* { return buildList(head, tail, 1); }
 
 VariableStatement
   = VarToken __ declarations:VariableDeclarationList EOS {
@@ -1021,13 +1021,13 @@ VariableStatement
     }
 
 VariableDeclarationList
-  = first:VariableDeclaration rest:(__ "," __ VariableDeclaration)* {
-      return buildList(first, rest, 3);
+  = head:VariableDeclaration tail:(__ "," __ VariableDeclaration)* {
+      return buildList(head, tail, 3);
     }
 
 VariableDeclarationListNoIn
-  = first:VariableDeclarationNoIn rest:(__ "," __ VariableDeclarationNoIn)* {
-      return buildList(first, rest, 3);
+  = head:VariableDeclarationNoIn tail:(__ "," __ VariableDeclarationNoIn)* {
+      return buildList(head, tail, 3);
     }
 
 VariableDeclaration
@@ -1220,7 +1220,7 @@ CaseBlock
     }
 
 CaseClauses
-  = first:CaseClause rest:(__ CaseClause)* { return buildList(first, rest, 1); }
+  = head:CaseClause tail:(__ CaseClause)* { return buildList(head, tail, 1); }
 
 CaseClause
   = CaseToken __ test:Expression __ ":" consequent:(__ StatementList)? {
@@ -1320,8 +1320,8 @@ FunctionExpression
     }
 
 FormalParameterList
-  = first:Identifier rest:(__ "," __ Identifier)* {
-      return buildList(first, rest, 3);
+  = head:Identifier tail:(__ "," __ Identifier)* {
+      return buildList(head, tail, 3);
     }
 
 FunctionBody
@@ -1341,8 +1341,8 @@ Program
     }
 
 SourceElements
-  = first:SourceElement rest:(__ SourceElement)* {
-      return buildList(first, rest, 1);
+  = head:SourceElement tail:(__ SourceElement)* {
+      return buildList(head, tail, 1);
     }
 
 SourceElement

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4490abf2/node_modules/pegjs/examples/json.pegjs
----------------------------------------------------------------------
diff --git a/node_modules/pegjs/examples/json.pegjs b/node_modules/pegjs/examples/json.pegjs
index 946589e..d0ba9f4 100644
--- a/node_modules/pegjs/examples/json.pegjs
+++ b/node_modules/pegjs/examples/json.pegjs
@@ -49,15 +49,15 @@ true  = "true"  { return true;  }
 object
   = begin_object
     members:(
-      first:member
-      rest:(value_separator m:member { return m; })*
+      head:member
+      tail:(value_separator m:member { return m; })*
       {
         var result = {}, i;
 
-        result[first.name] = first.value;
+        result[head.name] = head.value;
 
-        for (i = 0; i < rest.length; i++) {
-          result[rest[i].name] = rest[i].value;
+        for (i = 0; i < tail.length; i++) {
+          result[tail[i].name] = tail[i].value;
         }
 
         return result;
@@ -76,9 +76,9 @@ member
 array
   = begin_array
     values:(
-      first:value
-      rest:(value_separator v:value { return v; })*
-      { return [first].concat(rest); }
+      head:value
+      tail:(value_separator v:value { return v; })*
+      { return [head].concat(tail); }
     )?
     end_array
     { return values !== null ? values : []; }
@@ -123,7 +123,7 @@ char
 
 escape         = "\\"
 quotation_mark = '"'
-unescaped      = [\x20-\x21\x23-\x5B\x5D-\u10FFFF]
+unescaped      = [^\0-\x1F\x22\x5C]
 
 /* ----- Core ABNF Rules ----- */
 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4490abf2/node_modules/pegjs/lib/compiler.js
----------------------------------------------------------------------
diff --git a/node_modules/pegjs/lib/compiler.js b/node_modules/pegjs/lib/compiler.js
deleted file mode 100644
index 4ea66eb..0000000
--- a/node_modules/pegjs/lib/compiler.js
+++ /dev/null
@@ -1,60 +0,0 @@
-"use strict";
-
-var arrays  = require("./utils/arrays"),
-    objects = require("./utils/objects");
-
-var compiler = {
-  /*
-   * Compiler passes.
-   *
-   * Each pass is a function that is passed the AST. It can perform checks on it
-   * or modify it as needed. If the pass encounters a semantic error, it throws
-   * |PEG.GrammarError|.
-   */
-  passes: {
-    check: {
-      reportMissingRules:  require("./compiler/passes/report-missing-rules"),
-      reportLeftRecursion: require("./compiler/passes/report-left-recursion"),
-      reportInfiniteLoops: require("./compiler/passes/report-infinite-loops")
-    },
-    transform: {
-      removeProxyRules:    require("./compiler/passes/remove-proxy-rules")
-    },
-    generate: {
-      generateBytecode:    require("./compiler/passes/generate-bytecode"),
-      generateJavascript:  require("./compiler/passes/generate-javascript")
-    }
-  },
-
-  /*
-   * 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, passes) {
-    var options = arguments.length > 2 ? objects.clone(arguments[2]) : {},
-        stage;
-
-    objects.defaults(options, {
-      allowedStartRules:  [ast.rules[0].name],
-      cache:              false,
-      trace:              false,
-      optimize:           "speed",
-      output:             "parser"
-    });
-
-    for (stage in passes) {
-      if (passes.hasOwnProperty(stage)) {
-        arrays.each(passes[stage], function(p) { p(ast, options); });
-      }
-    }
-
-    switch (options.output) {
-      case "parser": return eval(ast.code);
-      case "source": return ast.code;
-    }
-  }
-};
-
-module.exports = compiler;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4490abf2/node_modules/pegjs/lib/compiler/asts.js
----------------------------------------------------------------------
diff --git a/node_modules/pegjs/lib/compiler/asts.js b/node_modules/pegjs/lib/compiler/asts.js
index aad50a6..7dac649 100644
--- a/node_modules/pegjs/lib/compiler/asts.js
+++ b/node_modules/pegjs/lib/compiler/asts.js
@@ -13,51 +13,52 @@ var asts = {
     return arrays.indexOf(ast.rules, function(r) { return r.name === name; });
   },
 
-  alwaysAdvancesOnSuccess: function(ast, node) {
-    function advancesTrue()  { return true;  }
-    function advancesFalse() { return false; }
+  alwaysConsumesOnSuccess: function(ast, node) {
+    function consumesTrue()  { return true;  }
+    function consumesFalse() { return false; }
 
-    function advancesExpression(node) {
-      return advances(node.expression);
+    function consumesExpression(node) {
+      return consumes(node.expression);
     }
 
-    var advances = visitor.build({
-      rule:  advancesExpression,
-      named: advancesExpression,
+    var consumes = visitor.build({
+      rule:  consumesExpression,
+      named: consumesExpression,
 
       choice: function(node) {
-        return arrays.every(node.alternatives, advances);
+        return arrays.every(node.alternatives, consumes);
       },
 
-      action: advancesExpression,
+      action: consumesExpression,
 
       sequence: function(node) {
-        return arrays.some(node.elements, advances);
+        return arrays.some(node.elements, consumes);
       },
 
-      labeled:      advancesExpression,
-      text:         advancesExpression,
-      simple_and:   advancesFalse,
-      simple_not:   advancesFalse,
-      optional:     advancesFalse,
-      zero_or_more: advancesFalse,
-      one_or_more:  advancesExpression,
-      semantic_and: advancesFalse,
-      semantic_not: advancesFalse,
+      labeled:      consumesExpression,
+      text:         consumesExpression,
+      simple_and:   consumesFalse,
+      simple_not:   consumesFalse,
+      optional:     consumesFalse,
+      zero_or_more: consumesFalse,
+      one_or_more:  consumesExpression,
+      group:        consumesExpression,
+      semantic_and: consumesFalse,
+      semantic_not: consumesFalse,
 
       rule_ref: function(node) {
-        return advances(asts.findRule(ast, node.name));
+        return consumes(asts.findRule(ast, node.name));
       },
 
       literal: function(node) {
         return node.value !== "";
       },
 
-      "class": advancesTrue,
-      any:     advancesTrue
+      "class": consumesTrue,
+      any:     consumesTrue
     });
 
-    return advances(node);
+    return consumes(node);
   }
 };
 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4490abf2/node_modules/pegjs/lib/compiler/index.js
----------------------------------------------------------------------
diff --git a/node_modules/pegjs/lib/compiler/index.js b/node_modules/pegjs/lib/compiler/index.js
new file mode 100644
index 0000000..1248598
--- /dev/null
+++ b/node_modules/pegjs/lib/compiler/index.js
@@ -0,0 +1,73 @@
+"use strict";
+
+var arrays  = require("../utils/arrays"),
+    objects = require("../utils/objects");
+
+var compiler = {
+  /*
+   * AST node visitor builder. Useful mainly for plugins which manipulate the
+   * AST.
+   */
+  visitor: require("./visitor"),
+
+  /*
+   * Compiler passes.
+   *
+   * Each pass is a function that is passed the AST. It can perform checks on it
+   * or modify it as needed. If the pass encounters a semantic error, it throws
+   * |peg.GrammarError|.
+   */
+  passes: {
+    check: {
+      reportUndefinedRules:     require("./passes/report-undefined-rules"),
+      reportDuplicateRules:     require("./passes/report-duplicate-rules"),
+      reportDuplicateLabels:    require("./passes/report-duplicate-labels"),
+      reportInfiniteRecursion:  require("./passes/report-infinite-recursion"),
+      reportInfiniteRepetition: require("./passes/report-infinite-repetition")
+    },
+    transform: {
+      removeProxyRules:         require("./passes/remove-proxy-rules")
+    },
+    generate: {
+      generateBytecode:         require("./passes/generate-bytecode"),
+      generateJS:               require("./passes/generate-js")
+    }
+  },
+
+  /*
+   * 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, passes, options) {
+    options = options !== void 0 ? options : {};
+
+    var stage;
+
+    options = objects.clone(options);
+    objects.defaults(options, {
+      allowedStartRules: [ast.rules[0].name],
+      cache:             false,
+      dependencies:      {},
+      exportVar:         null,
+      format:            "bare",
+      optimize:          "speed",
+      output:            "parser",
+      trace:             false
+    });
+
+    for (stage in passes) {
+      if (passes.hasOwnProperty(stage)) {
+        arrays.each(passes[stage], function(p) { p(ast, options); });
+      }
+    }
+
+    switch (options.output) {
+      case "parser": return eval(ast.code);
+      case "source": return ast.code;
+    }
+  }
+};
+
+module.exports = compiler;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4490abf2/node_modules/pegjs/lib/compiler/javascript.js
----------------------------------------------------------------------
diff --git a/node_modules/pegjs/lib/compiler/javascript.js b/node_modules/pegjs/lib/compiler/javascript.js
deleted file mode 100644
index bc2ce95..0000000
--- a/node_modules/pegjs/lib/compiler/javascript.js
+++ /dev/null
@@ -1,57 +0,0 @@
-"use strict";
-
-function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
-
-/* JavaScript code generation helpers. */
-var javascript = {
-  stringEscape: function(s) {
-    /*
-     * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a string
-     * literal except for the closing quote character, backslash, carriage
-     * return, line separator, paragraph separator, and line feed. Any character
-     * may appear in the form of an escape sequence.
-     *
-     * For portability, we also escape all control and non-ASCII characters.
-     * Note that "\0" and "\v" escape sequences are not used because JSHint does
-     * not like the first and IE the second.
-     */
-    return s
-      .replace(/\\/g,   '\\\\')   // backslash
-      .replace(/"/g,    '\\"')    // closing double quote
-      .replace(/\x08/g, '\\b')    // backspace
-      .replace(/\t/g,   '\\t')    // horizontal tab
-      .replace(/\n/g,   '\\n')    // line feed
-      .replace(/\f/g,   '\\f')    // form feed
-      .replace(/\r/g,   '\\r')    // carriage return
-      .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
-      .replace(/[\x10-\x1F\x80-\xFF]/g,    function(ch) { return '\\x'  + hex(ch); })
-      .replace(/[\u0100-\u0FFF]/g,         function(ch) { return '\\u0' + hex(ch); })
-      .replace(/[\u1000-\uFFFF]/g,         function(ch) { return '\\u'  + hex(ch); });
-  },
-
-  regexpClassEscape: function(s) {
-    /*
-     * Based on ECMA-262, 5th ed., 7.8.5 & 15.10.1.
-     *
-     * For portability, we also escape all control and non-ASCII characters.
-     */
-    return s
-      .replace(/\\/g, '\\\\')    // backslash
-      .replace(/\//g, '\\/')     // closing slash
-      .replace(/\]/g, '\\]')     // closing bracket
-      .replace(/\^/g, '\\^')     // caret
-      .replace(/-/g,  '\\-')     // dash
-      .replace(/\0/g, '\\0')     // null
-      .replace(/\t/g, '\\t')     // horizontal tab
-      .replace(/\n/g, '\\n')     // line feed
-      .replace(/\v/g, '\\x0B')   // vertical tab
-      .replace(/\f/g, '\\f')     // form feed
-      .replace(/\r/g, '\\r')     // carriage return
-      .replace(/[\x00-\x08\x0E\x0F]/g,  function(ch) { return '\\x0' + hex(ch); })
-      .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x'  + hex(ch); })
-      .replace(/[\u0100-\u0FFF]/g,      function(ch) { return '\\u0' + hex(ch); })
-      .replace(/[\u1000-\uFFFF]/g,      function(ch) { return '\\u'  + hex(ch); });
-  }
-};
-
-module.exports = javascript;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4490abf2/node_modules/pegjs/lib/compiler/js.js
----------------------------------------------------------------------
diff --git a/node_modules/pegjs/lib/compiler/js.js b/node_modules/pegjs/lib/compiler/js.js
new file mode 100644
index 0000000..3da25a4
--- /dev/null
+++ b/node_modules/pegjs/lib/compiler/js.js
@@ -0,0 +1,58 @@
+"use strict";
+
+function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
+
+/* JavaScript code generation helpers. */
+var js = {
+  stringEscape: function(s) {
+    /*
+     * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a string
+     * literal except for the closing quote character, backslash, carriage
+     * return, line separator, paragraph separator, and line feed. Any character
+     * may appear in the form of an escape sequence.
+     *
+     * For portability, we also escape all control and non-ASCII characters.
+     * Note that the "\v" escape sequence is not used because IE does not like
+     * it.
+     */
+    return s
+      .replace(/\\/g,   '\\\\')   // backslash
+      .replace(/"/g,    '\\"')    // closing double quote
+      .replace(/\0/g,   '\\0')    // null
+      .replace(/\x08/g, '\\b')    // backspace
+      .replace(/\t/g,   '\\t')    // horizontal tab
+      .replace(/\n/g,   '\\n')    // line feed
+      .replace(/\f/g,   '\\f')    // form feed
+      .replace(/\r/g,   '\\r')    // carriage return
+      .replace(/[\x00-\x0F]/g,          function(ch) { return '\\x0' + hex(ch); })
+      .replace(/[\x10-\x1F\x7F-\xFF]/g, function(ch) { return '\\x'  + hex(ch); })
+      .replace(/[\u0100-\u0FFF]/g,      function(ch) { return '\\u0' + hex(ch); })
+      .replace(/[\u1000-\uFFFF]/g,      function(ch) { return '\\u'  + hex(ch); });
+  },
+
+  regexpClassEscape: function(s) {
+    /*
+     * Based on ECMA-262, 5th ed., 7.8.5 & 15.10.1.
+     *
+     * For portability, we also escape all control and non-ASCII characters.
+     */
+    return s
+      .replace(/\\/g, '\\\\')    // backslash
+      .replace(/\//g, '\\/')     // closing slash
+      .replace(/\]/g, '\\]')     // closing bracket
+      .replace(/\^/g, '\\^')     // caret
+      .replace(/-/g,  '\\-')     // dash
+      .replace(/\0/g, '\\0')     // null
+      .replace(/\t/g, '\\t')     // horizontal tab
+      .replace(/\n/g, '\\n')     // line feed
+      .replace(/\v/g, '\\x0B')   // vertical tab
+      .replace(/\f/g, '\\f')     // form feed
+      .replace(/\r/g, '\\r')     // carriage return
+      .replace(/[\x00-\x0F]/g,          function(ch) { return '\\x0' + hex(ch); })
+      .replace(/[\x10-\x1F\x7F-\xFF]/g, function(ch) { return '\\x'  + hex(ch); })
+      .replace(/[\u0100-\u0FFF]/g,      function(ch) { return '\\u0' + hex(ch); })
+      .replace(/[\u1000-\uFFFF]/g,      function(ch) { return '\\u'  + hex(ch); });
+  }
+};
+
+module.exports = js;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4490abf2/node_modules/pegjs/lib/compiler/passes/generate-bytecode.js
----------------------------------------------------------------------
diff --git a/node_modules/pegjs/lib/compiler/passes/generate-bytecode.js b/node_modules/pegjs/lib/compiler/passes/generate-bytecode.js
index 4aa401f..60c81a9 100644
--- a/node_modules/pegjs/lib/compiler/passes/generate-bytecode.js
+++ b/node_modules/pegjs/lib/compiler/passes/generate-bytecode.js
@@ -5,7 +5,7 @@ var arrays  = require("../../utils/arrays"),
     asts    = require("../asts"),
     visitor = require("../visitor"),
     op      = require("../opcodes"),
-    js      = require("../javascript");
+    js      = require("../js");
 
 /* Generates bytecode.
  *
@@ -297,7 +297,7 @@ function generateBytecode(ast) {
 
     named: function(node, context) {
       var nameIndex = addConst(
-        '{ type: "other", description: "' + js.stringEscape(node.name) + '" }'
+        'peg$otherExpectation("' + js.stringEscape(node.name) + '")'
       );
 
       /*
@@ -510,6 +510,14 @@ function generateBytecode(ast) {
       );
     },
 
+    group: function(node, context) {
+      return generate(node.expression, {
+        sp:     context.sp,
+        env:    objects.clone(context.env),
+        action: null
+      });
+    },
+
     semantic_and: function(node, context) {
       return buildSemanticPredicate(node.code, false, context);
     },
@@ -532,15 +540,12 @@ function generateBytecode(ast) {
             )
           + '"'
         );
-        expectedIndex = addConst([
-          '{',
-          'type: "literal",',
-          'value: "' + js.stringEscape(node.value) + '",',
-          'description: "'
-             + js.stringEscape('"' + js.stringEscape(node.value) + '"')
-             + '"',
-          '}'
-        ].join(' '));
+        expectedIndex = addConst(
+          'peg$literalExpectation('
+            + '"' + js.stringEscape(node.value) + '", '
+            + node.ignoreCase
+            + ')'
+        );
 
         /*
          * For case-sensitive strings the value must match the beginning of the
@@ -564,7 +569,7 @@ function generateBytecode(ast) {
     },
 
     "class": function(node) {
-      var regexp, regexpIndex, expectedIndex;
+      var regexp, parts, regexpIndex, expectedIndex;
 
       if (node.parts.length > 0) {
         regexp = '/^['
@@ -580,19 +585,27 @@ function generateBytecode(ast) {
       } else {
         /*
          * IE considers regexps /[]/ and /[^]/ as syntactically invalid, so we
-         * translate them into euqivalents it can handle.
+         * translate them into equivalents it can handle.
          */
         regexp = node.inverted ? '/^[\\S\\s]/' : '/^(?!)/';
       }
 
+      parts = '['
+        + arrays.map(node.parts, function(part) {
+            return part instanceof Array
+              ? '["' + js.stringEscape(part[0]) + '", "' + js.stringEscape(part[1]) + '"]'
+              : '"' + js.stringEscape(part) + '"';
+          }).join(', ')
+        + ']';
+
       regexpIndex   = addConst(regexp);
-      expectedIndex = addConst([
-        '{',
-        'type: "class",',
-        'value: "' + js.stringEscape(node.rawText) + '",',
-        'description: "' + js.stringEscape(node.rawText) + '"',
-        '}'
-      ].join(' '));
+      expectedIndex = addConst(
+        'peg$classExpectation('
+          + parts + ', '
+          + node.inverted + ', '
+          + node.ignoreCase
+          + ')'
+      );
 
       return buildCondition(
         [op.MATCH_REGEXP, regexpIndex],
@@ -602,7 +615,7 @@ function generateBytecode(ast) {
     },
 
     any: function() {
-      var expectedIndex = addConst('{ type: "any", description: "any character" }');
+      var expectedIndex = addConst('peg$anyExpectation()');
 
       return buildCondition(
         [op.MATCH_ANY],


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message