Merge branch 'master' of github.com:pegjs/pegjs

master
Futago-za Ryuu 6 years ago
commit e69646cc78

@ -67,6 +67,6 @@ If an expression successfully matches a part of the text when running the genera
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 a match result of the preceding expression (in other words, the parser action is a match result transformer).
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 preceding expressions and returns a JavaScript value. This value is considered a match result of the preceding expression (in other words, the parser action is a match result transformer).
In our arithmetic's 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.

@ -167,7 +167,7 @@ supported:</p>
<code>null</code>).</dd>
<dt><code>format</code></dt>
<dd>format of the genreated parser (<code>"amd"</code>, <code>"bare"</code>,
<dd>format of the generated parser (<code>"amd"</code>, <code>"bare"</code>,
<code>"commonjs"</code>, <code>"globals"</code>, or <code>"umd"</code>); valid
only when <code>output</code> is set to <code>"source"</code> (default:
<code>"bare"</code>).</dd>

Loading…
Cancel
Save