@ -240,43 +240,23 @@ module.exports = (function() {
peg$c93 = "]" ,
peg$c94 = { type : "literal" , value : "]" , description : "\"]\"" } ,
peg$c95 = function ( inverted , parts , flags ) {
var partsConverted = utils . map ( parts , function ( part ) { return part . data ; } ) ;
var rawText = "["
+ ( inverted !== null ? inverted : "" )
+ utils . map ( parts , function ( part ) { return part . rawText ; } ) . join ( "" )
+ "]"
+ ( flags !== null ? flags : "" ) ;
return {
type : "class" ,
parts : partsConverted ,
// FIXME: Get the raw text from the input directly.
rawText : rawText ,
inverted : inverted === "^" ,
ignoreCase : flags === "i"
} ;
} ,
peg$c96 = "-" ,
peg$c97 = { type : "literal" , value : "-" , description : "\"-\"" } ,
peg$c98 = function ( begin , end ) {
if ( begin . data . charCodeAt ( 0 ) > end . data . charCodeAt ( 0 ) ) {
error (
"Invalid character range: " + begin . rawText + "-" + end . rawText + "."
) ;
return {
type : "class" ,
parts : parts ,
rawText : text ( ) . replace ( /\s+$/ , "" ) ,
inverted : inverted === "^" ,
ignoreCase : flags === "i"
} ;
} ,
peg$c96 = function ( class _ ) { return class _ ; } ,
peg$c97 = "-" ,
peg$c98 = { type : "literal" , value : "-" , description : "\"-\"" } ,
peg$c99 = function ( begin , end ) {
if ( begin . charCodeAt ( 0 ) > end . charCodeAt ( 0 ) ) {
error ( "Invalid character range: " + text ( ) + "." ) ;
}
return {
data : [ begin . data , end . data ] ,
// FIXME: Get the raw text from the input directly.
rawText : begin . rawText + "-" + end . rawText
} ;
} ,
peg$c99 = function ( char _ ) {
return {
data : char _ ,
// FIXME: Get the raw text from the input directly.
rawText : utils . quoteForRegexpClass ( char _ )
} ;
return [ begin , end ] ;
} ,
peg$c100 = "x" ,
peg$c101 = { type : "literal" , value : "x" , description : "\"x\"" } ,
@ -332,7 +312,7 @@ module.exports = (function() {
peg$c141 = { type : "class" , value : "[\\n\\r\\u2028\\u2029]" , description : "[\\n\\r\\u2028\\u2029]" } ,
peg$c142 = { type : "other" , description : "whitespace" } ,
peg$c143 = /^[ \t\x0B\f\xA0\uFEFF\u1680\u180E\u2000-\u200A\u202F\u205F\u3000]/ ,
peg$c144 = { type : "class" , value : "[ \\t\\ x0B\\f\\x A0\\uFEFF\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]", description : "[ \\t\\ x0B\\f\\x A0\\uFEFF\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]" } ,
peg$c144 = { type : "class" , value : "[ \\t\\ v\\f\\u00 A0\\uFEFF\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]", description : "[ \\t\\ v\\f\\u00 A0\\uFEFF\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]" } ,
peg$currPos = 0 ,
peg$reportedPos = 0 ,
@ -1913,78 +1893,87 @@ module.exports = (function() {
peg$silentFails ++ ;
s0 = peg$currPos ;
s1 = peg$currPos ;
if ( input . charCodeAt ( peg$currPos ) === 91 ) {
s 1 = peg$c89 ;
s 2 = peg$c89 ;
peg$currPos ++ ;
} else {
s 1 = peg$FAILED ;
s 2 = peg$FAILED ;
if ( peg$silentFails === 0 ) { peg$fail ( peg$c90 ) ; }
}
if ( s 1 !== peg$FAILED ) {
if ( s 2 !== peg$FAILED ) {
if ( input . charCodeAt ( peg$currPos ) === 94 ) {
s 2 = peg$c91 ;
s 3 = peg$c91 ;
peg$currPos ++ ;
} else {
s 2 = peg$FAILED ;
s 3 = peg$FAILED ;
if ( peg$silentFails === 0 ) { peg$fail ( peg$c92 ) ; }
}
if ( s 2 === peg$FAILED ) {
s 2 = peg$c1 ;
if ( s 3 === peg$FAILED ) {
s 3 = peg$c1 ;
}
if ( s 2 !== peg$FAILED ) {
s 3 = [ ] ;
s 4 = peg$parseclassCharacterRange ( ) ;
if ( s 4 === peg$FAILED ) {
s 4 = peg$parseclass Character( ) ;
if ( s 3 !== peg$FAILED ) {
s 4 = [ ] ;
s 5 = peg$parseclassCharacterRange ( ) ;
if ( s 5 === peg$FAILED ) {
s 5 = peg$parsebracketDelimited Character( ) ;
}
while ( s 4 !== peg$FAILED ) {
s 3. push ( s4 ) ;
s 4 = peg$parseclassCharacterRange ( ) ;
if ( s 4 === peg$FAILED ) {
s 4 = peg$parseclass Character( ) ;
while ( s 5 !== peg$FAILED ) {
s 4. push ( s5 ) ;
s 5 = peg$parseclassCharacterRange ( ) ;
if ( s 5 === peg$FAILED ) {
s 5 = peg$parsebracketDelimited Character( ) ;
}
}
if ( s 3 !== peg$FAILED ) {
if ( s 4 !== peg$FAILED ) {
if ( input . charCodeAt ( peg$currPos ) === 93 ) {
s 4 = peg$c93 ;
s 5 = peg$c93 ;
peg$currPos ++ ;
} else {
s 4 = peg$FAILED ;
s 5 = peg$FAILED ;
if ( peg$silentFails === 0 ) { peg$fail ( peg$c94 ) ; }
}
if ( s 4 !== peg$FAILED ) {
if ( s 5 !== peg$FAILED ) {
if ( input . charCodeAt ( peg$currPos ) === 105 ) {
s 5 = peg$c74 ;
s 6 = peg$c74 ;
peg$currPos ++ ;
} else {
s 5 = peg$FAILED ;
s 6 = peg$FAILED ;
if ( peg$silentFails === 0 ) { peg$fail ( peg$c75 ) ; }
}
if ( s 5 === peg$FAILED ) {
s 5 = peg$c1 ;
if ( s 6 === peg$FAILED ) {
s 6 = peg$c1 ;
}
if ( s5 !== peg$FAILED ) {
s6 = peg$parse _ _ ( ) ;
if ( s6 !== peg$FAILED ) {
peg$reportedPos = s0 ;
s1 = peg$c95 ( s2 , s3 , s5 ) ;
s0 = s1 ;
} else {
peg$currPos = s0 ;
s0 = peg$c0 ;
}
if ( s6 !== peg$FAILED ) {
peg$reportedPos = s1 ;
s2 = peg$c95 ( s3 , s4 , s6 ) ;
s1 = s2 ;
} else {
peg$currPos = s 0 ;
s 0 = peg$c0 ;
peg$currPos = s1 ;
s1 = peg$c0 ;
}
} else {
peg$currPos = s 0 ;
s 0 = peg$c0 ;
peg$currPos = s1 ;
s 1 = peg$c0 ;
}
} else {
peg$currPos = s 0 ;
s 0 = peg$c0 ;
peg$currPos = s 1 ;
s 1 = peg$c0 ;
}
} else {
peg$currPos = s1 ;
s1 = peg$c0 ;
}
} else {
peg$currPos = s1 ;
s1 = peg$c0 ;
}
if ( s1 !== peg$FAILED ) {
s2 = peg$parse _ _ ( ) ;
if ( s2 !== peg$FAILED ) {
peg$reportedPos = s0 ;
s1 = peg$c96 ( s1 ) ;
s0 = s1 ;
} else {
peg$currPos = s0 ;
s0 = peg$c0 ;
@ -2006,20 +1995,20 @@ module.exports = (function() {
var s0 , s1 , s2 , s3 ;
s0 = peg$currPos ;
s1 = peg$parse class Character( ) ;
s1 = peg$parse bracketDelimited Character( ) ;
if ( s1 !== peg$FAILED ) {
if ( input . charCodeAt ( peg$currPos ) === 45 ) {
s2 = peg$c9 6 ;
s2 = peg$c9 7 ;
peg$currPos ++ ;
} else {
s2 = peg$FAILED ;
if ( peg$silentFails === 0 ) { peg$fail ( peg$c9 7 ) ; }
if ( peg$silentFails === 0 ) { peg$fail ( peg$c9 8 ) ; }
}
if ( s2 !== peg$FAILED ) {
s3 = peg$parse class Character( ) ;
s3 = peg$parse bracketDelimited Character( ) ;
if ( s3 !== peg$FAILED ) {
peg$reportedPos = s0 ;
s1 = peg$c9 8 ( s1 , s3 ) ;
s1 = peg$c9 9 ( s1 , s3 ) ;
s0 = s1 ;
} else {
peg$currPos = s0 ;
@ -2037,20 +2026,6 @@ module.exports = (function() {
return s0 ;
}
function peg$parseclassCharacter ( ) {
var s0 , s1 ;
s0 = peg$currPos ;
s1 = peg$parsebracketDelimitedCharacter ( ) ;
if ( s1 !== peg$FAILED ) {
peg$reportedPos = s0 ;
s1 = peg$c99 ( s1 ) ;
}
s0 = s1 ;
return s0 ;
}
function peg$parsebracketDelimitedCharacter ( ) {
var s0 ;