(isTaggedTemplate)
| 11146 | return resultingToken; |
| 11147 | } |
| 11148 | function scanEscapeSequence(isTaggedTemplate) { |
| 11149 | var start = pos; |
| 11150 | pos++; |
| 11151 | if (pos >= end) { |
| 11152 | error(ts.Diagnostics.Unexpected_end_of_text); |
| 11153 | return ""; |
| 11154 | } |
| 11155 | var ch = text.charCodeAt(pos); |
| 11156 | pos++; |
| 11157 | switch (ch) { |
| 11158 | case 48 /* CharacterCodes._0 */: |
| 11159 | // '\01' |
| 11160 | if (isTaggedTemplate && pos < end && isDigit(text.charCodeAt(pos))) { |
| 11161 | pos++; |
| 11162 | tokenFlags |= 2048 /* TokenFlags.ContainsInvalidEscape */; |
| 11163 | return text.substring(start, pos); |
| 11164 | } |
| 11165 | return "\0"; |
| 11166 | case 98 /* CharacterCodes.b */: |
| 11167 | return "\b"; |
| 11168 | case 116 /* CharacterCodes.t */: |
| 11169 | return "\t"; |
| 11170 | case 110 /* CharacterCodes.n */: |
| 11171 | return "\n"; |
| 11172 | case 118 /* CharacterCodes.v */: |
| 11173 | return "\v"; |
| 11174 | case 102 /* CharacterCodes.f */: |
| 11175 | return "\f"; |
| 11176 | case 114 /* CharacterCodes.r */: |
| 11177 | return "\r"; |
| 11178 | case 39 /* CharacterCodes.singleQuote */: |
| 11179 | return "\'"; |
| 11180 | case 34 /* CharacterCodes.doubleQuote */: |
| 11181 | return "\""; |
| 11182 | case 117 /* CharacterCodes.u */: |
| 11183 | if (isTaggedTemplate) { |
| 11184 | // '\u' or '\u0' or '\u00' or '\u000' |
| 11185 | for (var escapePos = pos; escapePos < pos + 4; escapePos++) { |
| 11186 | if (escapePos < end && !isHexDigit(text.charCodeAt(escapePos)) && text.charCodeAt(escapePos) !== 123 /* CharacterCodes.openBrace */) { |
| 11187 | pos = escapePos; |
| 11188 | tokenFlags |= 2048 /* TokenFlags.ContainsInvalidEscape */; |
| 11189 | return text.substring(start, pos); |
| 11190 | } |
| 11191 | } |
| 11192 | } |
| 11193 | // '\u{DDDDDDDD}' |
| 11194 | if (pos < end && text.charCodeAt(pos) === 123 /* CharacterCodes.openBrace */) { |
| 11195 | pos++; |
| 11196 | // '\u{' |
| 11197 | if (isTaggedTemplate && !isHexDigit(text.charCodeAt(pos))) { |
| 11198 | tokenFlags |= 2048 /* TokenFlags.ContainsInvalidEscape */; |
| 11199 | return text.substring(start, pos); |
| 11200 | } |
| 11201 | if (isTaggedTemplate) { |
| 11202 | var savePos = pos; |
| 11203 | var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false); |
| 11204 | var escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1; |
| 11205 | // '\u{Not Code Point' or '\u{CodePoint' |
no test coverage detected
searching dependent graphs…