@ -248,6 +248,30 @@ PEG.compiler.emitter = function(ast) {
'(function(){' ,
' /* Generated by PEG.js @VERSION (http://pegjs.majda.cz/). */' ,
' ' ,
/* This needs to be in sync with |quote| in utils.js. */
' function quote(s) {' ,
' /*' ,
' * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a' ,
' * string literal except for the closing quote character, backslash,' ,
' * carriage return, line separator, paragraph separator, and line feed.' ,
' * Any character may appear in the form of an escape sequence.' ,
' *' ,
' * For portability, we also escape escape all control and non-ASCII' ,
' * characters. Note that "\\0" and "\\v" escape sequences are not used' ,
' * because JSHint does not like the first and IE the second.' ,
' */' ,
' return \'"\' + s' ,
' .replace(/\\\\/g, \'\\\\\\\\\') // backslash' ,
' .replace(/"/g, \'\\\\"\') // closing quote character' ,
' .replace(/\\x08/g, \'\\\\b\') // backspace' ,
' .replace(/\\t/g, \'\\\\t\') // horizontal tab' ,
' .replace(/\\n/g, \'\\\\n\') // line feed' ,
' .replace(/\\f/g, \'\\\\f\') // form feed' ,
' .replace(/\\r/g, \'\\\\r\') // carriage return' ,
' .replace(/[\\x00-\\x07\\x0B\\x0E-\\x1F\\x80-\\uFFFF]/g, escape)' ,
' + \'"\';' ,
' }' ,
' ' ,
' var result = {' ,
' /*' ,
' * Parses the input with a generated parser. If the parsing is successfull,' ,
@ -303,30 +327,6 @@ PEG.compiler.emitter = function(ast) {
' return \'\\\\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), \'0\', length);' ,
' }' ,
' ' ,
/* This needs to be in sync with |quote| in utils.js. */
' function quote(s) {' ,
' /*' ,
' * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a' ,
' * string literal except for the closing quote character, backslash,' ,
' * carriage return, line separator, paragraph separator, and line feed.' ,
' * Any character may appear in the form of an escape sequence.' ,
' *' ,
' * For portability, we also escape escape all control and non-ASCII' ,
' * characters. Note that "\\0" and "\\v" escape sequences are not used' ,
' * because JSHint does not like the first and IE the second.' ,
' */' ,
' return \'"\' + s' ,
' .replace(/\\\\/g, \'\\\\\\\\\') // backslash' ,
' .replace(/"/g, \'\\\\"\') // closing quote character' ,
' .replace(/\\x08/g, \'\\\\b\') // backspace' ,
' .replace(/\\t/g, \'\\\\t\') // horizontal tab' ,
' .replace(/\\n/g, \'\\\\n\') // line feed' ,
' .replace(/\\f/g, \'\\\\f\') // form feed' ,
' .replace(/\\r/g, \'\\\\r\') // carriage return' ,
' .replace(/[\\x00-\\x07\\x0B\\x0E-\\x1F\\x80-\\uFFFF]/g, escape)' ,
' + \'"\';' ,
' }' ,
' ' ,
' function matchFailed(failure) {' ,
' if (pos < rightmostFailuresPos) {' ,
' return;' ,