MCPcopy Create free account
hub / github.com/openai/plugins / readString

Function readString

plugins/shopify/skills/shopify-admin/scripts/validate.mjs:1262–1311  ·  view source on GitHub ↗
(lexer, start)

Source from the content-addressed store, hash-verified

1260 return position;
1261 }
1262 function readString(lexer, start) {
1263 const body = lexer.source.body;
1264 const bodyLength = body.length;
1265 let position = start + 1;
1266 let chunkStart = position;
1267 let value = "";
1268 while (position < bodyLength) {
1269 const code = body.charCodeAt(position);
1270 if (code === 34) {
1271 value += body.slice(chunkStart, position);
1272 return createToken(
1273 lexer,
1274 _tokenKind.TokenKind.STRING,
1275 start,
1276 position + 1,
1277 value
1278 );
1279 }
1280 if (code === 92) {
1281 value += body.slice(chunkStart, position);
1282 const escape = body.charCodeAt(position + 1) === 117 ? body.charCodeAt(position + 2) === 123 ? readEscapedUnicodeVariableWidth(lexer, position) : readEscapedUnicodeFixedWidth(lexer, position) : readEscapedCharacter(lexer, position);
1283 value += escape.value;
1284 position += escape.size;
1285 chunkStart = position;
1286 continue;
1287 }
1288 if (code === 10 || code === 13) {
1289 break;
1290 }
1291 if (isUnicodeScalarValue(code)) {
1292 ++position;
1293 } else if (isSupplementaryCodePoint(body, position)) {
1294 position += 2;
1295 } else {
1296 throw (0, _syntaxError.syntaxError)(
1297 lexer.source,
1298 position,
1299 `Invalid character within String: ${printCodePointAt(
1300 lexer,
1301 position
1302 )}.`
1303 );
1304 }
1305 }
1306 throw (0, _syntaxError.syntaxError)(
1307 lexer.source,
1308 position,
1309 "Unterminated string."
1310 );
1311 }
1312 function readEscapedUnicodeVariableWidth(lexer, position) {
1313 const body = lexer.source.body;
1314 let point = 0;

Callers 1

readNextTokenFunction · 0.70

Calls 7

createTokenFunction · 0.70
readEscapedCharacterFunction · 0.70
isUnicodeScalarValueFunction · 0.70
isSupplementaryCodePointFunction · 0.70
printCodePointAtFunction · 0.70

Tested by

no test coverage detected