@ -85,11 +85,11 @@ PEG.grammarParser = (function(){
this . _pos = savedPos0 ;
}
var result0 = result1 !== null
? ( function ( $1, $2 ) {
? ( function ( rules ) {
var result = { } ;
PEG . ArrayUtils . each ( $2 , function ( rule ) { result [ rule . name ] = rule ; } ) ;
PEG . ArrayUtils . each ( rules , function ( rule ) { result [ rule . name ] = rule ; } ) ;
return result ;
} ) .apply (null , result1 )
} ) (result1 [ 1 ] )
: null ;
@ -157,14 +157,14 @@ PEG.grammarParser = (function(){
this . _pos = savedPos1 ;
}
var result5 = result6 !== null
? ( function ( $1, $2 , $3 , $4 ) {
? ( function ( name, displayName , expression ) {
return {
type : "rule" ,
name : $1 ,
displayName : $2 !== "" ? $2 : null ,
expression : $4
name : name ,
displayName : displayName !== "" ? displayName : null ,
expression : expression
} ;
} ) .apply ( null , result6 )
} ) (result6 [ 0 ] , result6 [ 1 ] , result6 [ 3 ] )
: null ;
@ -233,10 +233,10 @@ PEG.grammarParser = (function(){
this . _pos = savedPos2 ;
}
var result13 = result14 !== null
? ( function ( $1, $2 ) {
if ( $2 . length > 0 ) {
var alternatives = [ $1 ] . concat ( PEG . ArrayUtils . map (
$2 ,
? ( function ( head, tail ) {
if ( tail . length > 0 ) {
var alternatives = [ head ] . concat ( PEG . ArrayUtils . map (
tail ,
function ( element ) { return element [ 1 ] ; }
) ) ;
return {
@ -244,9 +244,9 @@ PEG.grammarParser = (function(){
alternatives : alternatives
}
} else {
return $1 ;
return head ;
}
} ) .apply ( null , result14 )
} ) (result14 [ 0 ] , result14 [ 1 ] )
: null ;
@ -289,19 +289,19 @@ PEG.grammarParser = (function(){
this . _pos = savedPos4 ;
}
var result24 = result25 !== null
? ( function ( $1, $2 ) {
var expression = $1 . length != 1
? ( function ( elements, action ) {
var expression = elements . length != 1
? {
type : "sequence" ,
elements : $1
elements : elements
}
: $1 [ 0 ] ;
: elements [ 0 ] ;
return {
type : "action" ,
expression : expression ,
action : $2
action : action
} ;
} ) .apply ( null , result25 )
} ) (result25 [ 0 ] , result25 [ 1 ] )
: null ;
if ( result24 !== null ) {
var result20 = result24 ;
@ -313,13 +313,13 @@ PEG.grammarParser = (function(){
var result23 = this . _parse _labeled ( context ) ;
}
var result21 = result22 !== null
? ( function ( $1 ) {
return $1 . length != 1
? ( function ( elements ) {
return elements . length != 1
? {
type : "sequence" ,
elements : $1
elements : elements
}
: $1 [ 0 ] ;
: elements [ 0 ] ;
} ) ( result22 )
: null ;
if ( result21 !== null ) {
@ -370,13 +370,13 @@ PEG.grammarParser = (function(){
this . _pos = savedPos5 ;
}
var result31 = result32 !== null
? ( function ( $1, $2 , $3 ) {
? ( function ( label, expression ) {
return {
type : "labeled" ,
label : $1 ,
expression : $3
label : label ,
expression : expression
} ;
} ) .apply ( null , result32 )
} ) (result32 [ 0 ] , result32 [ 2 ] )
: null ;
if ( result31 !== null ) {
var result29 = result31 ;
@ -424,7 +424,12 @@ PEG.grammarParser = (function(){
this . _pos = savedPos7 ;
}
var result42 = result43 !== null
? ( function ( $1 , $2 ) { return { type : "and_predicate" , expression : $2 } ; } ) . apply ( null , result43 )
? ( function ( expression ) {
return {
type : "and_predicate" ,
expression : expression
} ;
} ) ( result43 [ 1 ] )
: null ;
if ( result42 !== null ) {
var result36 = result42 ;
@ -444,7 +449,12 @@ PEG.grammarParser = (function(){
this . _pos = savedPos6 ;
}
var result38 = result39 !== null
? ( function ( $1 , $2 ) { return { type : "not_predicate" , expression : $2 } ; } ) . apply ( null , result39 )
? ( function ( expression ) {
return {
type : "not_predicate" ,
expression : expression
} ;
} ) ( result39 [ 1 ] )
: null ;
if ( result38 !== null ) {
var result36 = result38 ;
@ -493,7 +503,12 @@ PEG.grammarParser = (function(){
this . _pos = savedPos10 ;
}
var result56 = result57 !== null
? ( function ( $1 , $2 ) { return { type : "optional" , expression : $1 } ; } ) . apply ( null , result57 )
? ( function ( expression ) {
return {
type : "optional" ,
expression : expression
} ;
} ) ( result57 [ 0 ] )
: null ;
if ( result56 !== null ) {
var result46 = result56 ;
@ -513,7 +528,12 @@ PEG.grammarParser = (function(){
this . _pos = savedPos9 ;
}
var result52 = result53 !== null
? ( function ( $1 , $2 ) { return { type : "zero_or_more" , expression : $1 } ; } ) . apply ( null , result53 )
? ( function ( expression ) {
return {
type : "zero_or_more" ,
expression : expression
} ;
} ) ( result53 [ 0 ] )
: null ;
if ( result52 !== null ) {
var result46 = result52 ;
@ -533,7 +553,12 @@ PEG.grammarParser = (function(){
this . _pos = savedPos8 ;
}
var result48 = result49 !== null
? ( function ( $1 , $2 ) { return { type : "one_or_more" , expression : $1 } ; } ) . apply ( null , result49 )
? ( function ( expression ) {
return {
type : "one_or_more" ,
expression : expression
} ;
} ) ( result49 [ 0 ] )
: null ;
if ( result48 !== null ) {
var result46 = result48 ;
@ -624,21 +649,31 @@ PEG.grammarParser = (function(){
this . _pos = savedPos12 ;
}
var result71 = result72 !== null
? ( function ( $1 , $2 ) { return { type : "rule_ref" , name : $1 } ; } ) . apply ( null , result72 )
? ( function ( name ) {
return {
type : "rule_ref" ,
name : name
} ;
} ) ( result72 [ 0 ] )
: null ;
if ( result71 !== null ) {
var result60 = result71 ;
} else {
var result70 = this . _parse _literal ( context ) ;
var result69 = result70 !== null
? ( function ( $1 ) { return { type : "literal" , value : $1 } ; } ) ( result70 )
? ( function ( value ) {
return {
type : "literal" ,
value : value
} ;
} ) ( result70 )
: null ;
if ( result69 !== null ) {
var result60 = result69 ;
} else {
var result68 = this . _parse _dot ( context ) ;
var result67 = result68 !== null
? ( function ( $1 ) { return { type : "any" } ; } ) ( result68 )
? ( function ( ) { return { type : "any" } ; } ) ( )
: null ;
if ( result67 !== null ) {
var result60 = result67 ;
@ -668,7 +703,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos11 ;
}
var result61 = result62 !== null
? ( function ( $1, $2 , $3 ) { return $2 ; } ) . apply ( null , result62 )
? ( function ( expression) { return expression ; } ) ( result62 [ 1 ] )
: null ;
if ( result61 !== null ) {
var result60 = result61 ;
@ -716,7 +751,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos15 ;
}
var result80 = result81 !== null
? ( function ( $1, $2 ) { return $1 . substr ( 1 , $1 . length - 2 ) ; } ) .apply (null , result81 )
? ( function ( braced) { return braced . substr ( 1 , braced . length - 2 ) ; } ) (result81 [ 0 ] )
: null ;
context . reportMatchFailures = savedReportMatchFailures ;
if ( context . reportMatchFailures && result80 === null ) {
@ -803,7 +838,9 @@ PEG.grammarParser = (function(){
this . _pos = savedPos16 ;
}
var result84 = result85 !== null
? ( function ( $1 , $2 , $3 ) { return $1 + $2 . join ( "" ) + $3 ; } ) . apply ( null , result85 )
? ( function ( parts ) {
return "{" + parts . join ( "" ) + "}" ;
} ) ( result85 [ 1 ] )
: null ;
@ -837,7 +874,7 @@ PEG.grammarParser = (function(){
var result93 = null ;
}
var result92 = result93 !== null
? ( function ( $1) { return $1 . join ( "" ) ; } ) ( result93 )
? ( function ( chars) { return chars . join ( "" ) ; } ) ( result93 )
: null ;
@ -913,7 +950,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos17 ;
}
var result96 = result97 !== null
? ( function ( $1 , $2 ) { return $1 ; } ) . apply ( null , result97 )
? ( function ( ) { return "=" ; } ) ( )
: null ;
@ -959,7 +996,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos18 ;
}
var result100 = result101 !== null
? ( function ( $1 , $2 ) { return $1 ; } ) . apply ( null , result101 )
? ( function ( ) { return ":" ; } ) ( )
: null ;
@ -1005,7 +1042,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos19 ;
}
var result104 = result105 !== null
? ( function ( $1 , $2 ) { return $1 ; } ) . apply ( null , result105 )
? ( function ( ) { return "/" ; } ) ( )
: null ;
@ -1051,7 +1088,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos20 ;
}
var result108 = result109 !== null
? ( function ( $1 , $2 ) { return $1 ; } ) . apply ( null , result109 )
? ( function ( ) { return "&" ; } ) ( )
: null ;
@ -1097,7 +1134,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos21 ;
}
var result112 = result113 !== null
? ( function ( $1 , $2 ) { return $1 ; } ) . apply ( null , result113 )
? ( function ( ) { return "!" ; } ) ( )
: null ;
@ -1143,7 +1180,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos22 ;
}
var result116 = result117 !== null
? ( function ( $1 , $2 ) { return $1 ; } ) . apply ( null , result117 )
? ( function ( ) { return "?" ; } ) ( )
: null ;
@ -1189,7 +1226,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos23 ;
}
var result120 = result121 !== null
? ( function ( $1 , $2 ) { return $1 ; } ) . apply ( null , result121 )
? ( function ( ) { return "*" ; } ) ( )
: null ;
@ -1235,7 +1272,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos24 ;
}
var result124 = result125 !== null
? ( function ( $1 , $2 ) { return $1 ; } ) . apply ( null , result125 )
? ( function ( ) { return "+" ; } ) ( )
: null ;
@ -1281,7 +1318,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos25 ;
}
var result128 = result129 !== null
? ( function ( $1 , $2 ) { return $1 ; } ) . apply ( null , result129 )
? ( function ( ) { return "(" ; } ) ( )
: null ;
@ -1327,7 +1364,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos26 ;
}
var result132 = result133 !== null
? ( function ( $1 , $2 ) { return $1 ; } ) . apply ( null , result133 )
? ( function ( ) { return ")" ; } ) ( )
: null ;
@ -1373,7 +1410,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos27 ;
}
var result136 = result137 !== null
? ( function ( $1 , $2 ) { return $1 ; } ) . apply ( null , result137 )
? ( function ( ) { return "." ; } ) ( )
: null ;
@ -1526,9 +1563,9 @@ PEG.grammarParser = (function(){
this . _pos = savedPos28 ;
}
var result140 = result141 !== null
? ( function ( $1, $2 , $3 ) {
return $1 + $2 . join ( "" ) ;
} ) .apply ( null , result141 )
? ( function ( head, tail ) {
return head + tail . join ( "" ) ;
} ) (result141 [ 0 ] , result141 [ 1 ] )
: null ;
context . reportMatchFailures = savedReportMatchFailures ;
if ( context . reportMatchFailures && result140 === null ) {
@ -1579,7 +1616,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos29 ;
}
var result153 = result154 !== null
? ( function ( $1, $2 ) { return $1 ; } ) . apply ( null , result154 )
? ( function ( literal) { return literal ; } ) ( result154 [ 0 ] )
: null ;
context . reportMatchFailures = savedReportMatchFailures ;
if ( context . reportMatchFailures && result153 === null ) {
@ -1646,7 +1683,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos30 ;
}
var result159 = result160 !== null
? ( function ( $1, $2 , $3 ) { return $2 . join ( "" ) ; } ) .apply (null , result160 )
? ( function ( chars) { return chars . join ( "" ) ; } ) (result160 [ 1 ] )
: null ;
@ -1785,7 +1822,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos31 ;
}
var result172 = result173 !== null
? ( function ( $1, $2 ) { return $2 ; } ) . apply ( null , result173 )
? ( function ( char_ ) { return char _ ; } ) ( result173 [ 1 ] )
: null ;
@ -1850,7 +1887,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos33 ;
}
var result180 = result181 !== null
? ( function ( $1, $2 , $3 ) { return $2 . join ( "" ) ; } ) .apply (null , result181 )
? ( function ( chars) { return chars . join ( "" ) ; } ) (result181 [ 1 ] )
: null ;
@ -1989,7 +2026,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos34 ;
}
var result193 = result194 !== null
? ( function ( $1, $2 ) { return $2 ; } ) . apply ( null , result194 )
? ( function ( char_ ) { return char _ ; } ) ( result194 [ 1 ] )
: null ;
@ -2096,23 +2133,25 @@ PEG.grammarParser = (function(){
this . _pos = savedPos36 ;
}
var result201 = result202 !== null
? ( function ( $1 , $2 , $3 , $4 , $5 ) {
parts = PEG . ArrayUtils . map ( $3 , function ( part ) { return part . data ; } ) ;
? ( function ( inverted , parts ) {
partsConverted = PEG . ArrayUtils . map ( parts , function ( part ) {
return part . data ;
} ) ;
rawText = "["
+ $2
+ PEG . ArrayUtils . map ( $3 , function ( part ) {
+ inverted
+ PEG . ArrayUtils . map ( parts , function ( part ) {
return part . rawText ;
} ) . join ( "" )
+ "]" ;
return {
type : "class" ,
inverted : $2 === "^" ,
parts : parts ,
inverted : inverted === "^" ,
parts : parts Converted ,
// FIXME: Get the raw text from the input directly.
rawText : rawText
} ;
} ) .apply ( null , result202 )
} ) (result202 [ 1 ] , result202 [ 2 ] )
: null ;
context . reportMatchFailures = savedReportMatchFailures ;
if ( context . reportMatchFailures && result201 === null ) {
@ -2166,19 +2205,19 @@ PEG.grammarParser = (function(){
this . _pos = savedPos37 ;
}
var result212 = result213 !== null
? ( function ( $1, $2 , $3 ) {
if ( $1. data . charCodeAt ( 0 ) > $3 . data . charCodeAt ( 0 ) ) {
? ( function ( begin, end ) {
if ( begin. data . charCodeAt ( 0 ) > end . data . charCodeAt ( 0 ) ) {
throw new this . SyntaxError (
"Invalid character range: " + $1. rawText + "-" + $3 . rawText + "."
"Invalid character range: " + begin. rawText + "-" + end . rawText + "."
) ;
}
return {
data : [ $1. data , $3 . data ] ,
data : [ begin. data , end . data ] ,
// FIXME: Get the raw text from the input directly.
rawText : $1. rawText + "-" + $3 . rawText
rawText : begin. rawText + "-" + end . rawText
}
} ) .apply ( null , result213 )
} ) (result213 [ 0 ] , result213 [ 2 ] )
: null ;
@ -2203,11 +2242,11 @@ PEG.grammarParser = (function(){
var result218 = this . _parse _bracketDelimitedCharacter ( context ) ;
var result217 = result218 !== null
? ( function ( $1 ) {
? ( function ( char_ ) {
return {
data : $1 ,
data : char_ ,
// FIXME: Get the raw text from the input directly.
rawText : PEG . RegExpUtils . quoteForClass ( $1 )
rawText : PEG . RegExpUtils . quoteForClass ( char_ )
} ;
} ) ( result218 )
: null ;
@ -2348,7 +2387,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos38 ;
}
var result226 = result227 !== null
? ( function ( $1, $2 ) { return $2 ; } ) . apply ( null , result227 )
? ( function ( char_ ) { return char _ ; } ) ( result227 [ 1 ] )
: null ;
@ -2454,15 +2493,15 @@ PEG.grammarParser = (function(){
this . _pos = savedPos40 ;
}
var result234 = result235 !== null
? ( function ( $1, $2 , $3 ) {
return $3
? ( function ( char_ ) {
return char_
. replace ( "b" , "\b" )
. replace ( "f" , "\f" )
. replace ( "n" , "\n" )
. replace ( "r" , "\r" )
. replace ( "t" , "\t" )
. replace ( "v" , "\x0B" ) // IE does not recognize "\v".
} ) .apply (null , result235 )
} ) (result235 [ 2 ] )
: null ;
@ -2518,7 +2557,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos42 ;
}
var result244 = result245 !== null
? ( function ( $1 , $2 ) { return "\0" ; } ) . apply ( null , result245 )
? ( function ( ) { return "\0" ; } ) ( )
: null ;
@ -2570,9 +2609,9 @@ PEG.grammarParser = (function(){
this . _pos = savedPos44 ;
}
var result249 = result250 !== null
? ( function ( $1, $2 , $3 ) {
return String . fromCharCode ( parseInt ( "0x" + $2 + $3 ) ) ;
} ) .apply ( null , result250 )
? ( function ( h1, h2 ) {
return String . fromCharCode ( parseInt ( "0x" + h1 + h2 ) ) ;
} ) (result250 [ 1 ] , result250 [ 2 ] )
: null ;
@ -2636,9 +2675,9 @@ PEG.grammarParser = (function(){
this . _pos = savedPos45 ;
}
var result254 = result255 !== null
? ( function ( $1, $2 , $3 , $4 , $5 ) {
return String . fromCharCode ( parseInt ( "0x" + $2 + $3 + $4 + $5 ) ) ;
} ) .apply ( null , result255 )
? ( function ( h1, h2 , h3 , h4 ) {
return String . fromCharCode ( parseInt ( "0x" + h1 + h2 + h3 + h4 ) ) ;
} ) (result255 [ 1 ] , result255 [ 2 ] , result255 [ 3 ] , result255 [ 4 ] )
: null ;
@ -2684,7 +2723,7 @@ PEG.grammarParser = (function(){
this . _pos = savedPos46 ;
}
var result261 = result262 !== null
? ( function ( $1, $2 ) { return $2 ; } ) . apply ( null , result262 )
? ( function ( eol) { return eol ; } ) ( result262 [ 1 ] )
: null ;