javascript/ractive.js
function makeQuotedStringMatcher ( okQuote ) {
  	return function ( parser ) {
  		var literal = '"';
  		var done = false;
  		var next;

  		while ( !done ) {
  			next = ( parser.matchPattern( stringMiddlePattern ) || parser.matchPattern( escapeSequencePattern ) ||
  				parser.matchString( okQuote ) );
  			if ( next ) {
  				if ( next === ("\"") ) {
  					literal += "\\\"";
  				} else if ( next === ("\\'") ) {
  					literal += "'";
  				} else {
  					literal += next;
  				}
  			} else {
  				next = parser.matchPattern( lineContinuationPattern );
  				if ( next ) {
  					// convert \(newline-like) into a \u escape, which is allowed in JSON
  					literal += '\\u' + ( '000' + next.charCodeAt(1).toString(16) ).slice( -4 );
  				} else {
  					done = true;
  				}
  			}
  		}

  		literal += '"';

  		// use JSON.parse to interpret escapes
  		return JSON.parse( literal );
  	};
  }
function makeQuotedStringMatcher ( okQuote ) {
  	return function ( parser ) {
  		var literal = '"';
  		var done = false;
  		var next;

  		while ( !done ) {
  			next = ( parser.matchPattern( stringMiddlePattern ) || parser.matchPattern( escapeSequencePattern ) ||
  				parser.matchString( okQuote ) );
  			if ( next ) {
  				if ( next === ("\"") ) {
  					literal += "\\\"";
  				} else if ( next === ("\\'") ) {
  					literal += "'";
  				} else {
  					literal += next;
  				}
  			} else {
  				next = parser.matchPattern( lineContinuationPattern );
  				if ( next ) {
  					// convert \(newline-like) into a \u escape, which is allowed in JSON
  					literal += '\\u' + ( '000' + next.charCodeAt(1).toString(16) ).slice( -4 );
  				} else {
  					done = true;
  				}
  			}
  		}

  		literal += '"';

  		// use JSON.parse to interpret escapes
  		return JSON.parse( literal );
  	};
  }
function makeQuotedStringMatcher ( okQuote ) { return function ( parser ) { var literal = '"' ; var done = false ; var next ; while ( ! done ) { next = ( parser . matchPattern ( stringMiddlePattern ) || parser . matchPattern ( escapeSequencePattern ) || parser . matchString ( okQuote ) ) ; if ( next ) { if ( next === ( "\"" ) ) { literal += "\\\"" ; } else if ( next === ( "\\'" ) ) { literal += "'" ; } else { literal += next ; } } else { next = parser . matchPattern ( lineContinuationPattern ) ; if ( next ) { // convert \(newline-like) into a \u escape, which is allowed in JSON literal += '\\u' + ( '000' + next . charCodeAt ( 1 ) . toString ( 16 ) ) . slice ( - 4 ) ; } else { done = true ; } } } literal += '"' ; // use JSON.parse to interpret escapes return JSON . parse ( literal ) ; } ; }
Helper for defining getDoubleQuotedString and getSingleQuotedString.
Helper for defining getDoubleQuotedString and getSingleQuotedString .