{"ast":null,"code":"import { input, state } from \"../traverser/base\";\nimport { charCodes } from \"../util/charcodes\";\nimport { IS_IDENTIFIER_CHAR } from \"../util/identifier\";\nimport { finishToken } from \"./index\";\nimport { READ_WORD_TREE } from \"./readWordTree\";\nimport { TokenType as tt } from \"./types\";\n\n/**\n * Read an identifier, producing either a name token or matching on one of the existing keywords.\n * For performance, we pre-generate big decision tree that we traverse. Each node represents a\n * prefix and has 27 values, where the first value is the token or contextual token, if any (-1 if\n * not), and the other 26 values are the transitions to other nodes, or -1 to stop.\n */\nexport default function readWord() {\n  let treePos = 0;\n  let code = 0;\n  let pos = state.pos;\n  while (pos < input.length) {\n    code = input.charCodeAt(pos);\n    if (code < charCodes.lowercaseA || code > charCodes.lowercaseZ) {\n      break;\n    }\n    const next = READ_WORD_TREE[treePos + (code - charCodes.lowercaseA) + 1];\n    if (next === -1) {\n      break;\n    } else {\n      treePos = next;\n      pos++;\n    }\n  }\n  const keywordValue = READ_WORD_TREE[treePos];\n  if (keywordValue > -1 && !IS_IDENTIFIER_CHAR[code]) {\n    state.pos = pos;\n    if (keywordValue & 1) {\n      finishToken(keywordValue >>> 1);\n    } else {\n      finishToken(tt.name, keywordValue >>> 1);\n    }\n    return;\n  }\n  while (pos < input.length) {\n    const ch = input.charCodeAt(pos);\n    if (IS_IDENTIFIER_CHAR[ch]) {\n      pos++;\n    } else if (ch === charCodes.backslash) {\n      // \\u\n      pos += 2;\n      if (input.charCodeAt(pos) === charCodes.leftCurlyBrace) {\n        while (pos < input.length && input.charCodeAt(pos) !== charCodes.rightCurlyBrace) {\n          pos++;\n        }\n        pos++;\n      }\n    } else if (ch === charCodes.atSign && input.charCodeAt(pos + 1) === charCodes.atSign) {\n      pos += 2;\n    } else {\n      break;\n    }\n  }\n  state.pos = pos;\n  finishToken(tt.name);\n}","map":{"version":3,"names":["input","state","charCodes","IS_IDENTIFIER_CHAR","finishToken","READ_WORD_TREE","TokenType","tt","readWord","treePos","code","pos","length","charCodeAt","lowercaseA","lowercaseZ","next","keywordValue","name","ch","backslash","leftCurlyBrace","rightCurlyBrace","atSign"],"sources":["C:/Users/user/Desktop/000newport/node_modules/sucrase/dist/esm/parser/tokenizer/readWord.js"],"sourcesContent":["import {input, state} from \"../traverser/base\";\nimport {charCodes} from \"../util/charcodes\";\nimport {IS_IDENTIFIER_CHAR} from \"../util/identifier\";\nimport {finishToken} from \"./index\";\nimport {READ_WORD_TREE} from \"./readWordTree\";\nimport {TokenType as tt} from \"./types\";\n\n/**\n * Read an identifier, producing either a name token or matching on one of the existing keywords.\n * For performance, we pre-generate big decision tree that we traverse. Each node represents a\n * prefix and has 27 values, where the first value is the token or contextual token, if any (-1 if\n * not), and the other 26 values are the transitions to other nodes, or -1 to stop.\n */\nexport default function readWord() {\n  let treePos = 0;\n  let code = 0;\n  let pos = state.pos;\n  while (pos < input.length) {\n    code = input.charCodeAt(pos);\n    if (code < charCodes.lowercaseA || code > charCodes.lowercaseZ) {\n      break;\n    }\n    const next = READ_WORD_TREE[treePos + (code - charCodes.lowercaseA) + 1];\n    if (next === -1) {\n      break;\n    } else {\n      treePos = next;\n      pos++;\n    }\n  }\n\n  const keywordValue = READ_WORD_TREE[treePos];\n  if (keywordValue > -1 && !IS_IDENTIFIER_CHAR[code]) {\n    state.pos = pos;\n    if (keywordValue & 1) {\n      finishToken(keywordValue >>> 1);\n    } else {\n      finishToken(tt.name, keywordValue >>> 1);\n    }\n    return;\n  }\n\n  while (pos < input.length) {\n    const ch = input.charCodeAt(pos);\n    if (IS_IDENTIFIER_CHAR[ch]) {\n      pos++;\n    } else if (ch === charCodes.backslash) {\n      // \\u\n      pos += 2;\n      if (input.charCodeAt(pos) === charCodes.leftCurlyBrace) {\n        while (pos < input.length && input.charCodeAt(pos) !== charCodes.rightCurlyBrace) {\n          pos++;\n        }\n        pos++;\n      }\n    } else if (ch === charCodes.atSign && input.charCodeAt(pos + 1) === charCodes.atSign) {\n      pos += 2;\n    } else {\n      break;\n    }\n  }\n  state.pos = pos;\n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