(quote)
| 5986 | } |
| 5987 | |
| 5988 | function readString(quote) { |
| 5989 | var start = index; |
| 5990 | index++; |
| 5991 | var string = ""; |
| 5992 | var rawString = quote; |
| 5993 | var escape = false; |
| 5994 | while (index < text.length) { |
| 5995 | var ch = text.charAt(index); |
| 5996 | rawString += ch; |
| 5997 | if (escape) { |
| 5998 | if (ch == 'u') { |
| 5999 | var hex = text.substring(index + 1, index + 5); |
| 6000 | if (!hex.match(/[\da-f]{4}/i)) |
| 6001 | throwError( "Invalid unicode escape [\\u" + hex + "]"); |
| 6002 | index += 4; |
| 6003 | string += String.fromCharCode(parseInt(hex, 16)); |
| 6004 | } else { |
| 6005 | var rep = ESCAPE[ch]; |
| 6006 | if (rep) { |
| 6007 | string += rep; |
| 6008 | } else { |
| 6009 | string += ch; |
| 6010 | } |
| 6011 | } |
| 6012 | escape = false; |
| 6013 | } else if (ch == '\\') { |
| 6014 | escape = true; |
| 6015 | } else if (ch == quote) { |
| 6016 | index++; |
| 6017 | tokens.push({ |
| 6018 | index:start, |
| 6019 | text:rawString, |
| 6020 | string:string, |
| 6021 | json:true, |
| 6022 | fn:function() { return string; } |
| 6023 | }); |
| 6024 | return; |
| 6025 | } else { |
| 6026 | string += ch; |
| 6027 | } |
| 6028 | index++; |
| 6029 | } |
| 6030 | throwError("Unterminated quote", start); |
| 6031 | } |
| 6032 | } |
| 6033 | |
| 6034 | ///////////////////////////////////////// |
no test coverage detected