@ -30,7 +30,7 @@ module.exports = (function() {
. replace ( /[\u1080-\uFFFF]/g , function ( ch ) { return '\\u' + hex ( ch ) ; } ) ;
}
var expectedDesc , foundDesc ;
var expectedDesc s, expectedDesc , foundDesc , i ;
switch ( expected . length ) {
case 0 :
@ -38,13 +38,19 @@ module.exports = (function() {
break ;
case 1 :
expectedDesc = expected [ 0 ] ;
expectedDesc = expected [ 0 ] .description ;
break ;
default :
expectedDesc = expected . slice ( 0 , - 1 ) . join ( ", " )
expectedDescs = new Array ( expected . length ) ;
for ( i = 0 ; i < expected . length ; i ++ ) {
expectedDescs [ i ] = expected [ i ] . description ;
}
expectedDesc = expectedDescs . slice ( 0 , - 1 ) . join ( ", " )
+ " or "
+ expected [ expected . length - 1 ] ;
+ expected Descs [ expected . length - 1 ] ;
}
foundDesc = found ? "\"" + stringEscape ( found ) + "\"" : "end of input" ;
@ -197,60 +203,60 @@ module.exports = (function() {
} ,
peg$c19 = function ( ) { return { type : "any" } ; } ,
peg$c20 = function ( expression ) { return expression ; } ,
peg$c21 = "action" ,
peg$c21 = { type : "other" , description : "action" } ,
peg$c22 = function ( braced ) { return braced . substr ( 1 , braced . length - 2 ) ; } ,
peg$c23 = "{" ,
peg$c24 = "\"{\"" ,
peg$c24 = { type : "literal" , value : "{" , description : "\"{\"" } ,
peg$c25 = "}" ,
peg$c26 = "\"}\"" ,
peg$c26 = { type : "literal" , value : "}" , description : "\"}\"" } ,
peg$c27 = /^[^{}]/ ,
peg$c28 = "[^{}]" ,
peg$c28 = { type : "class" , value : "[^{}]" , description : "[^{}]" } ,
peg$c29 = "=" ,
peg$c30 = "\"=\"" ,
peg$c30 = { type : "literal" , value : "=" , description : "\"=\"" } ,
peg$c31 = function ( ) { return "=" ; } ,
peg$c32 = ":" ,
peg$c33 = "\":\"" ,
peg$c33 = { type : "literal" , value : ":" , description : "\":\"" } ,
peg$c34 = function ( ) { return ":" ; } ,
peg$c35 = ";" ,
peg$c36 = "\";\"" ,
peg$c36 = { type : "literal" , value : ";" , description : "\";\"" } ,
peg$c37 = function ( ) { return ";" ; } ,
peg$c38 = "/" ,
peg$c39 = "\"/\"" ,
peg$c39 = { type : "literal" , value : "/" , description : "\"/\"" } ,
peg$c40 = function ( ) { return "/" ; } ,
peg$c41 = "&" ,
peg$c42 = "\"&\"" ,
peg$c42 = { type : "literal" , value : "&" , description : "\"&\"" } ,
peg$c43 = function ( ) { return "&" ; } ,
peg$c44 = "!" ,
peg$c45 = "\"!\"" ,
peg$c45 = { type : "literal" , value : "!" , description : "\"!\"" } ,
peg$c46 = function ( ) { return "!" ; } ,
peg$c47 = "$" ,
peg$c48 = "\"$\"" ,
peg$c48 = { type : "literal" , value : "$" , description : "\"$\"" } ,
peg$c49 = function ( ) { return "$" ; } ,
peg$c50 = "?" ,
peg$c51 = "\"?\"" ,
peg$c51 = { type : "literal" , value : "?" , description : "\"?\"" } ,
peg$c52 = function ( ) { return "?" ; } ,
peg$c53 = "*" ,
peg$c54 = "\"*\"" ,
peg$c54 = { type : "literal" , value : "*" , description : "\"*\"" } ,
peg$c55 = function ( ) { return "*" ; } ,
peg$c56 = "+" ,
peg$c57 = "\"+\"" ,
peg$c57 = { type : "literal" , value : "+" , description : "\"+\"" } ,
peg$c58 = function ( ) { return "+" ; } ,
peg$c59 = "(" ,
peg$c60 = "\"(\"" ,
peg$c60 = { type : "literal" , value : "(" , description : "\"(\"" } ,
peg$c61 = function ( ) { return "(" ; } ,
peg$c62 = ")" ,
peg$c63 = "\")\"" ,
peg$c63 = { type : "literal" , value : ")" , description : "\")\"" } ,
peg$c64 = function ( ) { return ")" ; } ,
peg$c65 = "." ,
peg$c66 = "\".\"" ,
peg$c66 = { type : "literal" , value : "." , description : "\".\"" } ,
peg$c67 = function ( ) { return "." ; } ,
peg$c68 = "identifier" ,
peg$c68 = { type : "other" , description : "identifier" } ,
peg$c69 = "_" ,
peg$c70 = "\"_\"" ,
peg$c70 = { type : "literal" , value : "_" , description : "\"_\"" } ,
peg$c71 = function ( chars ) { return chars ; } ,
peg$c72 = "literal" ,
peg$c72 = { type : "other" , description : "literal" } ,
peg$c73 = "i" ,
peg$c74 = "\"i\"" ,
peg$c74 = { type : "literal" , value : "i" , description : "\"i\"" } ,
peg$c75 = function ( value , flags ) {
return {
type : "literal" ,
@ -258,24 +264,24 @@ module.exports = (function() {
ignoreCase : flags === "i"
} ;
} ,
peg$c76 = "string" ,
peg$c76 = { type : "other" , description : "string" } ,
peg$c77 = function ( string ) { return string ; } ,
peg$c78 = "\"" ,
peg$c79 = "\"\\\"\"" ,
peg$c79 = { type : "literal" , value : "\"" , description : "\"\\\"\"" } ,
peg$c80 = function ( chars ) { return chars . join ( "" ) ; } ,
peg$c81 = "\\" ,
peg$c82 = "\"\\\\\"" ,
peg$c83 = "any character" ,
peg$c82 = { type : "literal" , value : "\\" , description : "\"\\\\\"" } ,
peg$c83 = { type : "any" , description : "any character" } ,
peg$c84 = function ( char _ ) { return char _ ; } ,
peg$c85 = "'" ,
peg$c86 = "\"'\"" ,
peg$c87 = "character class" ,
peg$c86 = { type : "literal" , value : "'" , description : "\"'\"" } ,
peg$c87 = { type : "other" , description : "character class" } ,
peg$c88 = "[" ,
peg$c89 = "\"[\"" ,
peg$c89 = { type : "literal" , value : "[" , description : "\"[\"" } ,
peg$c90 = "^" ,
peg$c91 = "\"^\"" ,
peg$c91 = { type : "literal" , value : "^" , description : "\"^\"" } ,
peg$c92 = "]" ,
peg$c93 = "\"]\"" ,
peg$c93 = { type : "literal" , value : "]" , description : "\"]\"" } ,
peg$c94 = function ( inverted , parts , flags ) {
var partsConverted = utils . map ( parts , function ( part ) { return part . data ; } ) ;
var rawText = "["
@ -294,7 +300,7 @@ module.exports = (function() {
} ;
} ,
peg$c95 = "-" ,
peg$c96 = "\"-\"" ,
peg$c96 = { type : "literal" , value : "-" , description : "\"-\"" } ,
peg$c97 = function ( begin , end ) {
if ( begin . data . charCodeAt ( 0 ) > end . data . charCodeAt ( 0 ) ) {
throw new this . SyntaxError (
@ -316,9 +322,9 @@ module.exports = (function() {
} ;
} ,
peg$c99 = "x" ,
peg$c100 = "\"x\"" ,
peg$c100 = { type : "literal" , value : "x" , description : "\"x\"" } ,
peg$c101 = "u" ,
peg$c102 = "\"u\"" ,
peg$c102 = { type : "literal" , value : "u" , description : "\"u\"" } ,
peg$c103 = function ( char _ ) {
return char _
. replace ( "b" , "\b" )
@ -329,47 +335,47 @@ module.exports = (function() {
. replace ( "v" , "\x0B" ) ; // IE does not recognize "\v".
} ,
peg$c104 = "\\0" ,
peg$c105 = "\"\\\\0\"" ,
peg$c105 = { type : "literal" , value : "\\0" , description : "\"\\\\0\"" } ,
peg$c106 = function ( ) { return "\x00" ; } ,
peg$c107 = "\\x" ,
peg$c108 = "\"\\\\x\"" ,
peg$c108 = { type : "literal" , value : "\\x" , description : "\"\\\\x\"" } ,
peg$c109 = function ( digits ) {
return String . fromCharCode ( parseInt ( digits , 16 ) ) ;
} ,
peg$c110 = "\\u" ,
peg$c111 = "\"\\\\u\"" ,
peg$c111 = { type : "literal" , value : "\\u" , description : "\"\\\\u\"" } ,
peg$c112 = function ( eol ) { return eol ; } ,
peg$c113 = /^[0-9]/ ,
peg$c114 = "[0-9]" ,
peg$c114 = { type : "class" , value : "[0-9]" , description : "[0-9]" } ,
peg$c115 = /^[0-9a-fA-F]/ ,
peg$c116 = "[0-9a-fA-F]" ,
peg$c116 = { type : "class" , value : "[0-9a-fA-F]" , description : "[0-9a-fA-F]" } ,
peg$c117 = /^[a-z]/ ,
peg$c118 = "[a-z]" ,
peg$c118 = { type : "class" , value : "[a-z]" , description : "[a-z]" } ,
peg$c119 = /^[A-Z]/ ,
peg$c120 = "[A-Z]" ,
peg$c121 = "comment" ,
peg$c120 = { type : "class" , value : "[A-Z]" , description : "[A-Z]" } ,
peg$c121 = { type : "other" , description : "comment" } ,
peg$c122 = "//" ,
peg$c123 = "\"//\"" ,
peg$c123 = { type : "literal" , value : "//" , description : "\"//\"" } ,
peg$c124 = "/*" ,
peg$c125 = "\"/*\"" ,
peg$c125 = { type : "literal" , value : "/*" , description : "\"/*\"" } ,
peg$c126 = "*/" ,
peg$c127 = "\"*/\"" ,
peg$c128 = "end of line" ,
peg$c127 = { type : "literal" , value : "*/" , description : "\"*/\"" } ,
peg$c128 = { type : "other" , description : "end of line" } ,
peg$c129 = "\n" ,
peg$c130 = "\"\\n\"" ,
peg$c130 = { type : "literal" , value : "\n" , description : "\"\\n\"" } ,
peg$c131 = "\r\n" ,
peg$c132 = "\"\\r\\n\"" ,
peg$c132 = { type : "literal" , value : "\r\n" , description : "\"\\r\\n\"" } ,
peg$c133 = "\r" ,
peg$c134 = "\"\\r\"" ,
peg$c134 = { type : "literal" , value : "\r" , description : "\"\\r\"" } ,
peg$c135 = "\u2028" ,
peg$c136 = "\"\\u2028\"" ,
peg$c136 = { type : "literal" , value : "\u2028" , description : "\"\\u2028\"" } ,
peg$c137 = "\u2029" ,
peg$c138 = "\"\\u2029\"" ,
peg$c138 = { type : "literal" , value : "\u2029" , description : "\"\\u2029\"" } ,
peg$c139 = /^[\n\r\u2028\u2029]/ ,
peg$c140 = "[\\n\\r\\u2028\\u2029]" ,
peg$c141 = "whitespace" ,
peg$c140 = { type : "class" , value : "[\\n\\r\\u2028\\u2029]" , description : "[\\n\\r\\u2028\\u2029]" } ,
peg$c141 = { type : "other" , description : "whitespace" } ,
peg$c142 = /^[ \t\x0B\f\xA0\uFEFF\u1680\u180E\u2000-\u200A\u202F\u205F\u3000]/ ,
peg$c143 = "[ \\t\\x0B\\f\\xA0\\uFEFF\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]" ,
peg$c143 = { type : "class" , value : "[ \\t\\x0B\\f\\xA0\\uFEFF\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]" , description : "[ \\t\\x0B\\f\\xA0\\uFEFF\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000]" } ,
peg$currPos = 0 ,
peg$reportedPos = 0 ,
@ -452,7 +458,15 @@ module.exports = (function() {
function peg$cleanupExpected ( expected ) {
var i = 0 ;
expected . sort ( ) ;
expected . sort ( function ( a , b ) {
if ( a . description < b . description ) {
return - 1 ;
} else if ( a . description > b . description ) {
return 1 ;
} else {
return 0 ;
}
} ) ;
while ( i < expected . length ) {
if ( expected [ i - 1 ] === expected [ i ] ) {