MCPcopy Create free account
hub / github.com/CloudBoost/cloudboost / lex

Function lex

sdk/src/CloudSocketClientLib.js:7524–7704  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7522 // the end of the source string. A token may be a string, number, `null`
7523 // literal, or Boolean literal.
7524 var lex = function() {
7525 var source = Source,
7526 length = source.length,
7527 value,
7528 begin,
7529 position,
7530 isSigned,
7531 charCode;
7532 while (Index < length) {
7533 charCode = source.charCodeAt(Index);
7534 switch (charCode) {
7535 case 9:
7536 case 10:
7537 case 13:
7538 case 32:
7539 // Skip whitespace tokens, including tabs, carriage returns, line
7540 // feeds, and space characters.
7541 Index++;
7542 break;
7543 case 123:
7544 case 125:
7545 case 91:
7546 case 93:
7547 case 58:
7548 case 44:
7549 // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at
7550 // the current position.
7551 value = charIndexBuggy
7552 ? source.charAt(Index)
7553 : source[Index];
7554 Index++;
7555 return value;
7556 case 34:
7557 // `"` delimits a JSON string; advance to the next character and
7558 // begin parsing the string. String tokens are prefixed with the
7559 // sentinel `@` character to distinguish them from punctuators and
7560 // end-of-string tokens.
7561 for (value = "@", Index++; Index < length;) {
7562 charCode = source.charCodeAt(Index);
7563 if (charCode < 32) {
7564 // Unescaped ASCII control characters (those with a code unit
7565 // less than the space character) are not permitted.
7566 abort();
7567 } else if (charCode == 92) {
7568 // A reverse solidus (`\`) marks the beginning of an escaped
7569 // control character (including `"`, `\`, and `/`) or Unicode
7570 // escape sequence.
7571 charCode = source.charCodeAt(++Index);
7572 switch (charCode) {
7573 case 92:
7574 case 34:
7575 case 47:
7576 case 98:
7577 case 116:
7578 case 110:
7579 case 102:
7580 case 114:
7581 // Revive escaped control characters.

Callers 2

getFunction · 0.70
runInContextFunction · 0.70

Calls 1

abortFunction · 0.70

Tested by

no test coverage detected