MCPcopy Index your code
hub / github.com/nodejs/node / scanString

Function scanString

test/fixtures/snapshot/typescript.js:11055–11089  ·  view source on GitHub ↗
(jsxAttributeString)

Source from the content-addressed store, hash-verified

11053 return String.fromCharCode.apply(String, valueChars);
11054 }
11055 function scanString(jsxAttributeString) {
11056 if (jsxAttributeString === void 0) { jsxAttributeString = false; }
11057 var quote = text.charCodeAt(pos);
11058 pos++;
11059 var result = "";
11060 var start = pos;
11061 while (true) {
11062 if (pos >= end) {
11063 result += text.substring(start, pos);
11064 tokenFlags |= 4 /* TokenFlags.Unterminated */;
11065 error(ts.Diagnostics.Unterminated_string_literal);
11066 break;
11067 }
11068 var ch = text.charCodeAt(pos);
11069 if (ch === quote) {
11070 result += text.substring(start, pos);
11071 pos++;
11072 break;
11073 }
11074 if (ch === 92 /* CharacterCodes.backslash */ && !jsxAttributeString) {
11075 result += text.substring(start, pos);
11076 result += scanEscapeSequence();
11077 start = pos;
11078 continue;
11079 }
11080 if (isLineBreak(ch) && !jsxAttributeString) {
11081 result += text.substring(start, pos);
11082 tokenFlags |= 4 /* TokenFlags.Unterminated */;
11083 error(ts.Diagnostics.Unterminated_string_literal);
11084 break;
11085 }
11086 pos++;
11087 }
11088 return result;
11089 }
11090 /**
11091 * Sets the current 'tokenValue' and returns a NoSubstitutionTemplateLiteral or
11092 * a literal component of a TemplateExpression.

Callers 2

scanFunction · 0.85
scanJsxAttributeValueFunction · 0.85

Calls 3

scanEscapeSequenceFunction · 0.85
isLineBreakFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…