typescript-native-bridge 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +55 -0
- package/NOTICE +18 -0
- package/README.md +448 -0
- package/bin/tsc +2 -0
- package/bin/tsserver +2 -0
- package/lib/.gitattributes +1 -0
- package/lib/_tsc.js +136979 -0
- package/lib/_tsserver.js +659 -0
- package/lib/_typingsInstaller.js +222 -0
- package/lib/cs/diagnosticMessages.generated.json +2129 -0
- package/lib/de/diagnosticMessages.generated.json +2125 -0
- package/lib/es/diagnosticMessages.generated.json +2129 -0
- package/lib/fr/diagnosticMessages.generated.json +2129 -0
- package/lib/it/diagnosticMessages.generated.json +2125 -0
- package/lib/ja/diagnosticMessages.generated.json +2129 -0
- package/lib/ko/diagnosticMessages.generated.json +2129 -0
- package/lib/lib.d.ts +20 -0
- package/lib/lib.decorators.d.ts +382 -0
- package/lib/lib.decorators.legacy.d.ts +20 -0
- package/lib/lib.dom.asynciterable.d.ts +18 -0
- package/lib/lib.dom.d.ts +45125 -0
- package/lib/lib.dom.iterable.d.ts +18 -0
- package/lib/lib.es2015.collection.d.ts +159 -0
- package/lib/lib.es2015.core.d.ts +595 -0
- package/lib/lib.es2015.d.ts +26 -0
- package/lib/lib.es2015.generator.d.ts +75 -0
- package/lib/lib.es2015.iterable.d.ts +603 -0
- package/lib/lib.es2015.promise.d.ts +79 -0
- package/lib/lib.es2015.proxy.d.ts +126 -0
- package/lib/lib.es2015.reflect.d.ts +142 -0
- package/lib/lib.es2015.symbol.d.ts +44 -0
- package/lib/lib.es2015.symbol.wellknown.d.ts +324 -0
- package/lib/lib.es2016.array.include.d.ts +114 -0
- package/lib/lib.es2016.d.ts +19 -0
- package/lib/lib.es2016.full.d.ts +21 -0
- package/lib/lib.es2016.intl.d.ts +29 -0
- package/lib/lib.es2017.arraybuffer.d.ts +19 -0
- package/lib/lib.es2017.d.ts +24 -0
- package/lib/lib.es2017.date.d.ts +29 -0
- package/lib/lib.es2017.full.d.ts +21 -0
- package/lib/lib.es2017.intl.d.ts +42 -0
- package/lib/lib.es2017.object.d.ts +47 -0
- package/lib/lib.es2017.sharedmemory.d.ts +133 -0
- package/lib/lib.es2017.string.d.ts +47 -0
- package/lib/lib.es2017.typedarrays.d.ts +51 -0
- package/lib/lib.es2018.asyncgenerator.d.ts +75 -0
- package/lib/lib.es2018.asynciterable.d.ts +51 -0
- package/lib/lib.es2018.d.ts +22 -0
- package/lib/lib.es2018.full.d.ts +22 -0
- package/lib/lib.es2018.intl.d.ts +81 -0
- package/lib/lib.es2018.promise.d.ts +28 -0
- package/lib/lib.es2018.regexp.d.ts +35 -0
- package/lib/lib.es2019.array.d.ts +77 -0
- package/lib/lib.es2019.d.ts +22 -0
- package/lib/lib.es2019.full.d.ts +22 -0
- package/lib/lib.es2019.intl.d.ts +21 -0
- package/lib/lib.es2019.object.d.ts +31 -0
- package/lib/lib.es2019.string.d.ts +35 -0
- package/lib/lib.es2019.symbol.d.ts +22 -0
- package/lib/lib.es2020.bigint.d.ts +763 -0
- package/lib/lib.es2020.d.ts +25 -0
- package/lib/lib.es2020.date.d.ts +40 -0
- package/lib/lib.es2020.full.d.ts +22 -0
- package/lib/lib.es2020.intl.d.ts +472 -0
- package/lib/lib.es2020.number.d.ts +26 -0
- package/lib/lib.es2020.promise.d.ts +45 -0
- package/lib/lib.es2020.sharedmemory.d.ts +97 -0
- package/lib/lib.es2020.string.d.ts +42 -0
- package/lib/lib.es2020.symbol.wellknown.d.ts +39 -0
- package/lib/lib.es2021.d.ts +21 -0
- package/lib/lib.es2021.full.d.ts +22 -0
- package/lib/lib.es2021.intl.d.ts +164 -0
- package/lib/lib.es2021.promise.d.ts +46 -0
- package/lib/lib.es2021.string.d.ts +31 -0
- package/lib/lib.es2021.weakref.d.ts +76 -0
- package/lib/lib.es2022.array.d.ts +119 -0
- package/lib/lib.es2022.d.ts +23 -0
- package/lib/lib.es2022.error.d.ts +73 -0
- package/lib/lib.es2022.full.d.ts +22 -0
- package/lib/lib.es2022.intl.d.ts +143 -0
- package/lib/lib.es2022.object.d.ts +24 -0
- package/lib/lib.es2022.regexp.d.ts +37 -0
- package/lib/lib.es2022.string.d.ts +23 -0
- package/lib/lib.es2023.array.d.ts +922 -0
- package/lib/lib.es2023.collection.d.ts +19 -0
- package/lib/lib.es2023.d.ts +20 -0
- package/lib/lib.es2023.full.d.ts +22 -0
- package/lib/lib.es2023.intl.d.ts +62 -0
- package/lib/lib.es2024.arraybuffer.d.ts +63 -0
- package/lib/lib.es2024.collection.d.ts +27 -0
- package/lib/lib.es2024.d.ts +24 -0
- package/lib/lib.es2024.full.d.ts +22 -0
- package/lib/lib.es2024.object.d.ts +27 -0
- package/lib/lib.es2024.promise.d.ts +33 -0
- package/lib/lib.es2024.regexp.d.ts +23 -0
- package/lib/lib.es2024.sharedmemory.d.ts +66 -0
- package/lib/lib.es2024.string.d.ts +27 -0
- package/lib/lib.es2025.collection.d.ts +94 -0
- package/lib/lib.es2025.d.ts +23 -0
- package/lib/lib.es2025.float16.d.ts +443 -0
- package/lib/lib.es2025.full.d.ts +22 -0
- package/lib/lib.es2025.intl.d.ts +200 -0
- package/lib/lib.es2025.iterator.d.ts +146 -0
- package/lib/lib.es2025.promise.d.ts +32 -0
- package/lib/lib.es2025.regexp.d.ts +30 -0
- package/lib/lib.es5.d.ts +4599 -0
- package/lib/lib.es6.d.ts +21 -0
- package/lib/lib.esnext.array.d.ts +33 -0
- package/lib/lib.esnext.collection.d.ts +47 -0
- package/lib/lib.esnext.d.ts +27 -0
- package/lib/lib.esnext.date.d.ts +21 -0
- package/lib/lib.esnext.decorators.d.ts +26 -0
- package/lib/lib.esnext.disposable.d.ts +191 -0
- package/lib/lib.esnext.error.d.ts +22 -0
- package/lib/lib.esnext.full.d.ts +22 -0
- package/lib/lib.esnext.intl.d.ts +107 -0
- package/lib/lib.esnext.sharedmemory.d.ts +23 -0
- package/lib/lib.esnext.temporal.d.ts +485 -0
- package/lib/lib.esnext.typedarrays.d.ts +90 -0
- package/lib/lib.scripthost.d.ts +320 -0
- package/lib/lib.webworker.asynciterable.d.ts +18 -0
- package/lib/lib.webworker.d.ts +15606 -0
- package/lib/lib.webworker.importscripts.d.ts +21 -0
- package/lib/lib.webworker.iterable.d.ts +18 -0
- package/lib/pl/diagnosticMessages.generated.json +2129 -0
- package/lib/pt-br/diagnosticMessages.generated.json +2129 -0
- package/lib/ru/diagnosticMessages.generated.json +2125 -0
- package/lib/tr/diagnosticMessages.generated.json +2129 -0
- package/lib/tsc.js +8 -0
- package/lib/tsserver.js +8 -0
- package/lib/tsserverlibrary.d.ts +17 -0
- package/lib/tsserverlibrary.js +21 -0
- package/lib/typesMap.json +497 -0
- package/lib/typescript.d.ts +11454 -0
- package/lib/typescript.js +203598 -0
- package/lib/typingsInstaller.js +8 -0
- package/lib/watchGuard.js +53 -0
- package/lib/zh-cn/diagnosticMessages.generated.json +2129 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +2125 -0
- package/native/bridge.dylib +0 -0
- package/native/bridge.h +103 -0
- package/package.json +35 -0
- package/vendor/native-preview/bin/tsgo +2 -0
- package/vendor/native-preview/dist/api/async/api.d.ts +408 -0
- package/vendor/native-preview/dist/api/async/api.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/async/api.js +1467 -0
- package/vendor/native-preview/dist/api/async/api.js.map +1 -0
- package/vendor/native-preview/dist/api/async/client.d.ts +22 -0
- package/vendor/native-preview/dist/api/async/client.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/async/client.js +140 -0
- package/vendor/native-preview/dist/api/async/client.js.map +1 -0
- package/vendor/native-preview/dist/api/async/types.d.ts +298 -0
- package/vendor/native-preview/dist/api/async/types.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/async/types.js +2 -0
- package/vendor/native-preview/dist/api/async/types.js.map +1 -0
- package/vendor/native-preview/dist/api/fs.d.ts +23 -0
- package/vendor/native-preview/dist/api/fs.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/fs.js +109 -0
- package/vendor/native-preview/dist/api/fs.js.map +1 -0
- package/vendor/native-preview/dist/api/node/encoder.d.ts +15 -0
- package/vendor/native-preview/dist/api/node/encoder.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/node/encoder.generated.d.ts +5 -0
- package/vendor/native-preview/dist/api/node/encoder.generated.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/node/encoder.generated.js +74 -0
- package/vendor/native-preview/dist/api/node/encoder.generated.js.map +1 -0
- package/vendor/native-preview/dist/api/node/encoder.js +304 -0
- package/vendor/native-preview/dist/api/node/encoder.js.map +1 -0
- package/vendor/native-preview/dist/api/node/msgpack.d.ts +32 -0
- package/vendor/native-preview/dist/api/node/msgpack.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/node/msgpack.js +212 -0
- package/vendor/native-preview/dist/api/node/msgpack.js.map +1 -0
- package/vendor/native-preview/dist/api/node/node.d.ts +70 -0
- package/vendor/native-preview/dist/api/node/node.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/node/node.generated.d.ts +182 -0
- package/vendor/native-preview/dist/api/node/node.generated.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/node/node.generated.js +850 -0
- package/vendor/native-preview/dist/api/node/node.generated.js.map +1 -0
- package/vendor/native-preview/dist/api/node/node.infrastructure.d.ts +53 -0
- package/vendor/native-preview/dist/api/node/node.infrastructure.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/node/node.infrastructure.js +126 -0
- package/vendor/native-preview/dist/api/node/node.infrastructure.js.map +1 -0
- package/vendor/native-preview/dist/api/node/node.js +252 -0
- package/vendor/native-preview/dist/api/node/node.js.map +1 -0
- package/vendor/native-preview/dist/api/node/protocol.d.ts +29 -0
- package/vendor/native-preview/dist/api/node/protocol.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/node/protocol.generated.d.ts +4 -0
- package/vendor/native-preview/dist/api/node/protocol.generated.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/node/protocol.generated.js +241 -0
- package/vendor/native-preview/dist/api/node/protocol.generated.js.map +1 -0
- package/vendor/native-preview/dist/api/node/protocol.js +30 -0
- package/vendor/native-preview/dist/api/node/protocol.js.map +1 -0
- package/vendor/native-preview/dist/api/options.d.ts +24 -0
- package/vendor/native-preview/dist/api/options.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/options.js +11 -0
- package/vendor/native-preview/dist/api/options.js.map +1 -0
- package/vendor/native-preview/dist/api/path.d.ts +110 -0
- package/vendor/native-preview/dist/api/path.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/path.js +508 -0
- package/vendor/native-preview/dist/api/path.js.map +1 -0
- package/vendor/native-preview/dist/api/proto.d.ts +236 -0
- package/vendor/native-preview/dist/api/proto.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/proto.js +37 -0
- package/vendor/native-preview/dist/api/proto.js.map +1 -0
- package/vendor/native-preview/dist/api/sourceFileCache.d.ts +79 -0
- package/vendor/native-preview/dist/api/sourceFileCache.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/sourceFileCache.js +169 -0
- package/vendor/native-preview/dist/api/sourceFileCache.js.map +1 -0
- package/vendor/native-preview/dist/api/sync/api.d.ts +436 -0
- package/vendor/native-preview/dist/api/sync/api.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/sync/api.js +1573 -0
- package/vendor/native-preview/dist/api/sync/api.js.map +1 -0
- package/vendor/native-preview/dist/api/sync/client.d.ts +13 -0
- package/vendor/native-preview/dist/api/sync/client.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/sync/client.js +72 -0
- package/vendor/native-preview/dist/api/sync/client.js.map +1 -0
- package/vendor/native-preview/dist/api/sync/types.d.ts +311 -0
- package/vendor/native-preview/dist/api/sync/types.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/sync/types.js +2 -0
- package/vendor/native-preview/dist/api/sync/types.js.map +1 -0
- package/vendor/native-preview/dist/api/syncChannel.d.ts +111 -0
- package/vendor/native-preview/dist/api/syncChannel.d.ts.map +1 -0
- package/vendor/native-preview/dist/api/syncChannel.js +488 -0
- package/vendor/native-preview/dist/api/syncChannel.js.map +1 -0
- package/vendor/native-preview/dist/ast/ast.d.ts +76 -0
- package/vendor/native-preview/dist/ast/ast.d.ts.map +1 -0
- package/vendor/native-preview/dist/ast/ast.generated.d.ts +1161 -0
- package/vendor/native-preview/dist/ast/ast.generated.d.ts.map +1 -0
- package/vendor/native-preview/dist/ast/ast.generated.js +4 -0
- package/vendor/native-preview/dist/ast/ast.generated.js.map +1 -0
- package/vendor/native-preview/dist/ast/ast.js +7 -0
- package/vendor/native-preview/dist/ast/ast.js.map +1 -0
- package/vendor/native-preview/dist/ast/astnav.d.ts +19 -0
- package/vendor/native-preview/dist/ast/astnav.d.ts.map +1 -0
- package/vendor/native-preview/dist/ast/astnav.js +596 -0
- package/vendor/native-preview/dist/ast/astnav.js.map +1 -0
- package/vendor/native-preview/dist/ast/clone.d.ts +16 -0
- package/vendor/native-preview/dist/ast/clone.d.ts.map +1 -0
- package/vendor/native-preview/dist/ast/clone.js +104 -0
- package/vendor/native-preview/dist/ast/clone.js.map +1 -0
- package/vendor/native-preview/dist/ast/factory.generated.d.ts +522 -0
- package/vendor/native-preview/dist/ast/factory.generated.d.ts.map +1 -0
- package/vendor/native-preview/dist/ast/factory.generated.js +3059 -0
- package/vendor/native-preview/dist/ast/factory.generated.js.map +1 -0
- package/vendor/native-preview/dist/ast/index.d.ts +18 -0
- package/vendor/native-preview/dist/ast/index.d.ts.map +1 -0
- package/vendor/native-preview/dist/ast/index.js +18 -0
- package/vendor/native-preview/dist/ast/index.js.map +1 -0
- package/vendor/native-preview/dist/ast/is.d.ts +34 -0
- package/vendor/native-preview/dist/ast/is.d.ts.map +1 -0
- package/vendor/native-preview/dist/ast/is.generated.d.ts +330 -0
- package/vendor/native-preview/dist/ast/is.generated.d.ts.map +1 -0
- package/vendor/native-preview/dist/ast/is.generated.js +1107 -0
- package/vendor/native-preview/dist/ast/is.generated.js.map +1 -0
- package/vendor/native-preview/dist/ast/is.js +226 -0
- package/vendor/native-preview/dist/ast/is.js.map +1 -0
- package/vendor/native-preview/dist/ast/scanner.d.ts +97 -0
- package/vendor/native-preview/dist/ast/scanner.d.ts.map +1 -0
- package/vendor/native-preview/dist/ast/scanner.js +2230 -0
- package/vendor/native-preview/dist/ast/scanner.js.map +1 -0
- package/vendor/native-preview/dist/ast/utils.d.ts +7 -0
- package/vendor/native-preview/dist/ast/utils.d.ts.map +1 -0
- package/vendor/native-preview/dist/ast/utils.js +47 -0
- package/vendor/native-preview/dist/ast/utils.js.map +1 -0
- package/vendor/native-preview/dist/ast/visitor.d.ts +14 -0
- package/vendor/native-preview/dist/ast/visitor.d.ts.map +1 -0
- package/vendor/native-preview/dist/ast/visitor.generated.d.ts +50 -0
- package/vendor/native-preview/dist/ast/visitor.generated.d.ts.map +1 -0
- package/vendor/native-preview/dist/ast/visitor.generated.js +978 -0
- package/vendor/native-preview/dist/ast/visitor.generated.js.map +1 -0
- package/vendor/native-preview/dist/ast/visitor.js +47 -0
- package/vendor/native-preview/dist/ast/visitor.js.map +1 -0
- package/vendor/native-preview/dist/enums/characterCodes.d.ts +2 -0
- package/vendor/native-preview/dist/enums/characterCodes.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/characterCodes.enum.d.ts +129 -0
- package/vendor/native-preview/dist/enums/characterCodes.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/characterCodes.enum.js +132 -0
- package/vendor/native-preview/dist/enums/characterCodes.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/characterCodes.js +130 -0
- package/vendor/native-preview/dist/enums/characterCodes.js.map +1 -0
- package/vendor/native-preview/dist/enums/commentDirectiveType.d.ts +2 -0
- package/vendor/native-preview/dist/enums/commentDirectiveType.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/commentDirectiveType.enum.d.ts +5 -0
- package/vendor/native-preview/dist/enums/commentDirectiveType.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/commentDirectiveType.enum.js +6 -0
- package/vendor/native-preview/dist/enums/commentDirectiveType.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/commentDirectiveType.js +6 -0
- package/vendor/native-preview/dist/enums/commentDirectiveType.js.map +1 -0
- package/vendor/native-preview/dist/enums/completionItemKind.d.ts +2 -0
- package/vendor/native-preview/dist/enums/completionItemKind.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/completionItemKind.enum.d.ts +28 -0
- package/vendor/native-preview/dist/enums/completionItemKind.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/completionItemKind.enum.js +30 -0
- package/vendor/native-preview/dist/enums/completionItemKind.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/completionItemKind.js +30 -0
- package/vendor/native-preview/dist/enums/completionItemKind.js.map +1 -0
- package/vendor/native-preview/dist/enums/diagnosticCategory.d.ts +2 -0
- package/vendor/native-preview/dist/enums/diagnosticCategory.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/diagnosticCategory.enum.d.ts +7 -0
- package/vendor/native-preview/dist/enums/diagnosticCategory.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/diagnosticCategory.enum.js +9 -0
- package/vendor/native-preview/dist/enums/diagnosticCategory.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/diagnosticCategory.js +9 -0
- package/vendor/native-preview/dist/enums/diagnosticCategory.js.map +1 -0
- package/vendor/native-preview/dist/enums/elementFlags.d.ts +2 -0
- package/vendor/native-preview/dist/enums/elementFlags.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/elementFlags.enum.d.ts +12 -0
- package/vendor/native-preview/dist/enums/elementFlags.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/elementFlags.enum.js +14 -0
- package/vendor/native-preview/dist/enums/elementFlags.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/elementFlags.js +14 -0
- package/vendor/native-preview/dist/enums/elementFlags.js.map +1 -0
- package/vendor/native-preview/dist/enums/languageVariant.d.ts +2 -0
- package/vendor/native-preview/dist/enums/languageVariant.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/languageVariant.enum.d.ts +5 -0
- package/vendor/native-preview/dist/enums/languageVariant.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/languageVariant.enum.js +6 -0
- package/vendor/native-preview/dist/enums/languageVariant.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/languageVariant.js +6 -0
- package/vendor/native-preview/dist/enums/languageVariant.js.map +1 -0
- package/vendor/native-preview/dist/enums/modifierFlags.d.ts +2 -0
- package/vendor/native-preview/dist/enums/modifierFlags.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/modifierFlags.enum.d.ts +42 -0
- package/vendor/native-preview/dist/enums/modifierFlags.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/modifierFlags.enum.js +44 -0
- package/vendor/native-preview/dist/enums/modifierFlags.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/modifierFlags.js +44 -0
- package/vendor/native-preview/dist/enums/modifierFlags.js.map +1 -0
- package/vendor/native-preview/dist/enums/nodeBuilderFlags.d.ts +2 -0
- package/vendor/native-preview/dist/enums/nodeBuilderFlags.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/nodeBuilderFlags.enum.d.ts +36 -0
- package/vendor/native-preview/dist/enums/nodeBuilderFlags.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/nodeBuilderFlags.enum.js +38 -0
- package/vendor/native-preview/dist/enums/nodeBuilderFlags.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/nodeBuilderFlags.js +38 -0
- package/vendor/native-preview/dist/enums/nodeBuilderFlags.js.map +1 -0
- package/vendor/native-preview/dist/enums/nodeFlags.d.ts +2 -0
- package/vendor/native-preview/dist/enums/nodeFlags.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/nodeFlags.enum.d.ts +44 -0
- package/vendor/native-preview/dist/enums/nodeFlags.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/nodeFlags.enum.js +46 -0
- package/vendor/native-preview/dist/enums/nodeFlags.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/nodeFlags.js +46 -0
- package/vendor/native-preview/dist/enums/nodeFlags.js.map +1 -0
- package/vendor/native-preview/dist/enums/objectFlags.d.ts +2 -0
- package/vendor/native-preview/dist/enums/objectFlags.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/objectFlags.enum.d.ts +50 -0
- package/vendor/native-preview/dist/enums/objectFlags.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/objectFlags.enum.js +52 -0
- package/vendor/native-preview/dist/enums/objectFlags.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/objectFlags.js +52 -0
- package/vendor/native-preview/dist/enums/objectFlags.js.map +1 -0
- package/vendor/native-preview/dist/enums/outerExpressionKinds.d.ts +2 -0
- package/vendor/native-preview/dist/enums/outerExpressionKinds.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/outerExpressionKinds.enum.d.ts +16 -0
- package/vendor/native-preview/dist/enums/outerExpressionKinds.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/outerExpressionKinds.enum.js +18 -0
- package/vendor/native-preview/dist/enums/outerExpressionKinds.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/outerExpressionKinds.js +18 -0
- package/vendor/native-preview/dist/enums/outerExpressionKinds.js.map +1 -0
- package/vendor/native-preview/dist/enums/regularExpressionFlags.d.ts +2 -0
- package/vendor/native-preview/dist/enums/regularExpressionFlags.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/regularExpressionFlags.enum.d.ts +13 -0
- package/vendor/native-preview/dist/enums/regularExpressionFlags.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/regularExpressionFlags.enum.js +14 -0
- package/vendor/native-preview/dist/enums/regularExpressionFlags.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/regularExpressionFlags.js +14 -0
- package/vendor/native-preview/dist/enums/regularExpressionFlags.js.map +1 -0
- package/vendor/native-preview/dist/enums/scriptKind.d.ts +2 -0
- package/vendor/native-preview/dist/enums/scriptKind.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/scriptKind.enum.d.ts +11 -0
- package/vendor/native-preview/dist/enums/scriptKind.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/scriptKind.enum.js +12 -0
- package/vendor/native-preview/dist/enums/scriptKind.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/scriptKind.js +12 -0
- package/vendor/native-preview/dist/enums/scriptKind.js.map +1 -0
- package/vendor/native-preview/dist/enums/scriptTarget.d.ts +2 -0
- package/vendor/native-preview/dist/enums/scriptTarget.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/scriptTarget.enum.d.ts +17 -0
- package/vendor/native-preview/dist/enums/scriptTarget.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/scriptTarget.enum.js +18 -0
- package/vendor/native-preview/dist/enums/scriptTarget.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/scriptTarget.js +18 -0
- package/vendor/native-preview/dist/enums/scriptTarget.js.map +1 -0
- package/vendor/native-preview/dist/enums/signatureFlags.d.ts +2 -0
- package/vendor/native-preview/dist/enums/signatureFlags.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/signatureFlags.enum.d.ts +15 -0
- package/vendor/native-preview/dist/enums/signatureFlags.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/signatureFlags.enum.js +17 -0
- package/vendor/native-preview/dist/enums/signatureFlags.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/signatureFlags.js +17 -0
- package/vendor/native-preview/dist/enums/signatureFlags.js.map +1 -0
- package/vendor/native-preview/dist/enums/signatureKind.d.ts +2 -0
- package/vendor/native-preview/dist/enums/signatureKind.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/signatureKind.enum.d.ts +5 -0
- package/vendor/native-preview/dist/enums/signatureKind.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/signatureKind.enum.js +7 -0
- package/vendor/native-preview/dist/enums/signatureKind.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/signatureKind.js +7 -0
- package/vendor/native-preview/dist/enums/signatureKind.js.map +1 -0
- package/vendor/native-preview/dist/enums/symbolFlags.d.ts +2 -0
- package/vendor/native-preview/dist/enums/symbolFlags.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/symbolFlags.enum.d.ts +71 -0
- package/vendor/native-preview/dist/enums/symbolFlags.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/symbolFlags.enum.js +73 -0
- package/vendor/native-preview/dist/enums/symbolFlags.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/symbolFlags.js +73 -0
- package/vendor/native-preview/dist/enums/symbolFlags.js.map +1 -0
- package/vendor/native-preview/dist/enums/syntaxKind.d.ts +2 -0
- package/vendor/native-preview/dist/enums/syntaxKind.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/syntaxKind.enum.d.ts +389 -0
- package/vendor/native-preview/dist/enums/syntaxKind.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/syntaxKind.enum.js +391 -0
- package/vendor/native-preview/dist/enums/syntaxKind.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/syntaxKind.js +391 -0
- package/vendor/native-preview/dist/enums/syntaxKind.js.map +1 -0
- package/vendor/native-preview/dist/enums/tokenFlags.d.ts +2 -0
- package/vendor/native-preview/dist/enums/tokenFlags.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/tokenFlags.enum.d.ts +30 -0
- package/vendor/native-preview/dist/enums/tokenFlags.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/tokenFlags.enum.js +32 -0
- package/vendor/native-preview/dist/enums/tokenFlags.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/tokenFlags.js +32 -0
- package/vendor/native-preview/dist/enums/tokenFlags.js.map +1 -0
- package/vendor/native-preview/dist/enums/typeFlags.d.ts +2 -0
- package/vendor/native-preview/dist/enums/typeFlags.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/typeFlags.enum.d.ts +76 -0
- package/vendor/native-preview/dist/enums/typeFlags.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/typeFlags.enum.js +78 -0
- package/vendor/native-preview/dist/enums/typeFlags.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/typeFlags.js +78 -0
- package/vendor/native-preview/dist/enums/typeFlags.js.map +1 -0
- package/vendor/native-preview/dist/enums/typePredicateKind.d.ts +2 -0
- package/vendor/native-preview/dist/enums/typePredicateKind.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/typePredicateKind.enum.d.ts +7 -0
- package/vendor/native-preview/dist/enums/typePredicateKind.enum.d.ts.map +1 -0
- package/vendor/native-preview/dist/enums/typePredicateKind.enum.js +9 -0
- package/vendor/native-preview/dist/enums/typePredicateKind.enum.js.map +1 -0
- package/vendor/native-preview/dist/enums/typePredicateKind.js +9 -0
- package/vendor/native-preview/dist/enums/typePredicateKind.js.map +1 -0
- package/vendor/native-preview/lib/getExePath.d.ts +2 -0
- package/vendor/native-preview/lib/getExePath.js +70 -0
- package/vendor/native-preview/lib/tsgo.js +28 -0
- package/vendor/native-preview/lib/version.cjs +3 -0
- package/vendor/native-preview/lib/version.d.cts +2 -0
- package/vendor/native-preview/package.json +118 -0
- package/vendor/native-preview/tsconfig.tsbuildinfo +1 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/License.txt +11 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/README.md +54 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/browser/main.d.ts +17 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/browser/main.js +83 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/browser/ril.d.ts +22 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/browser/ril.js +210 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/api.d.ts +14 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/api.js +87 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/cancellation.d.ts +32 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/cancellation.js +132 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/connection.d.ts +367 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/connection.js +1271 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/disposable.d.ts +9 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/disposable.js +16 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/encoding.d.ts +52 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/encoding.js +70 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/events.d.ts +39 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/events.js +135 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/is.d.ts +7 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/is.js +34 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/linkedMap.d.ts +55 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/linkedMap.js +412 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messageBuffer.d.ts +18 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messageBuffer.js +155 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messageReader.d.ts +77 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messageReader.js +246 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messageWriter.d.ts +60 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messageWriter.js +157 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messages.d.ts +369 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/messages.js +436 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/ral.d.ts +74 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/ral.js +23 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/semaphore.d.ts +10 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/semaphore.js +74 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/sharedArrayCancellation.d.ts +15 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/common/sharedArrayCancellation.js +77 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/node/main.d.ts +58 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/node/main.js +289 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/node/ril.d.ts +12 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/lib/node/ril.js +163 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/package.json +54 -0
- package/vendor/native-preview/vendor/vscode-jsonrpc/typings/thenable.d.ts +5 -0
|
@@ -0,0 +1,2230 @@
|
|
|
1
|
+
import { CharacterCodes } from "#enums/characterCodes";
|
|
2
|
+
import { CommentDirectiveType } from "#enums/commentDirectiveType";
|
|
3
|
+
import { LanguageVariant } from "#enums/languageVariant";
|
|
4
|
+
import { RegularExpressionFlags } from "#enums/regularExpressionFlags";
|
|
5
|
+
import { ScriptTarget } from "#enums/scriptTarget";
|
|
6
|
+
import { SyntaxKind } from "#enums/syntaxKind";
|
|
7
|
+
import { TokenFlags } from "#enums/tokenFlags";
|
|
8
|
+
// Internal-only, not exported
|
|
9
|
+
const EscapeSequenceScanningFlags = {
|
|
10
|
+
String: 1 << 0,
|
|
11
|
+
ReportErrors: 1 << 1,
|
|
12
|
+
RegularExpression: 1 << 2,
|
|
13
|
+
AnnexB: 1 << 3,
|
|
14
|
+
AnyUnicodeMode: 1 << 4,
|
|
15
|
+
AtomEscape: 1 << 5,
|
|
16
|
+
ReportInvalidEscapeErrors: (1 << 2) | (1 << 1),
|
|
17
|
+
AllowExtendedUnicodeEscape: (1 << 0) | (1 << 4),
|
|
18
|
+
};
|
|
19
|
+
export function tokenIsIdentifierOrKeyword(token) {
|
|
20
|
+
return token >= SyntaxKind.Identifier;
|
|
21
|
+
}
|
|
22
|
+
export function tokenIsIdentifierOrKeywordOrGreaterThan(token) {
|
|
23
|
+
return token === SyntaxKind.GreaterThanToken || tokenIsIdentifierOrKeyword(token);
|
|
24
|
+
}
|
|
25
|
+
export const textToKeywordObj = {
|
|
26
|
+
abstract: SyntaxKind.AbstractKeyword,
|
|
27
|
+
accessor: SyntaxKind.AccessorKeyword,
|
|
28
|
+
any: SyntaxKind.AnyKeyword,
|
|
29
|
+
as: SyntaxKind.AsKeyword,
|
|
30
|
+
asserts: SyntaxKind.AssertsKeyword,
|
|
31
|
+
assert: SyntaxKind.AssertKeyword,
|
|
32
|
+
bigint: SyntaxKind.BigIntKeyword,
|
|
33
|
+
boolean: SyntaxKind.BooleanKeyword,
|
|
34
|
+
break: SyntaxKind.BreakKeyword,
|
|
35
|
+
case: SyntaxKind.CaseKeyword,
|
|
36
|
+
catch: SyntaxKind.CatchKeyword,
|
|
37
|
+
class: SyntaxKind.ClassKeyword,
|
|
38
|
+
continue: SyntaxKind.ContinueKeyword,
|
|
39
|
+
const: SyntaxKind.ConstKeyword,
|
|
40
|
+
["" + "constructor"]: SyntaxKind.ConstructorKeyword,
|
|
41
|
+
debugger: SyntaxKind.DebuggerKeyword,
|
|
42
|
+
declare: SyntaxKind.DeclareKeyword,
|
|
43
|
+
default: SyntaxKind.DefaultKeyword,
|
|
44
|
+
defer: SyntaxKind.DeferKeyword,
|
|
45
|
+
delete: SyntaxKind.DeleteKeyword,
|
|
46
|
+
do: SyntaxKind.DoKeyword,
|
|
47
|
+
else: SyntaxKind.ElseKeyword,
|
|
48
|
+
enum: SyntaxKind.EnumKeyword,
|
|
49
|
+
export: SyntaxKind.ExportKeyword,
|
|
50
|
+
extends: SyntaxKind.ExtendsKeyword,
|
|
51
|
+
false: SyntaxKind.FalseKeyword,
|
|
52
|
+
finally: SyntaxKind.FinallyKeyword,
|
|
53
|
+
for: SyntaxKind.ForKeyword,
|
|
54
|
+
from: SyntaxKind.FromKeyword,
|
|
55
|
+
function: SyntaxKind.FunctionKeyword,
|
|
56
|
+
get: SyntaxKind.GetKeyword,
|
|
57
|
+
if: SyntaxKind.IfKeyword,
|
|
58
|
+
implements: SyntaxKind.ImplementsKeyword,
|
|
59
|
+
import: SyntaxKind.ImportKeyword,
|
|
60
|
+
in: SyntaxKind.InKeyword,
|
|
61
|
+
infer: SyntaxKind.InferKeyword,
|
|
62
|
+
instanceof: SyntaxKind.InstanceOfKeyword,
|
|
63
|
+
interface: SyntaxKind.InterfaceKeyword,
|
|
64
|
+
intrinsic: SyntaxKind.IntrinsicKeyword,
|
|
65
|
+
is: SyntaxKind.IsKeyword,
|
|
66
|
+
keyof: SyntaxKind.KeyOfKeyword,
|
|
67
|
+
let: SyntaxKind.LetKeyword,
|
|
68
|
+
module: SyntaxKind.ModuleKeyword,
|
|
69
|
+
namespace: SyntaxKind.NamespaceKeyword,
|
|
70
|
+
never: SyntaxKind.NeverKeyword,
|
|
71
|
+
new: SyntaxKind.NewKeyword,
|
|
72
|
+
null: SyntaxKind.NullKeyword,
|
|
73
|
+
number: SyntaxKind.NumberKeyword,
|
|
74
|
+
object: SyntaxKind.ObjectKeyword,
|
|
75
|
+
package: SyntaxKind.PackageKeyword,
|
|
76
|
+
private: SyntaxKind.PrivateKeyword,
|
|
77
|
+
protected: SyntaxKind.ProtectedKeyword,
|
|
78
|
+
public: SyntaxKind.PublicKeyword,
|
|
79
|
+
override: SyntaxKind.OverrideKeyword,
|
|
80
|
+
out: SyntaxKind.OutKeyword,
|
|
81
|
+
readonly: SyntaxKind.ReadonlyKeyword,
|
|
82
|
+
require: SyntaxKind.RequireKeyword,
|
|
83
|
+
global: SyntaxKind.GlobalKeyword,
|
|
84
|
+
return: SyntaxKind.ReturnKeyword,
|
|
85
|
+
satisfies: SyntaxKind.SatisfiesKeyword,
|
|
86
|
+
set: SyntaxKind.SetKeyword,
|
|
87
|
+
static: SyntaxKind.StaticKeyword,
|
|
88
|
+
string: SyntaxKind.StringKeyword,
|
|
89
|
+
super: SyntaxKind.SuperKeyword,
|
|
90
|
+
switch: SyntaxKind.SwitchKeyword,
|
|
91
|
+
symbol: SyntaxKind.SymbolKeyword,
|
|
92
|
+
this: SyntaxKind.ThisKeyword,
|
|
93
|
+
throw: SyntaxKind.ThrowKeyword,
|
|
94
|
+
true: SyntaxKind.TrueKeyword,
|
|
95
|
+
try: SyntaxKind.TryKeyword,
|
|
96
|
+
type: SyntaxKind.TypeKeyword,
|
|
97
|
+
typeof: SyntaxKind.TypeOfKeyword,
|
|
98
|
+
undefined: SyntaxKind.UndefinedKeyword,
|
|
99
|
+
unique: SyntaxKind.UniqueKeyword,
|
|
100
|
+
unknown: SyntaxKind.UnknownKeyword,
|
|
101
|
+
using: SyntaxKind.UsingKeyword,
|
|
102
|
+
var: SyntaxKind.VarKeyword,
|
|
103
|
+
void: SyntaxKind.VoidKeyword,
|
|
104
|
+
while: SyntaxKind.WhileKeyword,
|
|
105
|
+
with: SyntaxKind.WithKeyword,
|
|
106
|
+
yield: SyntaxKind.YieldKeyword,
|
|
107
|
+
async: SyntaxKind.AsyncKeyword,
|
|
108
|
+
await: SyntaxKind.AwaitKeyword,
|
|
109
|
+
of: SyntaxKind.OfKeyword,
|
|
110
|
+
};
|
|
111
|
+
const textToKeyword = new Map(Object.entries(textToKeywordObj));
|
|
112
|
+
const textToToken = new Map(Object.entries({
|
|
113
|
+
...textToKeywordObj,
|
|
114
|
+
"{": SyntaxKind.OpenBraceToken,
|
|
115
|
+
"}": SyntaxKind.CloseBraceToken,
|
|
116
|
+
"(": SyntaxKind.OpenParenToken,
|
|
117
|
+
")": SyntaxKind.CloseParenToken,
|
|
118
|
+
"[": SyntaxKind.OpenBracketToken,
|
|
119
|
+
"]": SyntaxKind.CloseBracketToken,
|
|
120
|
+
".": SyntaxKind.DotToken,
|
|
121
|
+
"...": SyntaxKind.DotDotDotToken,
|
|
122
|
+
";": SyntaxKind.SemicolonToken,
|
|
123
|
+
",": SyntaxKind.CommaToken,
|
|
124
|
+
"<": SyntaxKind.LessThanToken,
|
|
125
|
+
">": SyntaxKind.GreaterThanToken,
|
|
126
|
+
"<=": SyntaxKind.LessThanEqualsToken,
|
|
127
|
+
">=": SyntaxKind.GreaterThanEqualsToken,
|
|
128
|
+
"==": SyntaxKind.EqualsEqualsToken,
|
|
129
|
+
"!=": SyntaxKind.ExclamationEqualsToken,
|
|
130
|
+
"===": SyntaxKind.EqualsEqualsEqualsToken,
|
|
131
|
+
"!==": SyntaxKind.ExclamationEqualsEqualsToken,
|
|
132
|
+
"=>": SyntaxKind.EqualsGreaterThanToken,
|
|
133
|
+
"+": SyntaxKind.PlusToken,
|
|
134
|
+
"-": SyntaxKind.MinusToken,
|
|
135
|
+
"**": SyntaxKind.AsteriskAsteriskToken,
|
|
136
|
+
"*": SyntaxKind.AsteriskToken,
|
|
137
|
+
"/": SyntaxKind.SlashToken,
|
|
138
|
+
"%": SyntaxKind.PercentToken,
|
|
139
|
+
"++": SyntaxKind.PlusPlusToken,
|
|
140
|
+
"--": SyntaxKind.MinusMinusToken,
|
|
141
|
+
"<<": SyntaxKind.LessThanLessThanToken,
|
|
142
|
+
"</": SyntaxKind.LessThanSlashToken,
|
|
143
|
+
">>": SyntaxKind.GreaterThanGreaterThanToken,
|
|
144
|
+
">>>": SyntaxKind.GreaterThanGreaterThanGreaterThanToken,
|
|
145
|
+
"&": SyntaxKind.AmpersandToken,
|
|
146
|
+
"|": SyntaxKind.BarToken,
|
|
147
|
+
"^": SyntaxKind.CaretToken,
|
|
148
|
+
"!": SyntaxKind.ExclamationToken,
|
|
149
|
+
"~": SyntaxKind.TildeToken,
|
|
150
|
+
"&&": SyntaxKind.AmpersandAmpersandToken,
|
|
151
|
+
"||": SyntaxKind.BarBarToken,
|
|
152
|
+
"?": SyntaxKind.QuestionToken,
|
|
153
|
+
"??": SyntaxKind.QuestionQuestionToken,
|
|
154
|
+
"?.": SyntaxKind.QuestionDotToken,
|
|
155
|
+
":": SyntaxKind.ColonToken,
|
|
156
|
+
"=": SyntaxKind.EqualsToken,
|
|
157
|
+
"+=": SyntaxKind.PlusEqualsToken,
|
|
158
|
+
"-=": SyntaxKind.MinusEqualsToken,
|
|
159
|
+
"*=": SyntaxKind.AsteriskEqualsToken,
|
|
160
|
+
"**=": SyntaxKind.AsteriskAsteriskEqualsToken,
|
|
161
|
+
"/=": SyntaxKind.SlashEqualsToken,
|
|
162
|
+
"%=": SyntaxKind.PercentEqualsToken,
|
|
163
|
+
"<<=": SyntaxKind.LessThanLessThanEqualsToken,
|
|
164
|
+
">>=": SyntaxKind.GreaterThanGreaterThanEqualsToken,
|
|
165
|
+
">>>=": SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken,
|
|
166
|
+
"&=": SyntaxKind.AmpersandEqualsToken,
|
|
167
|
+
"|=": SyntaxKind.BarEqualsToken,
|
|
168
|
+
"^=": SyntaxKind.CaretEqualsToken,
|
|
169
|
+
"||=": SyntaxKind.BarBarEqualsToken,
|
|
170
|
+
"&&=": SyntaxKind.AmpersandAmpersandEqualsToken,
|
|
171
|
+
"??=": SyntaxKind.QuestionQuestionEqualsToken,
|
|
172
|
+
"@": SyntaxKind.AtToken,
|
|
173
|
+
"#": SyntaxKind.HashToken,
|
|
174
|
+
"`": SyntaxKind.BacktickToken,
|
|
175
|
+
}));
|
|
176
|
+
const charCodeToRegExpFlag = new Map([
|
|
177
|
+
[CharacterCodes.d, RegularExpressionFlags.HasIndices],
|
|
178
|
+
[CharacterCodes.g, RegularExpressionFlags.Global],
|
|
179
|
+
[CharacterCodes.i, RegularExpressionFlags.IgnoreCase],
|
|
180
|
+
[CharacterCodes.m, RegularExpressionFlags.Multiline],
|
|
181
|
+
[CharacterCodes.s, RegularExpressionFlags.DotAll],
|
|
182
|
+
[CharacterCodes.u, RegularExpressionFlags.Unicode],
|
|
183
|
+
[CharacterCodes.v, RegularExpressionFlags.UnicodeSets],
|
|
184
|
+
[CharacterCodes.y, RegularExpressionFlags.Sticky],
|
|
185
|
+
]);
|
|
186
|
+
/**
|
|
187
|
+
* Generated by scripts/regenerate-unicode-identifier-parts.mjs on node v22.1.0 with unicode 15.1
|
|
188
|
+
* based on http://www.unicode.org/reports/tr31/ and https://www.ecma-international.org/ecma-262/6.0/#sec-names-and-keywords
|
|
189
|
+
* unicodeESNextIdentifierStart corresponds to the ID_Start and Other_ID_Start property, and
|
|
190
|
+
* unicodeESNextIdentifierPart corresponds to ID_Continue, Other_ID_Continue, plus ID_Start and Other_ID_Start
|
|
191
|
+
*/
|
|
192
|
+
// dprint-ignore
|
|
193
|
+
const unicodeESNextIdentifierStart = [65, 90, 97, 122, 170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 895, 895, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1488, 1514, 1519, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2144, 2154, 2160, 2183, 2185, 2190, 2208, 2249, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2432, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2556, 2556, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2809, 2809, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3133, 3133, 3160, 3162, 3165, 3165, 3168, 3169, 3200, 3200, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3293, 3294, 3296, 3297, 3313, 3314, 3332, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3412, 3414, 3423, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5905, 5919, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6264, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6430, 6480, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6988, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7401, 7404, 7406, 7411, 7413, 7414, 7418, 7418, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12443, 12447, 12449, 12538, 12540, 12543, 12549, 12591, 12593, 12686, 12704, 12735, 12784, 12799, 13312, 19903, 19968, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42653, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42954, 42960, 42961, 42963, 42963, 42965, 42969, 42994, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43261, 43262, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43488, 43492, 43494, 43503, 43514, 43518, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43646, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43881, 43888, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66176, 66204, 66208, 66256, 66304, 66335, 66349, 66378, 66384, 66421, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 66928, 66938, 66940, 66954, 66956, 66962, 66964, 66965, 66967, 66977, 66979, 66993, 66995, 67001, 67003, 67004, 67072, 67382, 67392, 67413, 67424, 67431, 67456, 67461, 67463, 67504, 67506, 67514, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68096, 68112, 68115, 68117, 68119, 68121, 68149, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68324, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68899, 69248, 69289, 69296, 69297, 69376, 69404, 69415, 69415, 69424, 69445, 69488, 69505, 69552, 69572, 69600, 69622, 69635, 69687, 69745, 69746, 69749, 69749, 69763, 69807, 69840, 69864, 69891, 69926, 69956, 69956, 69959, 69959, 69968, 70002, 70006, 70006, 70019, 70066, 70081, 70084, 70106, 70106, 70108, 70108, 70144, 70161, 70163, 70187, 70207, 70208, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70366, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70461, 70461, 70480, 70480, 70493, 70497, 70656, 70708, 70727, 70730, 70751, 70753, 70784, 70831, 70852, 70853, 70855, 70855, 71040, 71086, 71128, 71131, 71168, 71215, 71236, 71236, 71296, 71338, 71352, 71352, 71424, 71450, 71488, 71494, 71680, 71723, 71840, 71903, 71935, 71942, 71945, 71945, 71948, 71955, 71957, 71958, 71960, 71983, 71999, 71999, 72001, 72001, 72096, 72103, 72106, 72144, 72161, 72161, 72163, 72163, 72192, 72192, 72203, 72242, 72250, 72250, 72272, 72272, 72284, 72329, 72349, 72349, 72368, 72440, 72704, 72712, 72714, 72750, 72768, 72768, 72818, 72847, 72960, 72966, 72968, 72969, 72971, 73008, 73030, 73030, 73056, 73061, 73063, 73064, 73066, 73097, 73112, 73112, 73440, 73458, 73474, 73474, 73476, 73488, 73490, 73523, 73648, 73648, 73728, 74649, 74752, 74862, 74880, 75075, 77712, 77808, 77824, 78895, 78913, 78918, 82944, 83526, 92160, 92728, 92736, 92766, 92784, 92862, 92880, 92909, 92928, 92975, 92992, 92995, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94032, 94032, 94099, 94111, 94176, 94177, 94179, 94179, 94208, 100343, 100352, 101589, 101632, 101640, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 122624, 122654, 122661, 122666, 122928, 122989, 123136, 123180, 123191, 123197, 123214, 123214, 123536, 123565, 123584, 123627, 124112, 124139, 124896, 124902, 124904, 124907, 124909, 124910, 124912, 124926, 124928, 125124, 125184, 125251, 125259, 125259, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 131072, 173791, 173824, 177977, 177984, 178205, 178208, 183969, 183984, 191456, 191472, 192093, 194560, 195101, 196608, 201546, 201552, 205743];
|
|
194
|
+
// dprint-ignore
|
|
195
|
+
const unicodeESNextIdentifierPart = [48, 57, 65, 90, 95, 95, 97, 122, 170, 170, 181, 181, 183, 183, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 895, 895, 902, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1327, 1329, 1366, 1369, 1369, 1376, 1416, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1519, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2045, 2045, 2048, 2093, 2112, 2139, 2144, 2154, 2160, 2183, 2185, 2190, 2200, 2273, 2275, 2403, 2406, 2415, 2417, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2556, 2556, 2558, 2558, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2809, 2815, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2901, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3072, 3084, 3086, 3088, 3090, 3112, 3114, 3129, 3132, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3162, 3165, 3165, 3168, 3171, 3174, 3183, 3200, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3293, 3294, 3296, 3299, 3302, 3311, 3313, 3315, 3328, 3340, 3342, 3344, 3346, 3396, 3398, 3400, 3402, 3406, 3412, 3415, 3423, 3427, 3430, 3439, 3450, 3455, 3457, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3558, 3567, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3718, 3722, 3724, 3747, 3749, 3749, 3751, 3773, 3776, 3780, 3782, 3782, 3784, 3790, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4969, 4977, 4992, 5007, 5024, 5109, 5112, 5117, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5880, 5888, 5909, 5919, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6159, 6169, 6176, 6264, 6272, 6314, 6320, 6389, 6400, 6430, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6618, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6832, 6845, 6847, 6862, 6912, 6988, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7296, 7304, 7312, 7354, 7357, 7359, 7376, 7378, 7380, 7418, 7424, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8472, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12447, 12449, 12543, 12549, 12591, 12593, 12686, 12704, 12735, 12784, 12799, 13312, 19903, 19968, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42737, 42775, 42783, 42786, 42888, 42891, 42954, 42960, 42961, 42963, 42963, 42965, 42969, 42994, 43047, 43052, 43052, 43072, 43123, 43136, 43205, 43216, 43225, 43232, 43255, 43259, 43259, 43261, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43488, 43518, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43824, 43866, 43868, 43881, 43888, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65071, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65536, 65547, 65549, 65574, 65576, 65594, 65596, 65597, 65599, 65613, 65616, 65629, 65664, 65786, 65856, 65908, 66045, 66045, 66176, 66204, 66208, 66256, 66272, 66272, 66304, 66335, 66349, 66378, 66384, 66426, 66432, 66461, 66464, 66499, 66504, 66511, 66513, 66517, 66560, 66717, 66720, 66729, 66736, 66771, 66776, 66811, 66816, 66855, 66864, 66915, 66928, 66938, 66940, 66954, 66956, 66962, 66964, 66965, 66967, 66977, 66979, 66993, 66995, 67001, 67003, 67004, 67072, 67382, 67392, 67413, 67424, 67431, 67456, 67461, 67463, 67504, 67506, 67514, 67584, 67589, 67592, 67592, 67594, 67637, 67639, 67640, 67644, 67644, 67647, 67669, 67680, 67702, 67712, 67742, 67808, 67826, 67828, 67829, 67840, 67861, 67872, 67897, 67968, 68023, 68030, 68031, 68096, 68099, 68101, 68102, 68108, 68115, 68117, 68119, 68121, 68149, 68152, 68154, 68159, 68159, 68192, 68220, 68224, 68252, 68288, 68295, 68297, 68326, 68352, 68405, 68416, 68437, 68448, 68466, 68480, 68497, 68608, 68680, 68736, 68786, 68800, 68850, 68864, 68903, 68912, 68921, 69248, 69289, 69291, 69292, 69296, 69297, 69373, 69404, 69415, 69415, 69424, 69456, 69488, 69509, 69552, 69572, 69600, 69622, 69632, 69702, 69734, 69749, 69759, 69818, 69826, 69826, 69840, 69864, 69872, 69881, 69888, 69940, 69942, 69951, 69956, 69959, 69968, 70003, 70006, 70006, 70016, 70084, 70089, 70092, 70094, 70106, 70108, 70108, 70144, 70161, 70163, 70199, 70206, 70209, 70272, 70278, 70280, 70280, 70282, 70285, 70287, 70301, 70303, 70312, 70320, 70378, 70384, 70393, 70400, 70403, 70405, 70412, 70415, 70416, 70419, 70440, 70442, 70448, 70450, 70451, 70453, 70457, 70459, 70468, 70471, 70472, 70475, 70477, 70480, 70480, 70487, 70487, 70493, 70499, 70502, 70508, 70512, 70516, 70656, 70730, 70736, 70745, 70750, 70753, 70784, 70853, 70855, 70855, 70864, 70873, 71040, 71093, 71096, 71104, 71128, 71133, 71168, 71232, 71236, 71236, 71248, 71257, 71296, 71352, 71360, 71369, 71424, 71450, 71453, 71467, 71472, 71481, 71488, 71494, 71680, 71738, 71840, 71913, 71935, 71942, 71945, 71945, 71948, 71955, 71957, 71958, 71960, 71989, 71991, 71992, 71995, 72003, 72016, 72025, 72096, 72103, 72106, 72151, 72154, 72161, 72163, 72164, 72192, 72254, 72263, 72263, 72272, 72345, 72349, 72349, 72368, 72440, 72704, 72712, 72714, 72758, 72760, 72768, 72784, 72793, 72818, 72847, 72850, 72871, 72873, 72886, 72960, 72966, 72968, 72969, 72971, 73014, 73018, 73018, 73020, 73021, 73023, 73031, 73040, 73049, 73056, 73061, 73063, 73064, 73066, 73102, 73104, 73105, 73107, 73112, 73120, 73129, 73440, 73462, 73472, 73488, 73490, 73530, 73534, 73538, 73552, 73561, 73648, 73648, 73728, 74649, 74752, 74862, 74880, 75075, 77712, 77808, 77824, 78895, 78912, 78933, 82944, 83526, 92160, 92728, 92736, 92766, 92768, 92777, 92784, 92862, 92864, 92873, 92880, 92909, 92912, 92916, 92928, 92982, 92992, 92995, 93008, 93017, 93027, 93047, 93053, 93071, 93760, 93823, 93952, 94026, 94031, 94087, 94095, 94111, 94176, 94177, 94179, 94180, 94192, 94193, 94208, 100343, 100352, 101589, 101632, 101640, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 113664, 113770, 113776, 113788, 113792, 113800, 113808, 113817, 113821, 113822, 118528, 118573, 118576, 118598, 119141, 119145, 119149, 119154, 119163, 119170, 119173, 119179, 119210, 119213, 119362, 119364, 119808, 119892, 119894, 119964, 119966, 119967, 119970, 119970, 119973, 119974, 119977, 119980, 119982, 119993, 119995, 119995, 119997, 120003, 120005, 120069, 120071, 120074, 120077, 120084, 120086, 120092, 120094, 120121, 120123, 120126, 120128, 120132, 120134, 120134, 120138, 120144, 120146, 120485, 120488, 120512, 120514, 120538, 120540, 120570, 120572, 120596, 120598, 120628, 120630, 120654, 120656, 120686, 120688, 120712, 120714, 120744, 120746, 120770, 120772, 120779, 120782, 120831, 121344, 121398, 121403, 121452, 121461, 121461, 121476, 121476, 121499, 121503, 121505, 121519, 122624, 122654, 122661, 122666, 122880, 122886, 122888, 122904, 122907, 122913, 122915, 122916, 122918, 122922, 122928, 122989, 123023, 123023, 123136, 123180, 123184, 123197, 123200, 123209, 123214, 123214, 123536, 123566, 123584, 123641, 124112, 124153, 124896, 124902, 124904, 124907, 124909, 124910, 124912, 124926, 124928, 125124, 125136, 125142, 125184, 125259, 125264, 125273, 126464, 126467, 126469, 126495, 126497, 126498, 126500, 126500, 126503, 126503, 126505, 126514, 126516, 126519, 126521, 126521, 126523, 126523, 126530, 126530, 126535, 126535, 126537, 126537, 126539, 126539, 126541, 126543, 126545, 126546, 126548, 126548, 126551, 126551, 126553, 126553, 126555, 126555, 126557, 126557, 126559, 126559, 126561, 126562, 126564, 126564, 126567, 126570, 126572, 126578, 126580, 126583, 126585, 126588, 126590, 126590, 126592, 126601, 126603, 126619, 126625, 126627, 126629, 126633, 126635, 126651, 130032, 130041, 131072, 173791, 173824, 177977, 177984, 178205, 178208, 183969, 183984, 191456, 191472, 192093, 194560, 195101, 196608, 201546, 201552, 205743, 917760, 917999];
|
|
196
|
+
const commentDirectiveRegExSingleLine = /^\/\/\/?\s*@(ts-expect-error|ts-ignore)/;
|
|
197
|
+
const commentDirectiveRegExMultiLine = /^(?:\/|\*)*\s*@(ts-expect-error|ts-ignore)/;
|
|
198
|
+
const jsDocTagTerminators = new Set([" ", "\t", "\n", "\r", "}", "*"]);
|
|
199
|
+
function hasJSDocTag(text, offset, ...tags) {
|
|
200
|
+
for (const tag of tags) {
|
|
201
|
+
if (text.startsWith(tag, offset)) {
|
|
202
|
+
if (offset + tag.length === text.length) {
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
if (jsDocTagTerminators.has(text[offset + tag.length])) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
function scanJSDocCommentForTags(text, tokenFlags) {
|
|
213
|
+
let offset = 0;
|
|
214
|
+
while (true) {
|
|
215
|
+
const i = text.indexOf("@", offset);
|
|
216
|
+
if (i < 0) {
|
|
217
|
+
return tokenFlags;
|
|
218
|
+
}
|
|
219
|
+
offset = i + 1;
|
|
220
|
+
if (!(tokenFlags & TokenFlags.PrecedingJSDocWithDeprecated) && hasJSDocTag(text, offset, "deprecated")) {
|
|
221
|
+
tokenFlags |= TokenFlags.PrecedingJSDocWithDeprecated;
|
|
222
|
+
}
|
|
223
|
+
if (!(tokenFlags & TokenFlags.PrecedingJSDocWithSeeOrLink) && hasJSDocTag(text, offset, "see", "link", "linkcode", "linkplain")) {
|
|
224
|
+
tokenFlags |= TokenFlags.PrecedingJSDocWithSeeOrLink;
|
|
225
|
+
}
|
|
226
|
+
if ((tokenFlags & (TokenFlags.PrecedingJSDocWithDeprecated | TokenFlags.PrecedingJSDocWithSeeOrLink)) ===
|
|
227
|
+
(TokenFlags.PrecedingJSDocWithDeprecated | TokenFlags.PrecedingJSDocWithSeeOrLink)) {
|
|
228
|
+
return tokenFlags;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function lookupInUnicodeMap(code, map) {
|
|
233
|
+
if (code < map[0]) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
let lo = 0;
|
|
237
|
+
let hi = map.length;
|
|
238
|
+
let mid;
|
|
239
|
+
while (lo + 1 < hi) {
|
|
240
|
+
mid = lo + (hi - lo) / 2;
|
|
241
|
+
mid -= mid % 2;
|
|
242
|
+
if (map[mid] <= code && code <= map[mid + 1]) {
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
if (code < map[mid]) {
|
|
246
|
+
hi = mid;
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
lo = mid + 2;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
export function isUnicodeIdentifierStart(code) {
|
|
255
|
+
return lookupInUnicodeMap(code, unicodeESNextIdentifierStart);
|
|
256
|
+
}
|
|
257
|
+
function isUnicodeIdentifierPart(code) {
|
|
258
|
+
return lookupInUnicodeMap(code, unicodeESNextIdentifierPart);
|
|
259
|
+
}
|
|
260
|
+
function makeReverseMap(source) {
|
|
261
|
+
const result = [];
|
|
262
|
+
source.forEach((value, name) => {
|
|
263
|
+
result[value] = name;
|
|
264
|
+
});
|
|
265
|
+
return result;
|
|
266
|
+
}
|
|
267
|
+
const tokenStrings = makeReverseMap(textToToken);
|
|
268
|
+
export function tokenToString(t) {
|
|
269
|
+
return tokenStrings[t];
|
|
270
|
+
}
|
|
271
|
+
export function stringToToken(s) {
|
|
272
|
+
return textToToken.get(s);
|
|
273
|
+
}
|
|
274
|
+
export function characterCodeToRegularExpressionFlag(ch) {
|
|
275
|
+
return charCodeToRegExpFlag.get(ch);
|
|
276
|
+
}
|
|
277
|
+
export function computeLineStarts(text) {
|
|
278
|
+
const result = [];
|
|
279
|
+
let pos = 0;
|
|
280
|
+
let lineStart = 0;
|
|
281
|
+
while (pos < text.length) {
|
|
282
|
+
const ch = text.charCodeAt(pos);
|
|
283
|
+
pos++;
|
|
284
|
+
switch (ch) {
|
|
285
|
+
case CharacterCodes.carriageReturn:
|
|
286
|
+
if (text.charCodeAt(pos) === CharacterCodes.lineFeed) {
|
|
287
|
+
pos++;
|
|
288
|
+
}
|
|
289
|
+
// falls through
|
|
290
|
+
case CharacterCodes.lineFeed:
|
|
291
|
+
result.push(lineStart);
|
|
292
|
+
lineStart = pos;
|
|
293
|
+
break;
|
|
294
|
+
default:
|
|
295
|
+
if (ch > CharacterCodes.maxAsciiCharacter && isLineBreak(ch)) {
|
|
296
|
+
result.push(lineStart);
|
|
297
|
+
lineStart = pos;
|
|
298
|
+
}
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
result.push(lineStart);
|
|
303
|
+
return result;
|
|
304
|
+
}
|
|
305
|
+
export function isWhiteSpaceLike(ch) {
|
|
306
|
+
return isWhiteSpaceSingleLine(ch) || isLineBreak(ch);
|
|
307
|
+
}
|
|
308
|
+
export function isWhiteSpaceSingleLine(ch) {
|
|
309
|
+
return ch === CharacterCodes.space ||
|
|
310
|
+
ch === CharacterCodes.tab ||
|
|
311
|
+
ch === CharacterCodes.verticalTab ||
|
|
312
|
+
ch === CharacterCodes.formFeed ||
|
|
313
|
+
ch === CharacterCodes.nonBreakingSpace ||
|
|
314
|
+
ch === CharacterCodes.nextLine ||
|
|
315
|
+
ch === CharacterCodes.ogham ||
|
|
316
|
+
ch >= CharacterCodes.enQuad && ch <= CharacterCodes.zeroWidthSpace ||
|
|
317
|
+
ch === CharacterCodes.narrowNoBreakSpace ||
|
|
318
|
+
ch === CharacterCodes.mathematicalSpace ||
|
|
319
|
+
ch === CharacterCodes.ideographicSpace ||
|
|
320
|
+
ch === CharacterCodes.byteOrderMark;
|
|
321
|
+
}
|
|
322
|
+
export function isLineBreak(ch) {
|
|
323
|
+
return ch === CharacterCodes.lineFeed ||
|
|
324
|
+
ch === CharacterCodes.carriageReturn ||
|
|
325
|
+
ch === CharacterCodes.lineSeparator ||
|
|
326
|
+
ch === CharacterCodes.paragraphSeparator;
|
|
327
|
+
}
|
|
328
|
+
function isDigit(ch) {
|
|
329
|
+
return ch >= CharacterCodes._0 && ch <= CharacterCodes._9;
|
|
330
|
+
}
|
|
331
|
+
function isHexDigit(ch) {
|
|
332
|
+
return isDigit(ch) || ch >= CharacterCodes.A && ch <= CharacterCodes.F || ch >= CharacterCodes.a && ch <= CharacterCodes.f;
|
|
333
|
+
}
|
|
334
|
+
function isOctalDigit(ch) {
|
|
335
|
+
return ch >= CharacterCodes._0 && ch <= CharacterCodes._7;
|
|
336
|
+
}
|
|
337
|
+
export function couldStartTrivia(text, pos) {
|
|
338
|
+
const ch = text.charCodeAt(pos);
|
|
339
|
+
switch (ch) {
|
|
340
|
+
case CharacterCodes.carriageReturn:
|
|
341
|
+
case CharacterCodes.lineFeed:
|
|
342
|
+
case CharacterCodes.tab:
|
|
343
|
+
case CharacterCodes.verticalTab:
|
|
344
|
+
case CharacterCodes.formFeed:
|
|
345
|
+
case CharacterCodes.space:
|
|
346
|
+
case CharacterCodes.slash:
|
|
347
|
+
case CharacterCodes.lessThan:
|
|
348
|
+
case CharacterCodes.bar:
|
|
349
|
+
case CharacterCodes.equals:
|
|
350
|
+
case CharacterCodes.greaterThan:
|
|
351
|
+
return true;
|
|
352
|
+
case CharacterCodes.hash:
|
|
353
|
+
return pos === 0;
|
|
354
|
+
default:
|
|
355
|
+
return ch > CharacterCodes.maxAsciiCharacter;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
export function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments, inJSDoc) {
|
|
359
|
+
if (pos < 0) {
|
|
360
|
+
return pos;
|
|
361
|
+
}
|
|
362
|
+
let canConsumeStar = false;
|
|
363
|
+
while (true) {
|
|
364
|
+
const ch = text.charCodeAt(pos);
|
|
365
|
+
switch (ch) {
|
|
366
|
+
case CharacterCodes.carriageReturn:
|
|
367
|
+
if (text.charCodeAt(pos + 1) === CharacterCodes.lineFeed) {
|
|
368
|
+
pos++;
|
|
369
|
+
}
|
|
370
|
+
// falls through
|
|
371
|
+
case CharacterCodes.lineFeed:
|
|
372
|
+
pos++;
|
|
373
|
+
if (stopAfterLineBreak) {
|
|
374
|
+
return pos;
|
|
375
|
+
}
|
|
376
|
+
canConsumeStar = !!inJSDoc;
|
|
377
|
+
continue;
|
|
378
|
+
case CharacterCodes.tab:
|
|
379
|
+
case CharacterCodes.verticalTab:
|
|
380
|
+
case CharacterCodes.formFeed:
|
|
381
|
+
case CharacterCodes.space:
|
|
382
|
+
pos++;
|
|
383
|
+
continue;
|
|
384
|
+
case CharacterCodes.slash:
|
|
385
|
+
if (stopAtComments) {
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
if (text.charCodeAt(pos + 1) === CharacterCodes.slash) {
|
|
389
|
+
pos += 2;
|
|
390
|
+
while (pos < text.length) {
|
|
391
|
+
if (isLineBreak(text.charCodeAt(pos))) {
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
pos++;
|
|
395
|
+
}
|
|
396
|
+
canConsumeStar = false;
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
if (text.charCodeAt(pos + 1) === CharacterCodes.asterisk) {
|
|
400
|
+
pos += 2;
|
|
401
|
+
while (pos < text.length) {
|
|
402
|
+
if (text.charCodeAt(pos) === CharacterCodes.asterisk && text.charCodeAt(pos + 1) === CharacterCodes.slash) {
|
|
403
|
+
pos += 2;
|
|
404
|
+
break;
|
|
405
|
+
}
|
|
406
|
+
pos++;
|
|
407
|
+
}
|
|
408
|
+
canConsumeStar = false;
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
break;
|
|
412
|
+
case CharacterCodes.lessThan:
|
|
413
|
+
case CharacterCodes.bar:
|
|
414
|
+
case CharacterCodes.equals:
|
|
415
|
+
case CharacterCodes.greaterThan:
|
|
416
|
+
if (isConflictMarkerTrivia(text, pos)) {
|
|
417
|
+
pos = scanConflictMarkerTrivia(text, pos);
|
|
418
|
+
canConsumeStar = false;
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
421
|
+
break;
|
|
422
|
+
case CharacterCodes.hash:
|
|
423
|
+
if (pos === 0 && isShebangTrivia(text, pos)) {
|
|
424
|
+
pos = scanShebangTrivia(text, pos);
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
break;
|
|
428
|
+
case CharacterCodes.asterisk:
|
|
429
|
+
if (canConsumeStar) {
|
|
430
|
+
pos++;
|
|
431
|
+
canConsumeStar = false;
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
break;
|
|
435
|
+
default:
|
|
436
|
+
if (ch > CharacterCodes.maxAsciiCharacter && (isWhiteSpaceLike(ch))) {
|
|
437
|
+
pos++;
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
return pos;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
function isConflictMarkerTrivia(text, pos) {
|
|
446
|
+
if (pos >= text.length) {
|
|
447
|
+
return false;
|
|
448
|
+
}
|
|
449
|
+
const ch = text.charCodeAt(pos);
|
|
450
|
+
if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) {
|
|
451
|
+
if (ch === CharacterCodes.lessThan || ch === CharacterCodes.greaterThan || ch === CharacterCodes.equals) {
|
|
452
|
+
if (pos + 6 < text.length && text.charCodeAt(pos + 1) === ch && text.charCodeAt(pos + 2) === ch && text.charCodeAt(pos + 3) === ch && text.charCodeAt(pos + 4) === ch && text.charCodeAt(pos + 5) === ch && text.charCodeAt(pos + 6) === ch) {
|
|
453
|
+
return ch === CharacterCodes.equals || text.charCodeAt(pos + 7) === CharacterCodes.space;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (ch === CharacterCodes.bar && pos + 6 < text.length && text.charCodeAt(pos + 1) === ch && text.charCodeAt(pos + 2) === ch && text.charCodeAt(pos + 3) === ch && text.charCodeAt(pos + 4) === ch && text.charCodeAt(pos + 5) === ch && text.charCodeAt(pos + 6) === ch) {
|
|
457
|
+
return true;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return false;
|
|
461
|
+
}
|
|
462
|
+
function scanConflictMarkerTrivia(text, pos) {
|
|
463
|
+
const ch = text.charCodeAt(pos);
|
|
464
|
+
const len = text.length;
|
|
465
|
+
if (ch === CharacterCodes.lessThan || ch === CharacterCodes.greaterThan) {
|
|
466
|
+
while (pos < len && !isLineBreak(text.charCodeAt(pos))) {
|
|
467
|
+
pos++;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
// Consume everything from the start of a ||||||| or ======= marker to the start
|
|
472
|
+
// of the next ======= or >>>>>>> marker.
|
|
473
|
+
pos += 7; // skip marker
|
|
474
|
+
while (pos < len) {
|
|
475
|
+
const currentChar = text.charCodeAt(pos);
|
|
476
|
+
if ((currentChar === CharacterCodes.equals || currentChar === CharacterCodes.greaterThan) && isConflictMarkerTrivia(text, pos)) {
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
pos++;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return pos;
|
|
483
|
+
}
|
|
484
|
+
function isShebangTrivia(text, pos) {
|
|
485
|
+
return pos === 0 && text.charCodeAt(0) === CharacterCodes.hash && text.charCodeAt(1) === CharacterCodes.exclamation;
|
|
486
|
+
}
|
|
487
|
+
function scanShebangTrivia(text, pos) {
|
|
488
|
+
pos += 2;
|
|
489
|
+
while (pos < text.length) {
|
|
490
|
+
if (isLineBreak(text.charCodeAt(pos))) {
|
|
491
|
+
break;
|
|
492
|
+
}
|
|
493
|
+
pos++;
|
|
494
|
+
}
|
|
495
|
+
return pos;
|
|
496
|
+
}
|
|
497
|
+
function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) {
|
|
498
|
+
let pendingPos;
|
|
499
|
+
let pendingEnd;
|
|
500
|
+
let pendingKind;
|
|
501
|
+
let pendingHasTrailingNewLine;
|
|
502
|
+
let hasPendingCommentRange = false;
|
|
503
|
+
let collecting = trailing;
|
|
504
|
+
let accumulator = initial;
|
|
505
|
+
if (pos === 0) {
|
|
506
|
+
collecting = true;
|
|
507
|
+
const shebang = getShebang(text);
|
|
508
|
+
if (shebang) {
|
|
509
|
+
pos = shebang.length;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
scan: while (pos >= 0 && pos < text.length) {
|
|
513
|
+
const ch = text.charCodeAt(pos);
|
|
514
|
+
switch (ch) {
|
|
515
|
+
case CharacterCodes.carriageReturn:
|
|
516
|
+
if (text.charCodeAt(pos + 1) === CharacterCodes.lineFeed) {
|
|
517
|
+
pos++;
|
|
518
|
+
}
|
|
519
|
+
// falls through
|
|
520
|
+
case CharacterCodes.lineFeed:
|
|
521
|
+
pos++;
|
|
522
|
+
if (trailing) {
|
|
523
|
+
break scan;
|
|
524
|
+
}
|
|
525
|
+
collecting = true;
|
|
526
|
+
if (hasPendingCommentRange) {
|
|
527
|
+
pendingHasTrailingNewLine = true;
|
|
528
|
+
}
|
|
529
|
+
continue;
|
|
530
|
+
case CharacterCodes.tab:
|
|
531
|
+
case CharacterCodes.verticalTab:
|
|
532
|
+
case CharacterCodes.formFeed:
|
|
533
|
+
case CharacterCodes.space:
|
|
534
|
+
pos++;
|
|
535
|
+
continue;
|
|
536
|
+
case CharacterCodes.slash:
|
|
537
|
+
const nextChar = text.charCodeAt(pos + 1);
|
|
538
|
+
let hasTrailingNewLine = false;
|
|
539
|
+
if (nextChar === CharacterCodes.slash || nextChar === CharacterCodes.asterisk) {
|
|
540
|
+
const kind = nextChar === CharacterCodes.slash ? SyntaxKind.SingleLineCommentTrivia : SyntaxKind.MultiLineCommentTrivia;
|
|
541
|
+
const startPos = pos;
|
|
542
|
+
pos += 2;
|
|
543
|
+
if (nextChar === CharacterCodes.slash) {
|
|
544
|
+
while (pos < text.length) {
|
|
545
|
+
if (isLineBreak(text.charCodeAt(pos))) {
|
|
546
|
+
hasTrailingNewLine = true;
|
|
547
|
+
break;
|
|
548
|
+
}
|
|
549
|
+
pos++;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
while (pos < text.length) {
|
|
554
|
+
if (text.charCodeAt(pos) === CharacterCodes.asterisk && text.charCodeAt(pos + 1) === CharacterCodes.slash) {
|
|
555
|
+
pos += 2;
|
|
556
|
+
break;
|
|
557
|
+
}
|
|
558
|
+
pos++;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
if (collecting) {
|
|
562
|
+
if (hasPendingCommentRange) {
|
|
563
|
+
accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);
|
|
564
|
+
if (!reduce && accumulator) {
|
|
565
|
+
return accumulator;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
pendingPos = startPos;
|
|
569
|
+
pendingEnd = pos;
|
|
570
|
+
pendingKind = kind;
|
|
571
|
+
pendingHasTrailingNewLine = hasTrailingNewLine;
|
|
572
|
+
hasPendingCommentRange = true;
|
|
573
|
+
}
|
|
574
|
+
continue;
|
|
575
|
+
}
|
|
576
|
+
break scan;
|
|
577
|
+
default:
|
|
578
|
+
if (ch > CharacterCodes.maxAsciiCharacter && (isWhiteSpaceLike(ch))) {
|
|
579
|
+
if (hasPendingCommentRange && isLineBreak(ch)) {
|
|
580
|
+
pendingHasTrailingNewLine = true;
|
|
581
|
+
}
|
|
582
|
+
pos++;
|
|
583
|
+
continue;
|
|
584
|
+
}
|
|
585
|
+
break scan;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
if (hasPendingCommentRange) {
|
|
589
|
+
accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator);
|
|
590
|
+
}
|
|
591
|
+
return accumulator;
|
|
592
|
+
}
|
|
593
|
+
function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments = []) {
|
|
594
|
+
comments.push({ kind, pos, end, hasTrailingNewLine });
|
|
595
|
+
return comments;
|
|
596
|
+
}
|
|
597
|
+
export function forEachLeadingCommentRange(text, pos, cb, state) {
|
|
598
|
+
return iterateCommentRanges(/*reduce*/ false, text, pos, /*trailing*/ false, cb, state, /*initial*/ undefined);
|
|
599
|
+
}
|
|
600
|
+
export function forEachTrailingCommentRange(text, pos, cb, state) {
|
|
601
|
+
return iterateCommentRanges(/*reduce*/ false, text, pos, /*trailing*/ true, cb, state, /*initial*/ undefined);
|
|
602
|
+
}
|
|
603
|
+
export function reduceEachLeadingCommentRange(text, pos, cb, state, initial) {
|
|
604
|
+
return iterateCommentRanges(/*reduce*/ true, text, pos, /*trailing*/ false, cb, state, initial);
|
|
605
|
+
}
|
|
606
|
+
export function reduceEachTrailingCommentRange(text, pos, cb, state, initial) {
|
|
607
|
+
return iterateCommentRanges(/*reduce*/ true, text, pos, /*trailing*/ true, cb, state, initial);
|
|
608
|
+
}
|
|
609
|
+
export function getLeadingCommentRanges(text, pos) {
|
|
610
|
+
return reduceEachLeadingCommentRange(text, pos, appendCommentRange, /*state*/ undefined, /*initial*/ undefined);
|
|
611
|
+
}
|
|
612
|
+
export function getTrailingCommentRanges(text, pos) {
|
|
613
|
+
return reduceEachTrailingCommentRange(text, pos, appendCommentRange, /*state*/ undefined, /*initial*/ undefined);
|
|
614
|
+
}
|
|
615
|
+
export function getShebang(text) {
|
|
616
|
+
const shebang = /^#!.*/;
|
|
617
|
+
if (isShebangTrivia(text, 0)) {
|
|
618
|
+
const match = shebang.exec(text);
|
|
619
|
+
if (match) {
|
|
620
|
+
return match[0];
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
return undefined;
|
|
624
|
+
}
|
|
625
|
+
export function isIdentifierStart(ch, _languageVersion) {
|
|
626
|
+
return ch >= CharacterCodes.A && ch <= CharacterCodes.Z || ch >= CharacterCodes.a && ch <= CharacterCodes.z ||
|
|
627
|
+
ch === CharacterCodes.$ || ch === CharacterCodes._ ||
|
|
628
|
+
ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierStart(ch);
|
|
629
|
+
}
|
|
630
|
+
export function isIdentifierPart(ch, _languageVersion, identifierVariant) {
|
|
631
|
+
return ch >= CharacterCodes.A && ch <= CharacterCodes.Z || ch >= CharacterCodes.a && ch <= CharacterCodes.z ||
|
|
632
|
+
ch >= CharacterCodes._0 && ch <= CharacterCodes._9 || ch === CharacterCodes.$ || ch === CharacterCodes._ ||
|
|
633
|
+
// "-" and ":" are valid in JSX Identifiers
|
|
634
|
+
(identifierVariant === LanguageVariant.JSX ? (ch === CharacterCodes.minus || ch === CharacterCodes.colon) : false) ||
|
|
635
|
+
ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierPart(ch);
|
|
636
|
+
}
|
|
637
|
+
export function isIdentifierText(name, _languageVersion, identifierVariant) {
|
|
638
|
+
let ch = name.codePointAt(0);
|
|
639
|
+
if (!isIdentifierStart(ch)) {
|
|
640
|
+
return false;
|
|
641
|
+
}
|
|
642
|
+
for (let i = charSize(ch); i < name.length; i += charSize(ch)) {
|
|
643
|
+
if (!isIdentifierPart(ch = name.codePointAt(i), undefined, identifierVariant)) {
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
return true;
|
|
648
|
+
}
|
|
649
|
+
function codePointAt(s, i) {
|
|
650
|
+
return s.codePointAt(i);
|
|
651
|
+
}
|
|
652
|
+
function charSize(ch) {
|
|
653
|
+
if (ch >= 0x10000) {
|
|
654
|
+
return 2;
|
|
655
|
+
}
|
|
656
|
+
if (ch === CharacterCodes.EOF) {
|
|
657
|
+
return 0;
|
|
658
|
+
}
|
|
659
|
+
return 1;
|
|
660
|
+
}
|
|
661
|
+
export function utf16EncodeAsString(codePoint) {
|
|
662
|
+
return String.fromCodePoint(codePoint);
|
|
663
|
+
}
|
|
664
|
+
function parsePseudoBigInt(stringValue) {
|
|
665
|
+
let log2Base;
|
|
666
|
+
switch (stringValue.charCodeAt(1)) {
|
|
667
|
+
case CharacterCodes.b:
|
|
668
|
+
case CharacterCodes.B:
|
|
669
|
+
log2Base = 1;
|
|
670
|
+
break;
|
|
671
|
+
case CharacterCodes.o:
|
|
672
|
+
case CharacterCodes.O:
|
|
673
|
+
log2Base = 3;
|
|
674
|
+
break;
|
|
675
|
+
case CharacterCodes.x:
|
|
676
|
+
case CharacterCodes.X:
|
|
677
|
+
log2Base = 4;
|
|
678
|
+
break;
|
|
679
|
+
default:
|
|
680
|
+
// decimals for now just peel the trailing "n" and return
|
|
681
|
+
const nIndex = stringValue.length - 1;
|
|
682
|
+
let nonZeroStart = 0;
|
|
683
|
+
while (stringValue.charCodeAt(nonZeroStart) === CharacterCodes._0) {
|
|
684
|
+
nonZeroStart++;
|
|
685
|
+
}
|
|
686
|
+
return stringValue.slice(nonZeroStart, nIndex) || "0";
|
|
687
|
+
}
|
|
688
|
+
// exit early for zero
|
|
689
|
+
const startIndex = 2;
|
|
690
|
+
const endIndex = stringValue.length - 1;
|
|
691
|
+
const bitsNeeded = (endIndex - startIndex) * log2Base;
|
|
692
|
+
// Stores the value specified by the string as a LE array of 16-bit integers
|
|
693
|
+
// using Uint16 instead of Uint32 so combining steps can use bitwise operators
|
|
694
|
+
const segments = new Uint16Array((bitsNeeded >>> 4) + (bitsNeeded & 15 ? 1 : 0));
|
|
695
|
+
// Add the digits, one at a time
|
|
696
|
+
for (let i = endIndex - 1, bitOffset = 0; i >= startIndex; i--, bitOffset += log2Base) {
|
|
697
|
+
const segment = bitOffset >>> 4;
|
|
698
|
+
const digitChar = stringValue.charCodeAt(i);
|
|
699
|
+
// Find character value
|
|
700
|
+
const digit = digitChar <= CharacterCodes._9
|
|
701
|
+
? digitChar - CharacterCodes._0
|
|
702
|
+
: 10 + digitChar - (digitChar <= CharacterCodes.F ? CharacterCodes.A : CharacterCodes.a);
|
|
703
|
+
// Add bits into segment
|
|
704
|
+
const shiftedDigit = digit << (bitOffset & 15);
|
|
705
|
+
segments[segment] |= shiftedDigit;
|
|
706
|
+
// overflow to next segment
|
|
707
|
+
const residual = shiftedDigit >>> 16;
|
|
708
|
+
if (residual)
|
|
709
|
+
segments[segment + 1] |= residual;
|
|
710
|
+
}
|
|
711
|
+
// Repeatedly divide by 10 to find each decimal digit
|
|
712
|
+
let base10Value = "";
|
|
713
|
+
let firstNonzeroSegment = segments.length - 1;
|
|
714
|
+
let segmentsRemaining = true;
|
|
715
|
+
while (segmentsRemaining) {
|
|
716
|
+
let mod10 = 0;
|
|
717
|
+
segmentsRemaining = false;
|
|
718
|
+
for (let segment = firstNonzeroSegment; segment >= 0; segment--) {
|
|
719
|
+
const newSegment = mod10 << 16 | segments[segment];
|
|
720
|
+
const segmentValue = (newSegment / 10) | 0;
|
|
721
|
+
segments[segment] = segmentValue;
|
|
722
|
+
mod10 = newSegment - segmentValue * 10;
|
|
723
|
+
if (segmentValue && !segmentsRemaining) {
|
|
724
|
+
firstNonzeroSegment = segment;
|
|
725
|
+
segmentsRemaining = true;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
base10Value = mod10 + base10Value;
|
|
729
|
+
}
|
|
730
|
+
return base10Value;
|
|
731
|
+
}
|
|
732
|
+
// Creates a scanner over a (possibly unspecified) range of a piece of text.
|
|
733
|
+
export function createScanner(skipTrivia, languageVariant = LanguageVariant.Standard, textInitial, start, length) {
|
|
734
|
+
// Why var? It avoids TDZ checks in the runtime which can be costly.
|
|
735
|
+
// See: https://github.com/microsoft/TypeScript/issues/52924
|
|
736
|
+
/* eslint-disable no-var */
|
|
737
|
+
var text = textInitial;
|
|
738
|
+
// Current position (end position of text of current token)
|
|
739
|
+
var pos;
|
|
740
|
+
// end of text
|
|
741
|
+
var end;
|
|
742
|
+
// Start position of whitespace before current token
|
|
743
|
+
var fullStartPos;
|
|
744
|
+
// Start position of text of current token
|
|
745
|
+
var tokenStart;
|
|
746
|
+
var token;
|
|
747
|
+
var tokenValue;
|
|
748
|
+
var tokenFlags;
|
|
749
|
+
var commentDirectives;
|
|
750
|
+
var skipJsDocLeadingAsterisks = 0;
|
|
751
|
+
setText(text, start, length);
|
|
752
|
+
var scanner = {
|
|
753
|
+
getTokenFullStart: () => fullStartPos,
|
|
754
|
+
getTokenEnd: () => pos,
|
|
755
|
+
getToken: () => token,
|
|
756
|
+
getTokenStart: () => tokenStart,
|
|
757
|
+
getTokenText: () => text.substring(tokenStart, pos),
|
|
758
|
+
getTokenValue: () => tokenValue,
|
|
759
|
+
hasUnicodeEscape: () => (tokenFlags & TokenFlags.UnicodeEscape) !== 0,
|
|
760
|
+
hasExtendedUnicodeEscape: () => (tokenFlags & TokenFlags.ExtendedUnicodeEscape) !== 0,
|
|
761
|
+
hasPrecedingLineBreak: () => (tokenFlags & TokenFlags.PrecedingLineBreak) !== 0,
|
|
762
|
+
hasPrecedingJSDocComment: () => (tokenFlags & TokenFlags.PrecedingJSDocComment) !== 0,
|
|
763
|
+
hasPrecedingJSDocLeadingAsterisks: () => (tokenFlags & TokenFlags.PrecedingJSDocLeadingAsterisks) !== 0,
|
|
764
|
+
hasPrecedingJSDocWithDeprecatedTag: () => (tokenFlags & TokenFlags.PrecedingJSDocWithDeprecated) !== 0,
|
|
765
|
+
hasPrecedingJSDocWithSeeOrLink: () => (tokenFlags & TokenFlags.PrecedingJSDocWithSeeOrLink) !== 0,
|
|
766
|
+
isIdentifier: () => token === SyntaxKind.Identifier || token > SyntaxKind.LastReservedWord,
|
|
767
|
+
isReservedWord: () => token >= SyntaxKind.FirstReservedWord && token <= SyntaxKind.LastReservedWord,
|
|
768
|
+
isUnterminated: () => (tokenFlags & TokenFlags.Unterminated) !== 0,
|
|
769
|
+
getCommentDirectives: () => commentDirectives,
|
|
770
|
+
getNumericLiteralFlags: () => tokenFlags & TokenFlags.NumericLiteralFlags,
|
|
771
|
+
getTokenFlags: () => tokenFlags,
|
|
772
|
+
reScanGreaterToken,
|
|
773
|
+
reScanAsteriskEqualsToken,
|
|
774
|
+
reScanSlashToken,
|
|
775
|
+
reScanTemplateToken,
|
|
776
|
+
reScanTemplateHeadOrNoSubstitutionTemplate,
|
|
777
|
+
scanJsxIdentifier,
|
|
778
|
+
scanJsxAttributeValue,
|
|
779
|
+
reScanJsxAttributeValue,
|
|
780
|
+
reScanJsxToken,
|
|
781
|
+
reScanLessThanToken,
|
|
782
|
+
reScanHashToken,
|
|
783
|
+
reScanQuestionToken,
|
|
784
|
+
reScanInvalidIdentifier,
|
|
785
|
+
scanJsxToken,
|
|
786
|
+
scanJsDocToken,
|
|
787
|
+
scanJSDocCommentTextToken,
|
|
788
|
+
scan,
|
|
789
|
+
getText,
|
|
790
|
+
clearCommentDirectives,
|
|
791
|
+
setText,
|
|
792
|
+
setLanguageVariant,
|
|
793
|
+
resetTokenState,
|
|
794
|
+
setSkipJsDocLeadingAsterisks,
|
|
795
|
+
tryScan,
|
|
796
|
+
lookAhead,
|
|
797
|
+
scanRange,
|
|
798
|
+
};
|
|
799
|
+
/* eslint-enable no-var */
|
|
800
|
+
return scanner;
|
|
801
|
+
function codePointUnchecked(pos) {
|
|
802
|
+
return codePointAt(text, pos);
|
|
803
|
+
}
|
|
804
|
+
function codePointChecked(pos) {
|
|
805
|
+
return pos >= 0 && pos < end ? codePointUnchecked(pos) : CharacterCodes.EOF;
|
|
806
|
+
}
|
|
807
|
+
function charCodeUnchecked(pos) {
|
|
808
|
+
return text.charCodeAt(pos);
|
|
809
|
+
}
|
|
810
|
+
function charCodeChecked(pos) {
|
|
811
|
+
return pos >= 0 && pos < end ? charCodeUnchecked(pos) : CharacterCodes.EOF;
|
|
812
|
+
}
|
|
813
|
+
function scanNumberFragment() {
|
|
814
|
+
let start = pos;
|
|
815
|
+
let allowSeparator = false;
|
|
816
|
+
let isPreviousTokenSeparator = false;
|
|
817
|
+
let result = "";
|
|
818
|
+
while (true) {
|
|
819
|
+
const ch = charCodeUnchecked(pos);
|
|
820
|
+
if (ch === CharacterCodes._) {
|
|
821
|
+
tokenFlags |= TokenFlags.ContainsSeparator;
|
|
822
|
+
if (allowSeparator) {
|
|
823
|
+
allowSeparator = false;
|
|
824
|
+
isPreviousTokenSeparator = true;
|
|
825
|
+
result += text.substring(start, pos);
|
|
826
|
+
}
|
|
827
|
+
else {
|
|
828
|
+
tokenFlags |= TokenFlags.ContainsInvalidSeparator;
|
|
829
|
+
}
|
|
830
|
+
pos++;
|
|
831
|
+
start = pos;
|
|
832
|
+
continue;
|
|
833
|
+
}
|
|
834
|
+
if (isDigit(ch)) {
|
|
835
|
+
allowSeparator = true;
|
|
836
|
+
isPreviousTokenSeparator = false;
|
|
837
|
+
pos++;
|
|
838
|
+
continue;
|
|
839
|
+
}
|
|
840
|
+
break;
|
|
841
|
+
}
|
|
842
|
+
if (charCodeUnchecked(pos - 1) === CharacterCodes._) {
|
|
843
|
+
tokenFlags |= TokenFlags.ContainsInvalidSeparator;
|
|
844
|
+
}
|
|
845
|
+
return result + text.substring(start, pos);
|
|
846
|
+
}
|
|
847
|
+
function scanNumber() {
|
|
848
|
+
let start = pos;
|
|
849
|
+
let mainFragment;
|
|
850
|
+
if (charCodeUnchecked(pos) === CharacterCodes._0) {
|
|
851
|
+
pos++;
|
|
852
|
+
if (charCodeUnchecked(pos) === CharacterCodes._) {
|
|
853
|
+
tokenFlags |= TokenFlags.ContainsSeparator | TokenFlags.ContainsInvalidSeparator;
|
|
854
|
+
pos--;
|
|
855
|
+
mainFragment = scanNumberFragment();
|
|
856
|
+
}
|
|
857
|
+
else if (!scanDigits()) {
|
|
858
|
+
tokenFlags |= TokenFlags.ContainsLeadingZero;
|
|
859
|
+
mainFragment = "" + +tokenValue;
|
|
860
|
+
}
|
|
861
|
+
else if (!tokenValue) {
|
|
862
|
+
mainFragment = "0";
|
|
863
|
+
}
|
|
864
|
+
else {
|
|
865
|
+
tokenValue = "" + parseInt(tokenValue, 8);
|
|
866
|
+
tokenFlags |= TokenFlags.Octal;
|
|
867
|
+
const withMinus = token === SyntaxKind.MinusToken;
|
|
868
|
+
const literal = (withMinus ? "-" : "") + "0o" + (+tokenValue).toString(8);
|
|
869
|
+
if (withMinus)
|
|
870
|
+
start--;
|
|
871
|
+
return SyntaxKind.NumericLiteral;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
else {
|
|
875
|
+
mainFragment = scanNumberFragment();
|
|
876
|
+
}
|
|
877
|
+
let decimalFragment;
|
|
878
|
+
let scientificFragment;
|
|
879
|
+
if (charCodeUnchecked(pos) === CharacterCodes.dot) {
|
|
880
|
+
pos++;
|
|
881
|
+
decimalFragment = scanNumberFragment();
|
|
882
|
+
}
|
|
883
|
+
let end = pos;
|
|
884
|
+
if (charCodeUnchecked(pos) === CharacterCodes.E || charCodeUnchecked(pos) === CharacterCodes.e) {
|
|
885
|
+
pos++;
|
|
886
|
+
tokenFlags |= TokenFlags.Scientific;
|
|
887
|
+
if (charCodeUnchecked(pos) === CharacterCodes.plus || charCodeUnchecked(pos) === CharacterCodes.minus)
|
|
888
|
+
pos++;
|
|
889
|
+
const preNumericPart = pos;
|
|
890
|
+
const finalFragment = scanNumberFragment();
|
|
891
|
+
if (finalFragment) {
|
|
892
|
+
scientificFragment = text.substring(end, preNumericPart) + finalFragment;
|
|
893
|
+
end = pos;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
let result;
|
|
897
|
+
if (tokenFlags & TokenFlags.ContainsSeparator) {
|
|
898
|
+
result = mainFragment;
|
|
899
|
+
if (decimalFragment) {
|
|
900
|
+
result += "." + decimalFragment;
|
|
901
|
+
}
|
|
902
|
+
if (scientificFragment) {
|
|
903
|
+
result += scientificFragment;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
else {
|
|
907
|
+
result = text.substring(start, end);
|
|
908
|
+
}
|
|
909
|
+
if (tokenFlags & TokenFlags.ContainsLeadingZero) {
|
|
910
|
+
tokenValue = "" + +result;
|
|
911
|
+
return SyntaxKind.NumericLiteral;
|
|
912
|
+
}
|
|
913
|
+
if (decimalFragment !== undefined || tokenFlags & TokenFlags.Scientific) {
|
|
914
|
+
checkForIdentifierStartAfterNumericLiteral();
|
|
915
|
+
tokenValue = "" + +result;
|
|
916
|
+
return SyntaxKind.NumericLiteral;
|
|
917
|
+
}
|
|
918
|
+
else {
|
|
919
|
+
tokenValue = result;
|
|
920
|
+
const type = checkBigIntSuffix();
|
|
921
|
+
checkForIdentifierStartAfterNumericLiteral();
|
|
922
|
+
return type;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
function checkForIdentifierStartAfterNumericLiteral() {
|
|
926
|
+
if (!isIdentifierStart(codePointUnchecked(pos))) {
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
const identifierStart = pos;
|
|
930
|
+
const { length } = scanIdentifierParts();
|
|
931
|
+
if (!(length === 1 && text[identifierStart] === "n")) {
|
|
932
|
+
pos = identifierStart;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
function scanDigits() {
|
|
936
|
+
const start = pos;
|
|
937
|
+
let isOctal = true;
|
|
938
|
+
while (isDigit(charCodeChecked(pos))) {
|
|
939
|
+
if (!isOctalDigit(charCodeUnchecked(pos))) {
|
|
940
|
+
isOctal = false;
|
|
941
|
+
}
|
|
942
|
+
pos++;
|
|
943
|
+
}
|
|
944
|
+
tokenValue = text.substring(start, pos);
|
|
945
|
+
return isOctal;
|
|
946
|
+
}
|
|
947
|
+
function scanExactNumberOfHexDigits(count, canHaveSeparators) {
|
|
948
|
+
const valueString = scanHexDigits(count, /*scanAsManyAsPossible*/ false, canHaveSeparators);
|
|
949
|
+
return valueString ? parseInt(valueString, 16) : -1;
|
|
950
|
+
}
|
|
951
|
+
function scanMinimumNumberOfHexDigits(count, canHaveSeparators) {
|
|
952
|
+
return scanHexDigits(count, /*scanAsManyAsPossible*/ true, canHaveSeparators);
|
|
953
|
+
}
|
|
954
|
+
function scanHexDigits(minCount, scanAsManyAsPossible, canHaveSeparators) {
|
|
955
|
+
let valueChars = [];
|
|
956
|
+
let allowSeparator = false;
|
|
957
|
+
while (valueChars.length < minCount || scanAsManyAsPossible) {
|
|
958
|
+
let ch = charCodeUnchecked(pos);
|
|
959
|
+
if (canHaveSeparators && ch === CharacterCodes._) {
|
|
960
|
+
tokenFlags |= TokenFlags.ContainsSeparator;
|
|
961
|
+
if (allowSeparator) {
|
|
962
|
+
allowSeparator = false;
|
|
963
|
+
}
|
|
964
|
+
pos++;
|
|
965
|
+
continue;
|
|
966
|
+
}
|
|
967
|
+
allowSeparator = canHaveSeparators;
|
|
968
|
+
if (ch >= CharacterCodes.A && ch <= CharacterCodes.F) {
|
|
969
|
+
ch += CharacterCodes.a - CharacterCodes.A;
|
|
970
|
+
}
|
|
971
|
+
else if (!((ch >= CharacterCodes._0 && ch <= CharacterCodes._9) ||
|
|
972
|
+
(ch >= CharacterCodes.a && ch <= CharacterCodes.f))) {
|
|
973
|
+
break;
|
|
974
|
+
}
|
|
975
|
+
valueChars.push(ch);
|
|
976
|
+
pos++;
|
|
977
|
+
}
|
|
978
|
+
if (valueChars.length < minCount) {
|
|
979
|
+
valueChars = [];
|
|
980
|
+
}
|
|
981
|
+
return String.fromCharCode(...valueChars);
|
|
982
|
+
}
|
|
983
|
+
function scanString(jsxAttributeString = false) {
|
|
984
|
+
const quote = charCodeUnchecked(pos);
|
|
985
|
+
pos++;
|
|
986
|
+
let result = "";
|
|
987
|
+
let start = pos;
|
|
988
|
+
while (true) {
|
|
989
|
+
if (pos >= end) {
|
|
990
|
+
result += text.substring(start, pos);
|
|
991
|
+
tokenFlags |= TokenFlags.Unterminated;
|
|
992
|
+
break;
|
|
993
|
+
}
|
|
994
|
+
const ch = charCodeUnchecked(pos);
|
|
995
|
+
if (ch === quote) {
|
|
996
|
+
result += text.substring(start, pos);
|
|
997
|
+
pos++;
|
|
998
|
+
break;
|
|
999
|
+
}
|
|
1000
|
+
if (ch === CharacterCodes.backslash && !jsxAttributeString) {
|
|
1001
|
+
result += text.substring(start, pos);
|
|
1002
|
+
result += scanEscapeSequence(EscapeSequenceScanningFlags.String | EscapeSequenceScanningFlags.ReportErrors);
|
|
1003
|
+
start = pos;
|
|
1004
|
+
continue;
|
|
1005
|
+
}
|
|
1006
|
+
if ((ch === CharacterCodes.lineFeed || ch === CharacterCodes.carriageReturn) && !jsxAttributeString) {
|
|
1007
|
+
result += text.substring(start, pos);
|
|
1008
|
+
tokenFlags |= TokenFlags.Unterminated;
|
|
1009
|
+
break;
|
|
1010
|
+
}
|
|
1011
|
+
pos++;
|
|
1012
|
+
}
|
|
1013
|
+
return result;
|
|
1014
|
+
}
|
|
1015
|
+
function scanTemplateAndSetTokenValue(shouldEmitInvalidEscapeError) {
|
|
1016
|
+
const startedWithBacktick = charCodeUnchecked(pos) === CharacterCodes.backtick;
|
|
1017
|
+
pos++;
|
|
1018
|
+
let start = pos;
|
|
1019
|
+
let contents = "";
|
|
1020
|
+
let resultingToken;
|
|
1021
|
+
while (true) {
|
|
1022
|
+
if (pos >= end) {
|
|
1023
|
+
contents += text.substring(start, pos);
|
|
1024
|
+
tokenFlags |= TokenFlags.Unterminated;
|
|
1025
|
+
resultingToken = startedWithBacktick ? SyntaxKind.NoSubstitutionTemplateLiteral : SyntaxKind.TemplateTail;
|
|
1026
|
+
break;
|
|
1027
|
+
}
|
|
1028
|
+
const currChar = charCodeUnchecked(pos);
|
|
1029
|
+
if (currChar === CharacterCodes.backtick) {
|
|
1030
|
+
contents += text.substring(start, pos);
|
|
1031
|
+
pos++;
|
|
1032
|
+
resultingToken = startedWithBacktick ? SyntaxKind.NoSubstitutionTemplateLiteral : SyntaxKind.TemplateTail;
|
|
1033
|
+
break;
|
|
1034
|
+
}
|
|
1035
|
+
if (currChar === CharacterCodes.$ && pos + 1 < end && charCodeUnchecked(pos + 1) === CharacterCodes.openBrace) {
|
|
1036
|
+
contents += text.substring(start, pos);
|
|
1037
|
+
pos += 2;
|
|
1038
|
+
resultingToken = startedWithBacktick ? SyntaxKind.TemplateHead : SyntaxKind.TemplateMiddle;
|
|
1039
|
+
break;
|
|
1040
|
+
}
|
|
1041
|
+
if (currChar === CharacterCodes.backslash) {
|
|
1042
|
+
contents += text.substring(start, pos);
|
|
1043
|
+
contents += scanEscapeSequence(EscapeSequenceScanningFlags.String | (shouldEmitInvalidEscapeError ? EscapeSequenceScanningFlags.ReportErrors : 0));
|
|
1044
|
+
start = pos;
|
|
1045
|
+
continue;
|
|
1046
|
+
}
|
|
1047
|
+
if (currChar === CharacterCodes.carriageReturn) {
|
|
1048
|
+
contents += text.substring(start, pos);
|
|
1049
|
+
pos++;
|
|
1050
|
+
if (pos < end && charCodeUnchecked(pos) === CharacterCodes.lineFeed) {
|
|
1051
|
+
pos++;
|
|
1052
|
+
}
|
|
1053
|
+
contents += "\n";
|
|
1054
|
+
start = pos;
|
|
1055
|
+
continue;
|
|
1056
|
+
}
|
|
1057
|
+
pos++;
|
|
1058
|
+
}
|
|
1059
|
+
tokenValue = contents;
|
|
1060
|
+
return resultingToken;
|
|
1061
|
+
}
|
|
1062
|
+
function scanEscapeSequence(flags) {
|
|
1063
|
+
const start = pos;
|
|
1064
|
+
pos++;
|
|
1065
|
+
if (pos >= end) {
|
|
1066
|
+
return "";
|
|
1067
|
+
}
|
|
1068
|
+
const ch = charCodeUnchecked(pos);
|
|
1069
|
+
pos++;
|
|
1070
|
+
switch (ch) {
|
|
1071
|
+
case CharacterCodes._0:
|
|
1072
|
+
if (pos >= end || !isDigit(charCodeUnchecked(pos))) {
|
|
1073
|
+
return "\0";
|
|
1074
|
+
}
|
|
1075
|
+
// falls through
|
|
1076
|
+
case CharacterCodes._1:
|
|
1077
|
+
case CharacterCodes._2:
|
|
1078
|
+
case CharacterCodes._3:
|
|
1079
|
+
if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
|
|
1080
|
+
pos++;
|
|
1081
|
+
}
|
|
1082
|
+
// falls through
|
|
1083
|
+
case CharacterCodes._4:
|
|
1084
|
+
case CharacterCodes._5:
|
|
1085
|
+
case CharacterCodes._6:
|
|
1086
|
+
case CharacterCodes._7:
|
|
1087
|
+
if (pos < end && isOctalDigit(charCodeUnchecked(pos))) {
|
|
1088
|
+
pos++;
|
|
1089
|
+
}
|
|
1090
|
+
tokenFlags |= TokenFlags.ContainsInvalidEscape;
|
|
1091
|
+
if (flags & EscapeSequenceScanningFlags.ReportInvalidEscapeErrors) {
|
|
1092
|
+
const code = parseInt(text.substring(start + 1, pos), 8);
|
|
1093
|
+
return String.fromCharCode(code);
|
|
1094
|
+
}
|
|
1095
|
+
return text.substring(start, pos);
|
|
1096
|
+
case CharacterCodes._8:
|
|
1097
|
+
case CharacterCodes._9:
|
|
1098
|
+
tokenFlags |= TokenFlags.ContainsInvalidEscape;
|
|
1099
|
+
if (flags & EscapeSequenceScanningFlags.ReportInvalidEscapeErrors) {
|
|
1100
|
+
return String.fromCharCode(ch);
|
|
1101
|
+
}
|
|
1102
|
+
return text.substring(start, pos);
|
|
1103
|
+
case CharacterCodes.b:
|
|
1104
|
+
return "\b";
|
|
1105
|
+
case CharacterCodes.t:
|
|
1106
|
+
return "\t";
|
|
1107
|
+
case CharacterCodes.n:
|
|
1108
|
+
return "\n";
|
|
1109
|
+
case CharacterCodes.v:
|
|
1110
|
+
return "\v";
|
|
1111
|
+
case CharacterCodes.f:
|
|
1112
|
+
return "\f";
|
|
1113
|
+
case CharacterCodes.r:
|
|
1114
|
+
return "\r";
|
|
1115
|
+
case CharacterCodes.singleQuote:
|
|
1116
|
+
return "'";
|
|
1117
|
+
case CharacterCodes.doubleQuote:
|
|
1118
|
+
return '"';
|
|
1119
|
+
case CharacterCodes.u:
|
|
1120
|
+
if (pos < end && charCodeUnchecked(pos) === CharacterCodes.openBrace) {
|
|
1121
|
+
pos -= 2;
|
|
1122
|
+
const result = scanExtendedUnicodeEscape();
|
|
1123
|
+
if (!(flags & EscapeSequenceScanningFlags.AllowExtendedUnicodeEscape)) {
|
|
1124
|
+
tokenFlags |= TokenFlags.ContainsInvalidEscape;
|
|
1125
|
+
}
|
|
1126
|
+
return result;
|
|
1127
|
+
}
|
|
1128
|
+
// '\uDDDD'
|
|
1129
|
+
for (; pos < start + 6; pos++) {
|
|
1130
|
+
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
1131
|
+
tokenFlags |= TokenFlags.ContainsInvalidEscape;
|
|
1132
|
+
return text.substring(start, pos);
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
tokenFlags |= TokenFlags.UnicodeEscape;
|
|
1136
|
+
{
|
|
1137
|
+
const escapedValue = parseInt(text.substring(start + 2, pos), 16);
|
|
1138
|
+
const escapedValueString = String.fromCharCode(escapedValue);
|
|
1139
|
+
if (flags & EscapeSequenceScanningFlags.AnyUnicodeMode && escapedValue >= 0xD800 && escapedValue <= 0xDBFF &&
|
|
1140
|
+
pos + 6 < end && text.substring(pos, pos + 2) === "\\u" && charCodeUnchecked(pos + 2) !== CharacterCodes.openBrace) {
|
|
1141
|
+
const nextStart = pos;
|
|
1142
|
+
let nextPos = pos + 2;
|
|
1143
|
+
for (; nextPos < nextStart + 6; nextPos++) {
|
|
1144
|
+
if (!isHexDigit(charCodeUnchecked(nextPos))) {
|
|
1145
|
+
return escapedValueString;
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
const nextEscapedValue = parseInt(text.substring(nextStart + 2, nextPos), 16);
|
|
1149
|
+
if (nextEscapedValue >= 0xDC00 && nextEscapedValue <= 0xDFFF) {
|
|
1150
|
+
pos = nextPos;
|
|
1151
|
+
return escapedValueString + String.fromCharCode(nextEscapedValue);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
return escapedValueString;
|
|
1155
|
+
}
|
|
1156
|
+
case CharacterCodes.x:
|
|
1157
|
+
for (; pos < start + 4; pos++) {
|
|
1158
|
+
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
1159
|
+
tokenFlags |= TokenFlags.ContainsInvalidEscape;
|
|
1160
|
+
return text.substring(start, pos);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
tokenFlags |= TokenFlags.HexEscape;
|
|
1164
|
+
return String.fromCharCode(parseInt(text.substring(start + 2, pos), 16));
|
|
1165
|
+
case CharacterCodes.carriageReturn:
|
|
1166
|
+
if (pos < end && charCodeUnchecked(pos) === CharacterCodes.lineFeed) {
|
|
1167
|
+
pos++;
|
|
1168
|
+
}
|
|
1169
|
+
// falls through
|
|
1170
|
+
case CharacterCodes.lineFeed:
|
|
1171
|
+
case CharacterCodes.lineSeparator:
|
|
1172
|
+
case CharacterCodes.paragraphSeparator:
|
|
1173
|
+
return "";
|
|
1174
|
+
default:
|
|
1175
|
+
return String.fromCharCode(ch);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
function scanExtendedUnicodeEscape() {
|
|
1179
|
+
const start = pos;
|
|
1180
|
+
pos += 3;
|
|
1181
|
+
const escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false);
|
|
1182
|
+
const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
|
|
1183
|
+
let isInvalidExtendedEscape = false;
|
|
1184
|
+
if (escapedValue < 0) {
|
|
1185
|
+
isInvalidExtendedEscape = true;
|
|
1186
|
+
}
|
|
1187
|
+
else if (escapedValue > 0x10FFFF) {
|
|
1188
|
+
isInvalidExtendedEscape = true;
|
|
1189
|
+
}
|
|
1190
|
+
if (pos >= end) {
|
|
1191
|
+
isInvalidExtendedEscape = true;
|
|
1192
|
+
}
|
|
1193
|
+
else if (charCodeUnchecked(pos) === CharacterCodes.closeBrace) {
|
|
1194
|
+
pos++;
|
|
1195
|
+
}
|
|
1196
|
+
else {
|
|
1197
|
+
isInvalidExtendedEscape = true;
|
|
1198
|
+
}
|
|
1199
|
+
if (isInvalidExtendedEscape) {
|
|
1200
|
+
tokenFlags |= TokenFlags.ContainsInvalidEscape;
|
|
1201
|
+
return text.substring(start, pos);
|
|
1202
|
+
}
|
|
1203
|
+
tokenFlags |= TokenFlags.ExtendedUnicodeEscape;
|
|
1204
|
+
return utf16EncodeAsString(escapedValue);
|
|
1205
|
+
}
|
|
1206
|
+
function peekUnicodeEscape() {
|
|
1207
|
+
if (pos + 5 < end && charCodeUnchecked(pos + 1) === CharacterCodes.u) {
|
|
1208
|
+
const start = pos;
|
|
1209
|
+
pos += 2;
|
|
1210
|
+
const value = scanExactNumberOfHexDigits(4, /*canHaveSeparators*/ false);
|
|
1211
|
+
pos = start;
|
|
1212
|
+
return value;
|
|
1213
|
+
}
|
|
1214
|
+
return -1;
|
|
1215
|
+
}
|
|
1216
|
+
function peekExtendedUnicodeEscape() {
|
|
1217
|
+
if (codePointUnchecked(pos + 1) === CharacterCodes.u && codePointUnchecked(pos + 2) === CharacterCodes.openBrace) {
|
|
1218
|
+
const start = pos;
|
|
1219
|
+
pos += 3;
|
|
1220
|
+
const escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false);
|
|
1221
|
+
const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1;
|
|
1222
|
+
pos = start;
|
|
1223
|
+
return escapedValue;
|
|
1224
|
+
}
|
|
1225
|
+
return -1;
|
|
1226
|
+
}
|
|
1227
|
+
function scanIdentifierParts() {
|
|
1228
|
+
let result = "";
|
|
1229
|
+
let start = pos;
|
|
1230
|
+
while (pos < end) {
|
|
1231
|
+
let ch = codePointUnchecked(pos);
|
|
1232
|
+
if (isIdentifierPart(ch)) {
|
|
1233
|
+
pos += charSize(ch);
|
|
1234
|
+
}
|
|
1235
|
+
else if (ch === CharacterCodes.backslash) {
|
|
1236
|
+
ch = peekExtendedUnicodeEscape();
|
|
1237
|
+
if (ch >= 0 && isIdentifierPart(ch)) {
|
|
1238
|
+
result += scanExtendedUnicodeEscape();
|
|
1239
|
+
start = pos;
|
|
1240
|
+
continue;
|
|
1241
|
+
}
|
|
1242
|
+
ch = peekUnicodeEscape();
|
|
1243
|
+
if (!(ch >= 0 && isIdentifierPart(ch))) {
|
|
1244
|
+
break;
|
|
1245
|
+
}
|
|
1246
|
+
tokenFlags |= TokenFlags.UnicodeEscape;
|
|
1247
|
+
result += text.substring(start, pos);
|
|
1248
|
+
result += utf16EncodeAsString(ch);
|
|
1249
|
+
pos += 6;
|
|
1250
|
+
start = pos;
|
|
1251
|
+
}
|
|
1252
|
+
else {
|
|
1253
|
+
break;
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
result += text.substring(start, pos);
|
|
1257
|
+
return result;
|
|
1258
|
+
}
|
|
1259
|
+
function getIdentifierToken() {
|
|
1260
|
+
const len = tokenValue.length;
|
|
1261
|
+
if (len >= 2 && len <= 12) {
|
|
1262
|
+
const ch = tokenValue.charCodeAt(0);
|
|
1263
|
+
if (ch >= CharacterCodes.a && ch <= CharacterCodes.z) {
|
|
1264
|
+
const keyword = textToKeyword.get(tokenValue);
|
|
1265
|
+
if (keyword !== undefined) {
|
|
1266
|
+
return token = keyword;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
return token = SyntaxKind.Identifier;
|
|
1271
|
+
}
|
|
1272
|
+
function scanBinaryOrOctalDigits(base) {
|
|
1273
|
+
let value = "";
|
|
1274
|
+
let separatorAllowed = false;
|
|
1275
|
+
let isPreviousTokenSeparator = false;
|
|
1276
|
+
while (true) {
|
|
1277
|
+
const ch = charCodeUnchecked(pos);
|
|
1278
|
+
if (ch === CharacterCodes._) {
|
|
1279
|
+
tokenFlags |= TokenFlags.ContainsSeparator;
|
|
1280
|
+
if (separatorAllowed) {
|
|
1281
|
+
separatorAllowed = false;
|
|
1282
|
+
isPreviousTokenSeparator = true;
|
|
1283
|
+
}
|
|
1284
|
+
pos++;
|
|
1285
|
+
continue;
|
|
1286
|
+
}
|
|
1287
|
+
separatorAllowed = true;
|
|
1288
|
+
if (!isDigit(ch) || ch - CharacterCodes._0 >= base) {
|
|
1289
|
+
break;
|
|
1290
|
+
}
|
|
1291
|
+
value += text[pos];
|
|
1292
|
+
pos++;
|
|
1293
|
+
isPreviousTokenSeparator = false;
|
|
1294
|
+
}
|
|
1295
|
+
return value;
|
|
1296
|
+
}
|
|
1297
|
+
function checkBigIntSuffix() {
|
|
1298
|
+
if (charCodeUnchecked(pos) === CharacterCodes.n) {
|
|
1299
|
+
tokenValue += "n";
|
|
1300
|
+
if (tokenFlags & TokenFlags.BinaryOrOctalSpecifier) {
|
|
1301
|
+
tokenValue = parsePseudoBigInt(tokenValue) + "n";
|
|
1302
|
+
}
|
|
1303
|
+
pos++;
|
|
1304
|
+
return SyntaxKind.BigIntLiteral;
|
|
1305
|
+
}
|
|
1306
|
+
else {
|
|
1307
|
+
const numericValue = tokenFlags & TokenFlags.BinarySpecifier
|
|
1308
|
+
? parseInt(tokenValue.slice(2), 2)
|
|
1309
|
+
: tokenFlags & TokenFlags.OctalSpecifier
|
|
1310
|
+
? parseInt(tokenValue.slice(2), 8)
|
|
1311
|
+
: +tokenValue;
|
|
1312
|
+
tokenValue = "" + numericValue;
|
|
1313
|
+
return SyntaxKind.NumericLiteral;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
function scan() {
|
|
1317
|
+
fullStartPos = pos;
|
|
1318
|
+
tokenFlags = TokenFlags.None;
|
|
1319
|
+
while (true) {
|
|
1320
|
+
tokenStart = pos;
|
|
1321
|
+
if (pos >= end) {
|
|
1322
|
+
return token = SyntaxKind.EndOfFile;
|
|
1323
|
+
}
|
|
1324
|
+
const ch = codePointUnchecked(pos);
|
|
1325
|
+
if (pos === 0) {
|
|
1326
|
+
if (ch === CharacterCodes.hash && isShebangTrivia(text, pos)) {
|
|
1327
|
+
pos = scanShebangTrivia(text, pos);
|
|
1328
|
+
if (skipTrivia) {
|
|
1329
|
+
continue;
|
|
1330
|
+
}
|
|
1331
|
+
else {
|
|
1332
|
+
return token = SyntaxKind.Unknown;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
switch (ch) {
|
|
1337
|
+
case CharacterCodes.lineFeed:
|
|
1338
|
+
case CharacterCodes.carriageReturn:
|
|
1339
|
+
tokenFlags |= TokenFlags.PrecedingLineBreak;
|
|
1340
|
+
if (skipTrivia) {
|
|
1341
|
+
pos++;
|
|
1342
|
+
continue;
|
|
1343
|
+
}
|
|
1344
|
+
else {
|
|
1345
|
+
if (ch === CharacterCodes.carriageReturn && pos + 1 < end && charCodeUnchecked(pos + 1) === CharacterCodes.lineFeed) {
|
|
1346
|
+
pos += 2;
|
|
1347
|
+
}
|
|
1348
|
+
else {
|
|
1349
|
+
pos++;
|
|
1350
|
+
}
|
|
1351
|
+
return token = SyntaxKind.NewLineTrivia;
|
|
1352
|
+
}
|
|
1353
|
+
case CharacterCodes.tab:
|
|
1354
|
+
case CharacterCodes.verticalTab:
|
|
1355
|
+
case CharacterCodes.formFeed:
|
|
1356
|
+
case CharacterCodes.space:
|
|
1357
|
+
case CharacterCodes.nonBreakingSpace:
|
|
1358
|
+
case CharacterCodes.ogham:
|
|
1359
|
+
case CharacterCodes.enQuad:
|
|
1360
|
+
case CharacterCodes.emQuad:
|
|
1361
|
+
case CharacterCodes.enSpace:
|
|
1362
|
+
case CharacterCodes.emSpace:
|
|
1363
|
+
case CharacterCodes.threePerEmSpace:
|
|
1364
|
+
case CharacterCodes.fourPerEmSpace:
|
|
1365
|
+
case CharacterCodes.sixPerEmSpace:
|
|
1366
|
+
case CharacterCodes.figureSpace:
|
|
1367
|
+
case CharacterCodes.punctuationSpace:
|
|
1368
|
+
case CharacterCodes.thinSpace:
|
|
1369
|
+
case CharacterCodes.hairSpace:
|
|
1370
|
+
case CharacterCodes.zeroWidthSpace:
|
|
1371
|
+
case CharacterCodes.narrowNoBreakSpace:
|
|
1372
|
+
case CharacterCodes.mathematicalSpace:
|
|
1373
|
+
case CharacterCodes.ideographicSpace:
|
|
1374
|
+
case CharacterCodes.byteOrderMark:
|
|
1375
|
+
if (skipTrivia) {
|
|
1376
|
+
pos++;
|
|
1377
|
+
continue;
|
|
1378
|
+
}
|
|
1379
|
+
else {
|
|
1380
|
+
while (pos < end && isWhiteSpaceSingleLine(charCodeUnchecked(pos))) {
|
|
1381
|
+
pos++;
|
|
1382
|
+
}
|
|
1383
|
+
return token = SyntaxKind.WhitespaceTrivia;
|
|
1384
|
+
}
|
|
1385
|
+
case CharacterCodes.exclamation:
|
|
1386
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.equals) {
|
|
1387
|
+
if (charCodeUnchecked(pos + 2) === CharacterCodes.equals) {
|
|
1388
|
+
return pos += 3, token = SyntaxKind.ExclamationEqualsEqualsToken;
|
|
1389
|
+
}
|
|
1390
|
+
return pos += 2, token = SyntaxKind.ExclamationEqualsToken;
|
|
1391
|
+
}
|
|
1392
|
+
pos++;
|
|
1393
|
+
return token = SyntaxKind.ExclamationToken;
|
|
1394
|
+
case CharacterCodes.doubleQuote:
|
|
1395
|
+
case CharacterCodes.singleQuote:
|
|
1396
|
+
tokenValue = scanString();
|
|
1397
|
+
return token = SyntaxKind.StringLiteral;
|
|
1398
|
+
case CharacterCodes.backtick:
|
|
1399
|
+
return token = scanTemplateAndSetTokenValue(/*shouldEmitInvalidEscapeError*/ false);
|
|
1400
|
+
case CharacterCodes.percent:
|
|
1401
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.equals) {
|
|
1402
|
+
return pos += 2, token = SyntaxKind.PercentEqualsToken;
|
|
1403
|
+
}
|
|
1404
|
+
pos++;
|
|
1405
|
+
return token = SyntaxKind.PercentToken;
|
|
1406
|
+
case CharacterCodes.ampersand:
|
|
1407
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.ampersand) {
|
|
1408
|
+
if (charCodeUnchecked(pos + 2) === CharacterCodes.equals) {
|
|
1409
|
+
return pos += 3, token = SyntaxKind.AmpersandAmpersandEqualsToken;
|
|
1410
|
+
}
|
|
1411
|
+
return pos += 2, token = SyntaxKind.AmpersandAmpersandToken;
|
|
1412
|
+
}
|
|
1413
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.equals) {
|
|
1414
|
+
return pos += 2, token = SyntaxKind.AmpersandEqualsToken;
|
|
1415
|
+
}
|
|
1416
|
+
pos++;
|
|
1417
|
+
return token = SyntaxKind.AmpersandToken;
|
|
1418
|
+
case CharacterCodes.openParen:
|
|
1419
|
+
pos++;
|
|
1420
|
+
return token = SyntaxKind.OpenParenToken;
|
|
1421
|
+
case CharacterCodes.closeParen:
|
|
1422
|
+
pos++;
|
|
1423
|
+
return token = SyntaxKind.CloseParenToken;
|
|
1424
|
+
case CharacterCodes.asterisk:
|
|
1425
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.equals) {
|
|
1426
|
+
return pos += 2, token = SyntaxKind.AsteriskEqualsToken;
|
|
1427
|
+
}
|
|
1428
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.asterisk) {
|
|
1429
|
+
if (charCodeUnchecked(pos + 2) === CharacterCodes.equals) {
|
|
1430
|
+
return pos += 3, token = SyntaxKind.AsteriskAsteriskEqualsToken;
|
|
1431
|
+
}
|
|
1432
|
+
return pos += 2, token = SyntaxKind.AsteriskAsteriskToken;
|
|
1433
|
+
}
|
|
1434
|
+
pos++;
|
|
1435
|
+
if (skipJsDocLeadingAsterisks &&
|
|
1436
|
+
(tokenFlags & TokenFlags.PrecedingJSDocLeadingAsterisks) === 0 &&
|
|
1437
|
+
(tokenFlags & TokenFlags.PrecedingLineBreak)) {
|
|
1438
|
+
tokenFlags |= TokenFlags.PrecedingJSDocLeadingAsterisks;
|
|
1439
|
+
continue;
|
|
1440
|
+
}
|
|
1441
|
+
return token = SyntaxKind.AsteriskToken;
|
|
1442
|
+
case CharacterCodes.plus:
|
|
1443
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.plus) {
|
|
1444
|
+
return pos += 2, token = SyntaxKind.PlusPlusToken;
|
|
1445
|
+
}
|
|
1446
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.equals) {
|
|
1447
|
+
return pos += 2, token = SyntaxKind.PlusEqualsToken;
|
|
1448
|
+
}
|
|
1449
|
+
pos++;
|
|
1450
|
+
return token = SyntaxKind.PlusToken;
|
|
1451
|
+
case CharacterCodes.comma:
|
|
1452
|
+
pos++;
|
|
1453
|
+
return token = SyntaxKind.CommaToken;
|
|
1454
|
+
case CharacterCodes.minus:
|
|
1455
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.minus) {
|
|
1456
|
+
return pos += 2, token = SyntaxKind.MinusMinusToken;
|
|
1457
|
+
}
|
|
1458
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.equals) {
|
|
1459
|
+
return pos += 2, token = SyntaxKind.MinusEqualsToken;
|
|
1460
|
+
}
|
|
1461
|
+
pos++;
|
|
1462
|
+
return token = SyntaxKind.MinusToken;
|
|
1463
|
+
case CharacterCodes.dot:
|
|
1464
|
+
if (isDigit(charCodeUnchecked(pos + 1))) {
|
|
1465
|
+
scanNumber();
|
|
1466
|
+
return token = SyntaxKind.NumericLiteral;
|
|
1467
|
+
}
|
|
1468
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.dot && charCodeUnchecked(pos + 2) === CharacterCodes.dot) {
|
|
1469
|
+
return pos += 3, token = SyntaxKind.DotDotDotToken;
|
|
1470
|
+
}
|
|
1471
|
+
pos++;
|
|
1472
|
+
return token = SyntaxKind.DotToken;
|
|
1473
|
+
case CharacterCodes.slash:
|
|
1474
|
+
// Single-line comment
|
|
1475
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.slash) {
|
|
1476
|
+
pos += 2;
|
|
1477
|
+
while (pos < end) {
|
|
1478
|
+
if (isLineBreak(charCodeUnchecked(pos))) {
|
|
1479
|
+
break;
|
|
1480
|
+
}
|
|
1481
|
+
pos++;
|
|
1482
|
+
}
|
|
1483
|
+
commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(tokenStart, pos), commentDirectiveRegExSingleLine, tokenStart);
|
|
1484
|
+
if (skipTrivia) {
|
|
1485
|
+
continue;
|
|
1486
|
+
}
|
|
1487
|
+
else {
|
|
1488
|
+
return token = SyntaxKind.SingleLineCommentTrivia;
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
// Multi-line comment
|
|
1492
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.asterisk) {
|
|
1493
|
+
pos += 2;
|
|
1494
|
+
const isJSDoc = charCodeUnchecked(pos) === CharacterCodes.asterisk && charCodeUnchecked(pos + 1) !== CharacterCodes.slash;
|
|
1495
|
+
let commentClosed = false;
|
|
1496
|
+
let lastLineStart = tokenStart;
|
|
1497
|
+
while (pos < end) {
|
|
1498
|
+
const ch = charCodeUnchecked(pos);
|
|
1499
|
+
if (ch === CharacterCodes.asterisk && charCodeUnchecked(pos + 1) === CharacterCodes.slash) {
|
|
1500
|
+
pos += 2;
|
|
1501
|
+
commentClosed = true;
|
|
1502
|
+
break;
|
|
1503
|
+
}
|
|
1504
|
+
pos++;
|
|
1505
|
+
if (isLineBreak(ch)) {
|
|
1506
|
+
lastLineStart = pos;
|
|
1507
|
+
tokenFlags |= TokenFlags.PrecedingLineBreak;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
if (isJSDoc) {
|
|
1511
|
+
tokenFlags |= TokenFlags.PrecedingJSDocComment;
|
|
1512
|
+
tokenFlags = scanJSDocCommentForTags(text.slice(tokenStart, pos), tokenFlags);
|
|
1513
|
+
}
|
|
1514
|
+
commentDirectives = appendIfCommentDirective(commentDirectives, text.slice(lastLineStart, pos), commentDirectiveRegExMultiLine, lastLineStart);
|
|
1515
|
+
if (skipTrivia) {
|
|
1516
|
+
continue;
|
|
1517
|
+
}
|
|
1518
|
+
else {
|
|
1519
|
+
if (!commentClosed) {
|
|
1520
|
+
tokenFlags |= TokenFlags.Unterminated;
|
|
1521
|
+
}
|
|
1522
|
+
return token = SyntaxKind.MultiLineCommentTrivia;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.equals) {
|
|
1526
|
+
return pos += 2, token = SyntaxKind.SlashEqualsToken;
|
|
1527
|
+
}
|
|
1528
|
+
pos++;
|
|
1529
|
+
return token = SyntaxKind.SlashToken;
|
|
1530
|
+
case CharacterCodes._0:
|
|
1531
|
+
if (pos + 2 < end && (charCodeUnchecked(pos + 1) === CharacterCodes.X || charCodeUnchecked(pos + 1) === CharacterCodes.x)) {
|
|
1532
|
+
pos += 2;
|
|
1533
|
+
tokenValue = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ true);
|
|
1534
|
+
if (!tokenValue) {
|
|
1535
|
+
tokenValue = "0";
|
|
1536
|
+
}
|
|
1537
|
+
tokenValue = "0x" + tokenValue;
|
|
1538
|
+
tokenFlags |= TokenFlags.HexSpecifier;
|
|
1539
|
+
return token = checkBigIntSuffix();
|
|
1540
|
+
}
|
|
1541
|
+
else if (pos + 2 < end && (charCodeUnchecked(pos + 1) === CharacterCodes.B || charCodeUnchecked(pos + 1) === CharacterCodes.b)) {
|
|
1542
|
+
pos += 2;
|
|
1543
|
+
tokenValue = scanBinaryOrOctalDigits(2);
|
|
1544
|
+
if (!tokenValue) {
|
|
1545
|
+
tokenValue = "0";
|
|
1546
|
+
}
|
|
1547
|
+
tokenValue = "0b" + tokenValue;
|
|
1548
|
+
tokenFlags |= TokenFlags.BinarySpecifier;
|
|
1549
|
+
return token = checkBigIntSuffix();
|
|
1550
|
+
}
|
|
1551
|
+
else if (pos + 2 < end && (charCodeUnchecked(pos + 1) === CharacterCodes.O || charCodeUnchecked(pos + 1) === CharacterCodes.o)) {
|
|
1552
|
+
pos += 2;
|
|
1553
|
+
tokenValue = scanBinaryOrOctalDigits(8);
|
|
1554
|
+
if (!tokenValue) {
|
|
1555
|
+
tokenValue = "0";
|
|
1556
|
+
}
|
|
1557
|
+
tokenValue = "0o" + tokenValue;
|
|
1558
|
+
tokenFlags |= TokenFlags.OctalSpecifier;
|
|
1559
|
+
return token = checkBigIntSuffix();
|
|
1560
|
+
}
|
|
1561
|
+
// falls through
|
|
1562
|
+
case CharacterCodes._1:
|
|
1563
|
+
case CharacterCodes._2:
|
|
1564
|
+
case CharacterCodes._3:
|
|
1565
|
+
case CharacterCodes._4:
|
|
1566
|
+
case CharacterCodes._5:
|
|
1567
|
+
case CharacterCodes._6:
|
|
1568
|
+
case CharacterCodes._7:
|
|
1569
|
+
case CharacterCodes._8:
|
|
1570
|
+
case CharacterCodes._9:
|
|
1571
|
+
return token = scanNumber();
|
|
1572
|
+
case CharacterCodes.colon:
|
|
1573
|
+
pos++;
|
|
1574
|
+
return token = SyntaxKind.ColonToken;
|
|
1575
|
+
case CharacterCodes.semicolon:
|
|
1576
|
+
pos++;
|
|
1577
|
+
return token = SyntaxKind.SemicolonToken;
|
|
1578
|
+
case CharacterCodes.lessThan:
|
|
1579
|
+
if (isConflictMarkerTrivia(text, pos)) {
|
|
1580
|
+
pos = scanConflictMarkerTrivia(text, pos);
|
|
1581
|
+
if (skipTrivia) {
|
|
1582
|
+
continue;
|
|
1583
|
+
}
|
|
1584
|
+
else {
|
|
1585
|
+
return token = SyntaxKind.ConflictMarkerTrivia;
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.lessThan) {
|
|
1589
|
+
if (charCodeUnchecked(pos + 2) === CharacterCodes.equals) {
|
|
1590
|
+
return pos += 3, token = SyntaxKind.LessThanLessThanEqualsToken;
|
|
1591
|
+
}
|
|
1592
|
+
return pos += 2, token = SyntaxKind.LessThanLessThanToken;
|
|
1593
|
+
}
|
|
1594
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.equals) {
|
|
1595
|
+
return pos += 2, token = SyntaxKind.LessThanEqualsToken;
|
|
1596
|
+
}
|
|
1597
|
+
if (languageVariant === LanguageVariant.JSX &&
|
|
1598
|
+
charCodeUnchecked(pos + 1) === CharacterCodes.slash &&
|
|
1599
|
+
charCodeUnchecked(pos + 2) !== CharacterCodes.asterisk) {
|
|
1600
|
+
return pos += 2, token = SyntaxKind.LessThanSlashToken;
|
|
1601
|
+
}
|
|
1602
|
+
pos++;
|
|
1603
|
+
return token = SyntaxKind.LessThanToken;
|
|
1604
|
+
case CharacterCodes.equals:
|
|
1605
|
+
if (isConflictMarkerTrivia(text, pos)) {
|
|
1606
|
+
pos = scanConflictMarkerTrivia(text, pos);
|
|
1607
|
+
if (skipTrivia) {
|
|
1608
|
+
continue;
|
|
1609
|
+
}
|
|
1610
|
+
else {
|
|
1611
|
+
return token = SyntaxKind.ConflictMarkerTrivia;
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.equals) {
|
|
1615
|
+
if (charCodeUnchecked(pos + 2) === CharacterCodes.equals) {
|
|
1616
|
+
return pos += 3, token = SyntaxKind.EqualsEqualsEqualsToken;
|
|
1617
|
+
}
|
|
1618
|
+
return pos += 2, token = SyntaxKind.EqualsEqualsToken;
|
|
1619
|
+
}
|
|
1620
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.greaterThan) {
|
|
1621
|
+
return pos += 2, token = SyntaxKind.EqualsGreaterThanToken;
|
|
1622
|
+
}
|
|
1623
|
+
pos++;
|
|
1624
|
+
return token = SyntaxKind.EqualsToken;
|
|
1625
|
+
case CharacterCodes.greaterThan:
|
|
1626
|
+
if (isConflictMarkerTrivia(text, pos)) {
|
|
1627
|
+
pos = scanConflictMarkerTrivia(text, pos);
|
|
1628
|
+
if (skipTrivia) {
|
|
1629
|
+
continue;
|
|
1630
|
+
}
|
|
1631
|
+
else {
|
|
1632
|
+
return token = SyntaxKind.ConflictMarkerTrivia;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
pos++;
|
|
1636
|
+
return token = SyntaxKind.GreaterThanToken;
|
|
1637
|
+
case CharacterCodes.question:
|
|
1638
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.dot && !isDigit(charCodeUnchecked(pos + 2))) {
|
|
1639
|
+
return pos += 2, token = SyntaxKind.QuestionDotToken;
|
|
1640
|
+
}
|
|
1641
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.question) {
|
|
1642
|
+
if (charCodeUnchecked(pos + 2) === CharacterCodes.equals) {
|
|
1643
|
+
return pos += 3, token = SyntaxKind.QuestionQuestionEqualsToken;
|
|
1644
|
+
}
|
|
1645
|
+
return pos += 2, token = SyntaxKind.QuestionQuestionToken;
|
|
1646
|
+
}
|
|
1647
|
+
pos++;
|
|
1648
|
+
return token = SyntaxKind.QuestionToken;
|
|
1649
|
+
case CharacterCodes.openBracket:
|
|
1650
|
+
pos++;
|
|
1651
|
+
return token = SyntaxKind.OpenBracketToken;
|
|
1652
|
+
case CharacterCodes.closeBracket:
|
|
1653
|
+
pos++;
|
|
1654
|
+
return token = SyntaxKind.CloseBracketToken;
|
|
1655
|
+
case CharacterCodes.caret:
|
|
1656
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.equals) {
|
|
1657
|
+
return pos += 2, token = SyntaxKind.CaretEqualsToken;
|
|
1658
|
+
}
|
|
1659
|
+
pos++;
|
|
1660
|
+
return token = SyntaxKind.CaretToken;
|
|
1661
|
+
case CharacterCodes.openBrace:
|
|
1662
|
+
pos++;
|
|
1663
|
+
return token = SyntaxKind.OpenBraceToken;
|
|
1664
|
+
case CharacterCodes.bar:
|
|
1665
|
+
if (isConflictMarkerTrivia(text, pos)) {
|
|
1666
|
+
pos = scanConflictMarkerTrivia(text, pos);
|
|
1667
|
+
if (skipTrivia) {
|
|
1668
|
+
continue;
|
|
1669
|
+
}
|
|
1670
|
+
else {
|
|
1671
|
+
return token = SyntaxKind.ConflictMarkerTrivia;
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.bar) {
|
|
1675
|
+
if (charCodeUnchecked(pos + 2) === CharacterCodes.equals) {
|
|
1676
|
+
return pos += 3, token = SyntaxKind.BarBarEqualsToken;
|
|
1677
|
+
}
|
|
1678
|
+
return pos += 2, token = SyntaxKind.BarBarToken;
|
|
1679
|
+
}
|
|
1680
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.equals) {
|
|
1681
|
+
return pos += 2, token = SyntaxKind.BarEqualsToken;
|
|
1682
|
+
}
|
|
1683
|
+
pos++;
|
|
1684
|
+
return token = SyntaxKind.BarToken;
|
|
1685
|
+
case CharacterCodes.closeBrace:
|
|
1686
|
+
pos++;
|
|
1687
|
+
return token = SyntaxKind.CloseBraceToken;
|
|
1688
|
+
case CharacterCodes.tilde:
|
|
1689
|
+
pos++;
|
|
1690
|
+
return token = SyntaxKind.TildeToken;
|
|
1691
|
+
case CharacterCodes.at:
|
|
1692
|
+
pos++;
|
|
1693
|
+
return token = SyntaxKind.AtToken;
|
|
1694
|
+
case CharacterCodes.backslash: {
|
|
1695
|
+
const extendedCookedChar = peekExtendedUnicodeEscape();
|
|
1696
|
+
if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar)) {
|
|
1697
|
+
tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
|
|
1698
|
+
return token = getIdentifierToken();
|
|
1699
|
+
}
|
|
1700
|
+
const cookedChar = peekUnicodeEscape();
|
|
1701
|
+
if (cookedChar >= 0 && isIdentifierStart(cookedChar)) {
|
|
1702
|
+
pos += 6;
|
|
1703
|
+
tokenFlags |= TokenFlags.UnicodeEscape;
|
|
1704
|
+
tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
|
|
1705
|
+
return token = getIdentifierToken();
|
|
1706
|
+
}
|
|
1707
|
+
pos++;
|
|
1708
|
+
return token = SyntaxKind.Unknown;
|
|
1709
|
+
}
|
|
1710
|
+
case CharacterCodes.hash:
|
|
1711
|
+
if (pos !== 0 && text[pos + 1] === "!") {
|
|
1712
|
+
pos++;
|
|
1713
|
+
return token = SyntaxKind.Unknown;
|
|
1714
|
+
}
|
|
1715
|
+
{
|
|
1716
|
+
const charAfterHash = codePointUnchecked(pos + 1);
|
|
1717
|
+
if (charAfterHash === CharacterCodes.backslash) {
|
|
1718
|
+
pos++;
|
|
1719
|
+
const extendedCookedChar = peekExtendedUnicodeEscape();
|
|
1720
|
+
if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar)) {
|
|
1721
|
+
tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts();
|
|
1722
|
+
return token = SyntaxKind.PrivateIdentifier;
|
|
1723
|
+
}
|
|
1724
|
+
const cookedChar = peekUnicodeEscape();
|
|
1725
|
+
if (cookedChar >= 0 && isIdentifierStart(cookedChar)) {
|
|
1726
|
+
pos += 6;
|
|
1727
|
+
tokenFlags |= TokenFlags.UnicodeEscape;
|
|
1728
|
+
tokenValue = "#" + String.fromCharCode(cookedChar) + scanIdentifierParts();
|
|
1729
|
+
return token = SyntaxKind.PrivateIdentifier;
|
|
1730
|
+
}
|
|
1731
|
+
pos--;
|
|
1732
|
+
}
|
|
1733
|
+
if (isIdentifierStart(charAfterHash)) {
|
|
1734
|
+
pos++;
|
|
1735
|
+
scanIdentifier(charAfterHash);
|
|
1736
|
+
}
|
|
1737
|
+
else {
|
|
1738
|
+
tokenValue = "#";
|
|
1739
|
+
}
|
|
1740
|
+
return token = SyntaxKind.PrivateIdentifier;
|
|
1741
|
+
}
|
|
1742
|
+
case CharacterCodes.replacementCharacter:
|
|
1743
|
+
pos = end;
|
|
1744
|
+
return token = SyntaxKind.NonTextFileMarkerTrivia;
|
|
1745
|
+
default: {
|
|
1746
|
+
const identifierKind = scanIdentifier(ch);
|
|
1747
|
+
if (identifierKind) {
|
|
1748
|
+
return token = identifierKind;
|
|
1749
|
+
}
|
|
1750
|
+
else if (isWhiteSpaceSingleLine(ch)) {
|
|
1751
|
+
pos += charSize(ch);
|
|
1752
|
+
continue;
|
|
1753
|
+
}
|
|
1754
|
+
else if (isLineBreak(ch)) {
|
|
1755
|
+
tokenFlags |= TokenFlags.PrecedingLineBreak;
|
|
1756
|
+
pos += charSize(ch);
|
|
1757
|
+
continue;
|
|
1758
|
+
}
|
|
1759
|
+
const size = charSize(ch);
|
|
1760
|
+
pos += size;
|
|
1761
|
+
return token = SyntaxKind.Unknown;
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
function reScanInvalidIdentifier() {
|
|
1767
|
+
pos = tokenStart = fullStartPos;
|
|
1768
|
+
tokenFlags = 0;
|
|
1769
|
+
const ch = codePointUnchecked(pos);
|
|
1770
|
+
const identifierKind = scanIdentifier(ch);
|
|
1771
|
+
if (identifierKind) {
|
|
1772
|
+
return token = identifierKind;
|
|
1773
|
+
}
|
|
1774
|
+
pos += charSize(ch);
|
|
1775
|
+
return token; // Still `SyntaxKind.Unknown`
|
|
1776
|
+
}
|
|
1777
|
+
function scanIdentifier(startCharacter) {
|
|
1778
|
+
let ch = startCharacter;
|
|
1779
|
+
if (isIdentifierStart(ch)) {
|
|
1780
|
+
pos += charSize(ch);
|
|
1781
|
+
while (pos < end && isIdentifierPart(ch = codePointUnchecked(pos)))
|
|
1782
|
+
pos += charSize(ch);
|
|
1783
|
+
tokenValue = text.substring(tokenStart, pos);
|
|
1784
|
+
if (ch === CharacterCodes.backslash) {
|
|
1785
|
+
tokenValue += scanIdentifierParts();
|
|
1786
|
+
}
|
|
1787
|
+
return getIdentifierToken();
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
function reScanGreaterToken() {
|
|
1791
|
+
if (token === SyntaxKind.GreaterThanToken) {
|
|
1792
|
+
if (charCodeUnchecked(pos) === CharacterCodes.greaterThan) {
|
|
1793
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.greaterThan) {
|
|
1794
|
+
if (charCodeUnchecked(pos + 2) === CharacterCodes.equals) {
|
|
1795
|
+
return pos += 3, token = SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken;
|
|
1796
|
+
}
|
|
1797
|
+
return pos += 2, token = SyntaxKind.GreaterThanGreaterThanGreaterThanToken;
|
|
1798
|
+
}
|
|
1799
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.equals) {
|
|
1800
|
+
return pos += 2, token = SyntaxKind.GreaterThanGreaterThanEqualsToken;
|
|
1801
|
+
}
|
|
1802
|
+
pos++;
|
|
1803
|
+
return token = SyntaxKind.GreaterThanGreaterThanToken;
|
|
1804
|
+
}
|
|
1805
|
+
if (charCodeUnchecked(pos) === CharacterCodes.equals) {
|
|
1806
|
+
pos++;
|
|
1807
|
+
return token = SyntaxKind.GreaterThanEqualsToken;
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
return token;
|
|
1811
|
+
}
|
|
1812
|
+
function reScanAsteriskEqualsToken() {
|
|
1813
|
+
pos = tokenStart + 1;
|
|
1814
|
+
return token = SyntaxKind.EqualsToken;
|
|
1815
|
+
}
|
|
1816
|
+
function reScanSlashToken() {
|
|
1817
|
+
if (token === SyntaxKind.SlashToken || token === SyntaxKind.SlashEqualsToken) {
|
|
1818
|
+
const startOfRegExpBody = tokenStart + 1;
|
|
1819
|
+
pos = startOfRegExpBody;
|
|
1820
|
+
let inEscape = false;
|
|
1821
|
+
let inCharacterClass = false;
|
|
1822
|
+
while (true) {
|
|
1823
|
+
const ch = charCodeChecked(pos);
|
|
1824
|
+
if (ch === CharacterCodes.EOF || isLineBreak(ch)) {
|
|
1825
|
+
tokenFlags |= TokenFlags.Unterminated;
|
|
1826
|
+
break;
|
|
1827
|
+
}
|
|
1828
|
+
if (inEscape) {
|
|
1829
|
+
inEscape = false;
|
|
1830
|
+
}
|
|
1831
|
+
else if (ch === CharacterCodes.slash && !inCharacterClass) {
|
|
1832
|
+
break;
|
|
1833
|
+
}
|
|
1834
|
+
else if (ch === CharacterCodes.openBracket) {
|
|
1835
|
+
inCharacterClass = true;
|
|
1836
|
+
}
|
|
1837
|
+
else if (ch === CharacterCodes.backslash) {
|
|
1838
|
+
inEscape = true;
|
|
1839
|
+
}
|
|
1840
|
+
else if (ch === CharacterCodes.closeBracket) {
|
|
1841
|
+
inCharacterClass = false;
|
|
1842
|
+
}
|
|
1843
|
+
pos++;
|
|
1844
|
+
}
|
|
1845
|
+
if (tokenFlags & TokenFlags.Unterminated) {
|
|
1846
|
+
// Find best recovery position
|
|
1847
|
+
pos = startOfRegExpBody;
|
|
1848
|
+
inEscape = false;
|
|
1849
|
+
let characterClassDepth = 0;
|
|
1850
|
+
let inDecimalQuantifier = false;
|
|
1851
|
+
let groupDepth = 0;
|
|
1852
|
+
while (pos < end && !isLineBreak(charCodeUnchecked(pos))) {
|
|
1853
|
+
const ch = charCodeUnchecked(pos);
|
|
1854
|
+
if (inEscape) {
|
|
1855
|
+
inEscape = false;
|
|
1856
|
+
}
|
|
1857
|
+
else if (ch === CharacterCodes.backslash) {
|
|
1858
|
+
inEscape = true;
|
|
1859
|
+
}
|
|
1860
|
+
else if (ch === CharacterCodes.openBracket) {
|
|
1861
|
+
characterClassDepth++;
|
|
1862
|
+
}
|
|
1863
|
+
else if (ch === CharacterCodes.closeBracket && characterClassDepth) {
|
|
1864
|
+
characterClassDepth--;
|
|
1865
|
+
}
|
|
1866
|
+
else if (!characterClassDepth) {
|
|
1867
|
+
if (ch === CharacterCodes.openBrace) {
|
|
1868
|
+
inDecimalQuantifier = true;
|
|
1869
|
+
}
|
|
1870
|
+
else if (ch === CharacterCodes.closeBrace && inDecimalQuantifier) {
|
|
1871
|
+
inDecimalQuantifier = false;
|
|
1872
|
+
}
|
|
1873
|
+
else if (!inDecimalQuantifier) {
|
|
1874
|
+
if (ch === CharacterCodes.openParen) {
|
|
1875
|
+
groupDepth++;
|
|
1876
|
+
}
|
|
1877
|
+
else if (ch === CharacterCodes.closeParen && groupDepth) {
|
|
1878
|
+
groupDepth--;
|
|
1879
|
+
}
|
|
1880
|
+
else if (ch === CharacterCodes.closeParen || ch === CharacterCodes.closeBracket || ch === CharacterCodes.closeBrace) {
|
|
1881
|
+
break;
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
pos++;
|
|
1886
|
+
}
|
|
1887
|
+
while (isWhiteSpaceLike(charCodeChecked(pos - 1)) || charCodeChecked(pos - 1) === CharacterCodes.semicolon)
|
|
1888
|
+
pos--;
|
|
1889
|
+
}
|
|
1890
|
+
else {
|
|
1891
|
+
pos++;
|
|
1892
|
+
let regExpFlags = RegularExpressionFlags.None;
|
|
1893
|
+
while (true) {
|
|
1894
|
+
const ch = codePointChecked(pos);
|
|
1895
|
+
if (ch === CharacterCodes.EOF || !isIdentifierPart(ch)) {
|
|
1896
|
+
break;
|
|
1897
|
+
}
|
|
1898
|
+
const size = charSize(ch);
|
|
1899
|
+
const flag = characterCodeToRegularExpressionFlag(ch);
|
|
1900
|
+
if (flag !== undefined) {
|
|
1901
|
+
regExpFlags |= flag;
|
|
1902
|
+
}
|
|
1903
|
+
pos += size;
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
tokenValue = text.substring(tokenStart, pos);
|
|
1907
|
+
token = SyntaxKind.RegularExpressionLiteral;
|
|
1908
|
+
}
|
|
1909
|
+
return token;
|
|
1910
|
+
}
|
|
1911
|
+
function appendIfCommentDirective(commentDirectives, text, commentDirectiveRegEx, lineStart) {
|
|
1912
|
+
const type = getDirectiveFromComment(text.trimStart(), commentDirectiveRegEx);
|
|
1913
|
+
if (type === undefined) {
|
|
1914
|
+
return commentDirectives;
|
|
1915
|
+
}
|
|
1916
|
+
if (!commentDirectives) {
|
|
1917
|
+
commentDirectives = [];
|
|
1918
|
+
}
|
|
1919
|
+
commentDirectives.push({
|
|
1920
|
+
range: { pos: lineStart, end: pos },
|
|
1921
|
+
type,
|
|
1922
|
+
});
|
|
1923
|
+
return commentDirectives;
|
|
1924
|
+
}
|
|
1925
|
+
function getDirectiveFromComment(text, commentDirectiveRegEx) {
|
|
1926
|
+
const match = commentDirectiveRegEx.exec(text);
|
|
1927
|
+
if (!match) {
|
|
1928
|
+
return undefined;
|
|
1929
|
+
}
|
|
1930
|
+
switch (match[1]) {
|
|
1931
|
+
case "ts-expect-error":
|
|
1932
|
+
return CommentDirectiveType.ExpectError;
|
|
1933
|
+
case "ts-ignore":
|
|
1934
|
+
return CommentDirectiveType.Ignore;
|
|
1935
|
+
}
|
|
1936
|
+
return undefined;
|
|
1937
|
+
}
|
|
1938
|
+
function reScanTemplateToken(isTaggedTemplate) {
|
|
1939
|
+
pos = tokenStart;
|
|
1940
|
+
return token = scanTemplateAndSetTokenValue(!isTaggedTemplate);
|
|
1941
|
+
}
|
|
1942
|
+
function reScanTemplateHeadOrNoSubstitutionTemplate() {
|
|
1943
|
+
pos = tokenStart;
|
|
1944
|
+
return token = scanTemplateAndSetTokenValue(/*shouldEmitInvalidEscapeError*/ true);
|
|
1945
|
+
}
|
|
1946
|
+
function reScanJsxToken(allowMultilineJsxText = true) {
|
|
1947
|
+
pos = tokenStart = fullStartPos;
|
|
1948
|
+
return token = scanJsxToken(allowMultilineJsxText);
|
|
1949
|
+
}
|
|
1950
|
+
function reScanLessThanToken() {
|
|
1951
|
+
if (token === SyntaxKind.LessThanLessThanToken) {
|
|
1952
|
+
pos = tokenStart + 1;
|
|
1953
|
+
return token = SyntaxKind.LessThanToken;
|
|
1954
|
+
}
|
|
1955
|
+
return token;
|
|
1956
|
+
}
|
|
1957
|
+
function reScanHashToken() {
|
|
1958
|
+
if (token === SyntaxKind.PrivateIdentifier) {
|
|
1959
|
+
pos = tokenStart + 1;
|
|
1960
|
+
return token = SyntaxKind.HashToken;
|
|
1961
|
+
}
|
|
1962
|
+
return token;
|
|
1963
|
+
}
|
|
1964
|
+
function reScanQuestionToken() {
|
|
1965
|
+
pos = tokenStart + 1;
|
|
1966
|
+
return token = SyntaxKind.QuestionToken;
|
|
1967
|
+
}
|
|
1968
|
+
function scanJsxToken(allowMultilineJsxText = true) {
|
|
1969
|
+
fullStartPos = tokenStart = pos;
|
|
1970
|
+
if (pos >= end) {
|
|
1971
|
+
return token = SyntaxKind.EndOfFile;
|
|
1972
|
+
}
|
|
1973
|
+
let char = charCodeUnchecked(pos);
|
|
1974
|
+
if (char === CharacterCodes.lessThan) {
|
|
1975
|
+
if (charCodeUnchecked(pos + 1) === CharacterCodes.slash) {
|
|
1976
|
+
pos += 2;
|
|
1977
|
+
return token = SyntaxKind.LessThanSlashToken;
|
|
1978
|
+
}
|
|
1979
|
+
pos++;
|
|
1980
|
+
return token = SyntaxKind.LessThanToken;
|
|
1981
|
+
}
|
|
1982
|
+
if (char === CharacterCodes.openBrace) {
|
|
1983
|
+
pos++;
|
|
1984
|
+
return token = SyntaxKind.OpenBraceToken;
|
|
1985
|
+
}
|
|
1986
|
+
let firstNonWhitespace = 0;
|
|
1987
|
+
while (pos < end) {
|
|
1988
|
+
char = charCodeUnchecked(pos);
|
|
1989
|
+
if (char === CharacterCodes.openBrace) {
|
|
1990
|
+
break;
|
|
1991
|
+
}
|
|
1992
|
+
if (char === CharacterCodes.lessThan) {
|
|
1993
|
+
if (isConflictMarkerTrivia(text, pos)) {
|
|
1994
|
+
pos = scanConflictMarkerTrivia(text, pos);
|
|
1995
|
+
return token = SyntaxKind.ConflictMarkerTrivia;
|
|
1996
|
+
}
|
|
1997
|
+
break;
|
|
1998
|
+
}
|
|
1999
|
+
if (isLineBreak(char) && firstNonWhitespace === 0) {
|
|
2000
|
+
firstNonWhitespace = -1;
|
|
2001
|
+
}
|
|
2002
|
+
else if (!allowMultilineJsxText && isLineBreak(char) && firstNonWhitespace > 0) {
|
|
2003
|
+
break;
|
|
2004
|
+
}
|
|
2005
|
+
else if (!isWhiteSpaceLike(char)) {
|
|
2006
|
+
firstNonWhitespace = pos;
|
|
2007
|
+
}
|
|
2008
|
+
pos++;
|
|
2009
|
+
}
|
|
2010
|
+
tokenValue = text.substring(fullStartPos, pos);
|
|
2011
|
+
return firstNonWhitespace === -1 ? SyntaxKind.JsxTextAllWhiteSpaces : SyntaxKind.JsxText;
|
|
2012
|
+
}
|
|
2013
|
+
function scanJsxIdentifier() {
|
|
2014
|
+
if (tokenIsIdentifierOrKeyword(token)) {
|
|
2015
|
+
while (pos < end) {
|
|
2016
|
+
const ch = charCodeUnchecked(pos);
|
|
2017
|
+
if (ch === CharacterCodes.minus) {
|
|
2018
|
+
tokenValue += "-";
|
|
2019
|
+
pos++;
|
|
2020
|
+
continue;
|
|
2021
|
+
}
|
|
2022
|
+
const oldPos = pos;
|
|
2023
|
+
tokenValue += scanIdentifierParts();
|
|
2024
|
+
if (pos === oldPos) {
|
|
2025
|
+
break;
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
return getIdentifierToken();
|
|
2029
|
+
}
|
|
2030
|
+
return token;
|
|
2031
|
+
}
|
|
2032
|
+
function scanJsxAttributeValue() {
|
|
2033
|
+
fullStartPos = pos;
|
|
2034
|
+
switch (charCodeUnchecked(pos)) {
|
|
2035
|
+
case CharacterCodes.doubleQuote:
|
|
2036
|
+
case CharacterCodes.singleQuote:
|
|
2037
|
+
tokenValue = scanString(/*jsxAttributeString*/ true);
|
|
2038
|
+
return token = SyntaxKind.StringLiteral;
|
|
2039
|
+
default:
|
|
2040
|
+
return scan();
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
function reScanJsxAttributeValue() {
|
|
2044
|
+
pos = tokenStart = fullStartPos;
|
|
2045
|
+
return scanJsxAttributeValue();
|
|
2046
|
+
}
|
|
2047
|
+
function scanJSDocCommentTextToken(inBackticks) {
|
|
2048
|
+
fullStartPos = tokenStart = pos;
|
|
2049
|
+
tokenFlags = TokenFlags.None;
|
|
2050
|
+
if (pos >= end) {
|
|
2051
|
+
return token = SyntaxKind.EndOfFile;
|
|
2052
|
+
}
|
|
2053
|
+
for (let ch = charCodeUnchecked(pos); pos < end && (!isLineBreak(ch) && ch !== CharacterCodes.backtick); ch = codePointUnchecked(++pos)) {
|
|
2054
|
+
if (!inBackticks) {
|
|
2055
|
+
if (ch === CharacterCodes.openBrace) {
|
|
2056
|
+
break;
|
|
2057
|
+
}
|
|
2058
|
+
else if (ch === CharacterCodes.at
|
|
2059
|
+
&& pos - 1 >= 0 && isWhiteSpaceSingleLine(charCodeUnchecked(pos - 1))
|
|
2060
|
+
&& pos + 1 < end && isIdentifierStart(charCodeUnchecked(pos + 1))) {
|
|
2061
|
+
break;
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
if (pos === tokenStart) {
|
|
2066
|
+
return scanJsDocToken();
|
|
2067
|
+
}
|
|
2068
|
+
tokenValue = text.substring(tokenStart, pos);
|
|
2069
|
+
return token = SyntaxKind.JSDocCommentTextToken;
|
|
2070
|
+
}
|
|
2071
|
+
function scanJsDocToken() {
|
|
2072
|
+
fullStartPos = tokenStart = pos;
|
|
2073
|
+
tokenFlags = TokenFlags.None;
|
|
2074
|
+
if (pos >= end) {
|
|
2075
|
+
return token = SyntaxKind.EndOfFile;
|
|
2076
|
+
}
|
|
2077
|
+
const ch = codePointUnchecked(pos);
|
|
2078
|
+
pos += charSize(ch);
|
|
2079
|
+
switch (ch) {
|
|
2080
|
+
case CharacterCodes.tab:
|
|
2081
|
+
case CharacterCodes.verticalTab:
|
|
2082
|
+
case CharacterCodes.formFeed:
|
|
2083
|
+
case CharacterCodes.space:
|
|
2084
|
+
while (pos < end && isWhiteSpaceSingleLine(charCodeUnchecked(pos))) {
|
|
2085
|
+
pos++;
|
|
2086
|
+
}
|
|
2087
|
+
return token = SyntaxKind.WhitespaceTrivia;
|
|
2088
|
+
case CharacterCodes.at:
|
|
2089
|
+
return token = SyntaxKind.AtToken;
|
|
2090
|
+
case CharacterCodes.carriageReturn:
|
|
2091
|
+
if (charCodeUnchecked(pos) === CharacterCodes.lineFeed) {
|
|
2092
|
+
pos++;
|
|
2093
|
+
}
|
|
2094
|
+
// falls through
|
|
2095
|
+
case CharacterCodes.lineFeed:
|
|
2096
|
+
tokenFlags |= TokenFlags.PrecedingLineBreak;
|
|
2097
|
+
return token = SyntaxKind.NewLineTrivia;
|
|
2098
|
+
case CharacterCodes.asterisk:
|
|
2099
|
+
return token = SyntaxKind.AsteriskToken;
|
|
2100
|
+
case CharacterCodes.openBrace:
|
|
2101
|
+
return token = SyntaxKind.OpenBraceToken;
|
|
2102
|
+
case CharacterCodes.closeBrace:
|
|
2103
|
+
return token = SyntaxKind.CloseBraceToken;
|
|
2104
|
+
case CharacterCodes.openBracket:
|
|
2105
|
+
return token = SyntaxKind.OpenBracketToken;
|
|
2106
|
+
case CharacterCodes.closeBracket:
|
|
2107
|
+
return token = SyntaxKind.CloseBracketToken;
|
|
2108
|
+
case CharacterCodes.openParen:
|
|
2109
|
+
return token = SyntaxKind.OpenParenToken;
|
|
2110
|
+
case CharacterCodes.closeParen:
|
|
2111
|
+
return token = SyntaxKind.CloseParenToken;
|
|
2112
|
+
case CharacterCodes.lessThan:
|
|
2113
|
+
return token = SyntaxKind.LessThanToken;
|
|
2114
|
+
case CharacterCodes.greaterThan:
|
|
2115
|
+
return token = SyntaxKind.GreaterThanToken;
|
|
2116
|
+
case CharacterCodes.equals:
|
|
2117
|
+
return token = SyntaxKind.EqualsToken;
|
|
2118
|
+
case CharacterCodes.comma:
|
|
2119
|
+
return token = SyntaxKind.CommaToken;
|
|
2120
|
+
case CharacterCodes.dot:
|
|
2121
|
+
return token = SyntaxKind.DotToken;
|
|
2122
|
+
case CharacterCodes.backtick:
|
|
2123
|
+
return token = SyntaxKind.BacktickToken;
|
|
2124
|
+
case CharacterCodes.hash:
|
|
2125
|
+
return token = SyntaxKind.HashToken;
|
|
2126
|
+
case CharacterCodes.backslash:
|
|
2127
|
+
pos--;
|
|
2128
|
+
{
|
|
2129
|
+
const extendedCookedChar = peekExtendedUnicodeEscape();
|
|
2130
|
+
if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar)) {
|
|
2131
|
+
tokenValue = scanExtendedUnicodeEscape() + scanIdentifierParts();
|
|
2132
|
+
return token = getIdentifierToken();
|
|
2133
|
+
}
|
|
2134
|
+
const cookedChar = peekUnicodeEscape();
|
|
2135
|
+
if (cookedChar >= 0 && isIdentifierStart(cookedChar)) {
|
|
2136
|
+
pos += 6;
|
|
2137
|
+
tokenFlags |= TokenFlags.UnicodeEscape;
|
|
2138
|
+
tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts();
|
|
2139
|
+
return token = getIdentifierToken();
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
pos++;
|
|
2143
|
+
return token = SyntaxKind.Unknown;
|
|
2144
|
+
}
|
|
2145
|
+
if (isIdentifierStart(ch)) {
|
|
2146
|
+
let char = ch;
|
|
2147
|
+
while (pos < end && isIdentifierPart(char = codePointUnchecked(pos)) || char === CharacterCodes.minus)
|
|
2148
|
+
pos += charSize(char);
|
|
2149
|
+
tokenValue = text.substring(tokenStart, pos);
|
|
2150
|
+
if (char === CharacterCodes.backslash) {
|
|
2151
|
+
tokenValue += scanIdentifierParts();
|
|
2152
|
+
}
|
|
2153
|
+
return token = getIdentifierToken();
|
|
2154
|
+
}
|
|
2155
|
+
else {
|
|
2156
|
+
return token = SyntaxKind.Unknown;
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
function speculationHelper(callback, isLookahead) {
|
|
2160
|
+
const savePos = pos;
|
|
2161
|
+
const saveStartPos = fullStartPos;
|
|
2162
|
+
const saveTokenPos = tokenStart;
|
|
2163
|
+
const saveToken = token;
|
|
2164
|
+
const saveTokenValue = tokenValue;
|
|
2165
|
+
const saveTokenFlags = tokenFlags;
|
|
2166
|
+
const result = callback();
|
|
2167
|
+
if (!result || isLookahead) {
|
|
2168
|
+
pos = savePos;
|
|
2169
|
+
fullStartPos = saveStartPos;
|
|
2170
|
+
tokenStart = saveTokenPos;
|
|
2171
|
+
token = saveToken;
|
|
2172
|
+
tokenValue = saveTokenValue;
|
|
2173
|
+
tokenFlags = saveTokenFlags;
|
|
2174
|
+
}
|
|
2175
|
+
return result;
|
|
2176
|
+
}
|
|
2177
|
+
function scanRange(start, length, callback) {
|
|
2178
|
+
const saveEnd = end;
|
|
2179
|
+
const savePos = pos;
|
|
2180
|
+
const saveStartPos = fullStartPos;
|
|
2181
|
+
const saveTokenPos = tokenStart;
|
|
2182
|
+
const saveToken = token;
|
|
2183
|
+
const saveTokenValue = tokenValue;
|
|
2184
|
+
const saveTokenFlags = tokenFlags;
|
|
2185
|
+
const saveErrorExpectations = commentDirectives;
|
|
2186
|
+
setText(text, start, length);
|
|
2187
|
+
const result = callback();
|
|
2188
|
+
end = saveEnd;
|
|
2189
|
+
pos = savePos;
|
|
2190
|
+
fullStartPos = saveStartPos;
|
|
2191
|
+
tokenStart = saveTokenPos;
|
|
2192
|
+
token = saveToken;
|
|
2193
|
+
tokenValue = saveTokenValue;
|
|
2194
|
+
tokenFlags = saveTokenFlags;
|
|
2195
|
+
commentDirectives = saveErrorExpectations;
|
|
2196
|
+
return result;
|
|
2197
|
+
}
|
|
2198
|
+
function lookAhead(callback) {
|
|
2199
|
+
return speculationHelper(callback, /*isLookahead*/ true);
|
|
2200
|
+
}
|
|
2201
|
+
function tryScan(callback) {
|
|
2202
|
+
return speculationHelper(callback, /*isLookahead*/ false);
|
|
2203
|
+
}
|
|
2204
|
+
function getText() {
|
|
2205
|
+
return text;
|
|
2206
|
+
}
|
|
2207
|
+
function clearCommentDirectives() {
|
|
2208
|
+
commentDirectives = undefined;
|
|
2209
|
+
}
|
|
2210
|
+
function setText(newText, start, length) {
|
|
2211
|
+
text = newText || "";
|
|
2212
|
+
end = length === undefined ? text.length : start + length;
|
|
2213
|
+
resetTokenState(start || 0);
|
|
2214
|
+
}
|
|
2215
|
+
function setLanguageVariant(variant) {
|
|
2216
|
+
languageVariant = variant;
|
|
2217
|
+
}
|
|
2218
|
+
function resetTokenState(position) {
|
|
2219
|
+
pos = position;
|
|
2220
|
+
fullStartPos = position;
|
|
2221
|
+
tokenStart = position;
|
|
2222
|
+
token = SyntaxKind.Unknown;
|
|
2223
|
+
tokenValue = undefined;
|
|
2224
|
+
tokenFlags = TokenFlags.None;
|
|
2225
|
+
}
|
|
2226
|
+
function setSkipJsDocLeadingAsterisks(skip) {
|
|
2227
|
+
skipJsDocLeadingAsterisks += skip ? 1 : -1;
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
//# sourceMappingURL=scanner.js.map
|