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

Function readNextToken

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

Source from the content-addressed store, hash-verified

979 return new _ast.Token(kind, start, end, line, col, value);
980 }
981 function readNextToken(lexer, start) {
982 const body = lexer.source.body;
983 const bodyLength = body.length;
984 let position = start;
985 while (position < bodyLength) {
986 const code = body.charCodeAt(position);
987 switch (code) {
988 // Ignored ::
989 // - UnicodeBOM
990 // - WhiteSpace
991 // - LineTerminator
992 // - Comment
993 // - Comma
994 //
995 // UnicodeBOM :: "Byte Order Mark (U+FEFF)"
996 //
997 // WhiteSpace ::
998 // - "Horizontal Tab (U+0009)"
999 // - "Space (U+0020)"
1000 //
1001 // Comma :: ,
1002 case 65279:
1003 // <BOM>
1004 case 9:
1005 // \t
1006 case 32:
1007 // <space>
1008 case 44:
1009 ++position;
1010 continue;
1011 // LineTerminator ::
1012 // - "New Line (U+000A)"
1013 // - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"]
1014 // - "Carriage Return (U+000D)" "New Line (U+000A)"
1015 case 10:
1016 ++position;
1017 ++lexer.line;
1018 lexer.lineStart = position;
1019 continue;
1020 case 13:
1021 if (body.charCodeAt(position + 1) === 10) {
1022 position += 2;
1023 } else {
1024 ++position;
1025 }
1026 ++lexer.line;
1027 lexer.lineStart = position;
1028 continue;
1029 // Comment
1030 case 35:
1031 return readComment(lexer, position);
1032 // Token ::
1033 // - Punctuator
1034 // - Name
1035 // - IntValue
1036 // - FloatValue
1037 // - StringValue
1038 //

Callers 1

lookaheadMethod · 0.70

Calls 9

readCommentFunction · 0.70
createTokenFunction · 0.70
readBlockStringFunction · 0.70
readStringFunction · 0.70
readNumberFunction · 0.70
readNameFunction · 0.70
isUnicodeScalarValueFunction · 0.70
isSupplementaryCodePointFunction · 0.70
printCodePointAtFunction · 0.70

Tested by

no test coverage detected