Renamed |characters| -> |chars| (shorter, no loss of expressivity)
This commit is contained in:
parent
4e968892be
commit
137a4b4f53
|
@ -727,12 +727,12 @@ PEG.Compiler = {
|
|||
* Stupid IE considers regexps /[]/ and /[^]/ syntactically invalid, so we
|
||||
* translate them into euqivalents it can handle.
|
||||
*/
|
||||
if (node.characters === "") {
|
||||
if (node.chars === "") {
|
||||
var regexp = "/^(?!)/";
|
||||
} else if (node.characters === "^") {
|
||||
} else if (node.chars === "^") {
|
||||
var regexp = "/^[\\S\\s]/";
|
||||
} else {
|
||||
var regexp = "/^[" + node.characters + "]/";
|
||||
var regexp = "/^[" + node.chars + "]/";
|
||||
}
|
||||
|
||||
return PEG.Compiler.formatCode(
|
||||
|
@ -742,11 +742,11 @@ PEG.Compiler = {
|
|||
"} else {",
|
||||
" var ${resultVar} = null;",
|
||||
" if (context.reportMatchFailures) {",
|
||||
" this._matchFailed('[' + ${characters|string} + ']');",
|
||||
" this._matchFailed('[' + ${chars|string} + ']');",
|
||||
" }",
|
||||
"}",
|
||||
{
|
||||
characters: node.characters,
|
||||
chars: node.chars,
|
||||
regexp: regexp,
|
||||
resultVar: resultVar
|
||||
}
|
||||
|
|
|
@ -603,7 +603,7 @@ PEG.grammarParser = (function(){
|
|||
} else {
|
||||
var result61 = this._parse_class(context);
|
||||
var result60 = result61 !== null
|
||||
? (function($1) { return { type: "class", characters: $1 }; })(result61)
|
||||
? (function($1) { return { type: "class", chars: $1 }; })(result61)
|
||||
: null;
|
||||
if (result60 !== null) {
|
||||
var result54 = result60;
|
||||
|
|
|
@ -68,7 +68,7 @@ primary
|
|||
: identifier !(( literal / "") colon) { return { type: "rule_ref", name: $1 }; }
|
||||
/ literal { return { type: "literal", value: $1 }; }
|
||||
/ dot { return { type: "any" }; }
|
||||
/ class { return { type: "class", characters: $1 }; }
|
||||
/ class { return { type: "class", chars: $1 }; }
|
||||
/ lparen expression rparen { return $2; }
|
||||
|
||||
/* "Lexical" elements */
|
||||
|
|
|
@ -81,10 +81,10 @@ function any() {
|
|||
return { type: "any" };
|
||||
}
|
||||
|
||||
function klass(characters) {
|
||||
function klass(chars) {
|
||||
return {
|
||||
type: "class",
|
||||
characters: characters
|
||||
chars: chars
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue