@zzzen/pyright-internal 1.2.0-dev.20231112 → 1.2.0-dev.20231126
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/dist/analyzer/analysis.d.ts +1 -1
- package/dist/analyzer/analysis.js +5 -1
- package/dist/analyzer/analysis.js.map +1 -1
- package/dist/analyzer/analyzerFileInfo.d.ts +1 -1
- package/dist/analyzer/analyzerNodeInfo.d.ts +1 -1
- package/dist/analyzer/analyzerNodeInfo.js +1 -1
- package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.d.ts +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.js +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
- package/dist/analyzer/binder.js +198 -194
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/cacheManager.js +1 -1
- package/dist/analyzer/cacheManager.js.map +1 -1
- package/dist/analyzer/checker.d.ts +1 -0
- package/dist/analyzer/checker.js +286 -256
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.d.ts +1 -1
- package/dist/analyzer/codeFlowEngine.js +26 -26
- package/dist/analyzer/codeFlowEngine.js.map +1 -1
- package/dist/analyzer/codeFlowTypes.d.ts +1 -1
- package/dist/analyzer/codeFlowTypes.js +23 -23
- package/dist/analyzer/codeFlowTypes.js.map +1 -1
- package/dist/analyzer/codeFlowUtils.js +39 -37
- package/dist/analyzer/codeFlowUtils.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +48 -45
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/constructorTransform.js +8 -8
- package/dist/analyzer/constructorTransform.js.map +1 -1
- package/dist/analyzer/constructors.js +33 -31
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.js +67 -63
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/declaration.d.ts +2 -2
- package/dist/analyzer/declaration.js +10 -10
- package/dist/analyzer/declaration.js.map +1 -1
- package/dist/analyzer/declarationUtils.js +44 -41
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/decorators.js +51 -51
- package/dist/analyzer/decorators.js.map +1 -1
- package/dist/analyzer/docStringConversion.js +1 -1
- package/dist/analyzer/docStringConversion.js.map +1 -1
- package/dist/analyzer/docStringUtils.js +1 -1
- package/dist/analyzer/enums.js +27 -27
- package/dist/analyzer/enums.js.map +1 -1
- package/dist/analyzer/functionTransform.js +4 -4
- package/dist/analyzer/functionTransform.js.map +1 -1
- package/dist/analyzer/importResolver.d.ts +1 -1
- package/dist/analyzer/importResolver.js +27 -18
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/importResult.js +1 -1
- package/dist/analyzer/importResult.js.map +1 -1
- package/dist/analyzer/importStatementUtils.js +31 -27
- package/dist/analyzer/importStatementUtils.js.map +1 -1
- package/dist/analyzer/namedTuples.js +36 -32
- package/dist/analyzer/namedTuples.js.map +1 -1
- package/dist/analyzer/operations.js +78 -78
- package/dist/analyzer/operations.js.map +1 -1
- package/dist/analyzer/packageTypeReport.d.ts +1 -1
- package/dist/analyzer/packageTypeReport.js +2 -2
- package/dist/analyzer/packageTypeReport.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +90 -90
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/parameterUtils.js +14 -14
- package/dist/analyzer/parameterUtils.js.map +1 -1
- package/dist/analyzer/parentDirectoryCache.d.ts +2 -2
- package/dist/analyzer/parseTreeCleaner.js +5 -1
- package/dist/analyzer/parseTreeCleaner.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +1 -1
- package/dist/analyzer/parseTreeUtils.js +383 -379
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/parseTreeWalker.js +161 -157
- package/dist/analyzer/parseTreeWalker.js.map +1 -1
- package/dist/analyzer/patternMatching.d.ts +1 -1
- package/dist/analyzer/patternMatching.js +71 -64
- package/dist/analyzer/patternMatching.js.map +1 -1
- package/dist/analyzer/program.d.ts +1 -1
- package/dist/analyzer/program.js +20 -17
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/properties.js +53 -44
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.js +14 -14
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/pythonPathUtils.js +5 -1
- package/dist/analyzer/pythonPathUtils.js.map +1 -1
- package/dist/analyzer/regions.js +3 -3
- package/dist/analyzer/regions.js.map +1 -1
- package/dist/analyzer/scope.js +8 -8
- package/dist/analyzer/scope.js.map +1 -1
- package/dist/analyzer/scopeUtils.js +1 -1
- package/dist/analyzer/scopeUtils.js.map +1 -1
- package/dist/analyzer/service.js +5 -1
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.js +25 -21
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/sourceMapper.d.ts +2 -2
- package/dist/analyzer/sourceMapper.js +15 -8
- package/dist/analyzer/sourceMapper.js.map +1 -1
- package/dist/analyzer/staticExpressions.js +40 -40
- package/dist/analyzer/staticExpressions.js.map +1 -1
- package/dist/analyzer/symbol.d.ts +1 -1
- package/dist/analyzer/symbol.js +26 -26
- package/dist/analyzer/symbol.js.map +1 -1
- package/dist/analyzer/symbolUtils.js +1 -1
- package/dist/analyzer/symbolUtils.js.map +1 -1
- package/dist/analyzer/testWalker.js +5 -5
- package/dist/analyzer/testWalker.js.map +1 -1
- package/dist/analyzer/tracePrinter.d.ts +1 -1
- package/dist/analyzer/tracePrinter.js +35 -31
- package/dist/analyzer/tracePrinter.js.map +1 -1
- package/dist/analyzer/typeCacheUtils.js +5 -1
- package/dist/analyzer/typeCacheUtils.js.map +1 -1
- package/dist/analyzer/typeDocStringUtils.js +13 -9
- package/dist/analyzer/typeDocStringUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +1272 -1176
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +3 -1
- package/dist/analyzer/typeEvaluatorTypes.js +3 -1
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
- package/dist/analyzer/typeGuards.d.ts +1 -1
- package/dist/analyzer/typeGuards.js +95 -67
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typePrinter.d.ts +1 -1
- package/dist/analyzer/typePrinter.js +80 -76
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeStubWriter.js +26 -22
- package/dist/analyzer/typeStubWriter.js.map +1 -1
- package/dist/analyzer/typeUtils.js +163 -123
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typeVarContext.d.ts +1 -0
- package/dist/analyzer/typeVarContext.js +12 -9
- package/dist/analyzer/typeVarContext.js.map +1 -1
- package/dist/analyzer/typeWalker.js +10 -10
- package/dist/analyzer/typedDicts.js +74 -70
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +17 -12
- package/dist/analyzer/types.js +191 -181
- package/dist/analyzer/types.js.map +1 -1
- package/dist/backgroundAnalysisBase.d.ts +2 -2
- package/dist/backgroundAnalysisBase.js +5 -1
- package/dist/backgroundAnalysisBase.js.map +1 -1
- package/dist/backgroundThreadBase.js +5 -1
- package/dist/backgroundThreadBase.js.map +1 -1
- package/dist/commands/commandController.js +7 -7
- package/dist/commands/commandController.js.map +1 -1
- package/dist/commands/commandResult.js +1 -1
- package/dist/commands/commandResult.js.map +1 -1
- package/dist/commands/commands.js +1 -1
- package/dist/commands/commands.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js +196 -196
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
- package/dist/commands/quickActionCommand.js +1 -1
- package/dist/commands/quickActionCommand.js.map +1 -1
- package/dist/common/charCodes.js +1 -1
- package/dist/common/charCodes.js.map +1 -1
- package/dist/common/chokidarFileWatcherProvider.js +5 -1
- package/dist/common/chokidarFileWatcherProvider.js.map +1 -1
- package/dist/common/collectionUtils.d.ts +3 -3
- package/dist/common/collectionUtils.js +3 -3
- package/dist/common/collectionUtils.js.map +1 -1
- package/dist/common/commandLineOptions.d.ts +1 -1
- package/dist/common/commandLineOptions.js +5 -5
- package/dist/common/commandLineOptions.js.map +1 -1
- package/dist/common/configOptions.d.ts +1 -1
- package/dist/common/configOptions.js +11 -7
- package/dist/common/configOptions.js.map +1 -1
- package/dist/common/console.js +7 -3
- package/dist/common/console.js.map +1 -1
- package/dist/common/core.d.ts +2 -2
- package/dist/common/core.js +6 -6
- package/dist/common/core.js.map +1 -1
- package/dist/common/diagnostic.js +6 -6
- package/dist/common/diagnostic.js.map +1 -1
- package/dist/common/diagnosticRules.js +1 -1
- package/dist/common/diagnosticRules.js.map +1 -1
- package/dist/common/diagnosticSink.js +12 -12
- package/dist/common/diagnosticSink.js.map +1 -1
- package/dist/common/editAction.d.ts +1 -1
- package/dist/common/editAction.js +2 -2
- package/dist/common/editAction.js.map +1 -1
- package/dist/common/envVarUtils.js +5 -1
- package/dist/common/envVarUtils.js.map +1 -1
- package/dist/common/extensibility.js +1 -1
- package/dist/common/extensibility.js.map +1 -1
- package/dist/common/fileBasedCancellationUtils.js +5 -1
- package/dist/common/fileBasedCancellationUtils.js.map +1 -1
- package/dist/common/fileSystem.d.ts +1 -0
- package/dist/common/fileSystem.js +2 -2
- package/dist/common/fileSystem.js.map +1 -1
- package/dist/common/fileWatcher.d.ts +2 -2
- package/dist/common/fullAccessHost.js +10 -6
- package/dist/common/fullAccessHost.js.map +1 -1
- package/dist/common/host.d.ts +1 -1
- package/dist/common/host.js +2 -2
- package/dist/common/host.js.map +1 -1
- package/dist/common/lspUtils.js +7 -7
- package/dist/common/lspUtils.js.map +1 -1
- package/dist/common/memUtils.d.ts +1 -1
- package/dist/common/pathUtils.js +12 -8
- package/dist/common/pathUtils.js.map +1 -1
- package/dist/common/pythonVersion.js +1 -1
- package/dist/common/pythonVersion.js.map +1 -1
- package/dist/common/realFileSystem.js +5 -1
- package/dist/common/realFileSystem.js.map +1 -1
- package/dist/common/serviceProvider.d.ts +1 -1
- package/dist/common/serviceProvider.js +5 -1
- package/dist/common/serviceProvider.js.map +1 -1
- package/dist/common/serviceProviderExtensions.js +1 -1
- package/dist/common/serviceProviderExtensions.js.map +1 -1
- package/dist/common/stringUtils.js +5 -5
- package/dist/common/stringUtils.js.map +1 -1
- package/dist/common/textEditTracker.js +11 -7
- package/dist/common/textEditTracker.js.map +1 -1
- package/dist/common/textRange.js +3 -3
- package/dist/common/textRange.js.map +1 -1
- package/dist/languageServerBase.d.ts +3 -3
- package/dist/languageServerBase.js +19 -19
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/autoImporter.d.ts +3 -3
- package/dist/languageService/autoImporter.js +12 -8
- package/dist/languageService/autoImporter.js.map +1 -1
- package/dist/languageService/callHierarchyProvider.js +27 -23
- package/dist/languageService/callHierarchyProvider.js.map +1 -1
- package/dist/languageService/codeActionProvider.js +8 -8
- package/dist/languageService/codeActionProvider.js.map +1 -1
- package/dist/languageService/completionProvider.js +171 -173
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/completionProviderUtils.js +9 -9
- package/dist/languageService/completionProviderUtils.js.map +1 -1
- package/dist/languageService/definitionProvider.js +14 -10
- package/dist/languageService/definitionProvider.js.map +1 -1
- package/dist/languageService/documentHighlightProvider.js +7 -3
- package/dist/languageService/documentHighlightProvider.js.map +1 -1
- package/dist/languageService/documentSymbolCollector.d.ts +1 -1
- package/dist/languageService/documentSymbolCollector.js +21 -17
- package/dist/languageService/documentSymbolCollector.js.map +1 -1
- package/dist/languageService/hoverProvider.js +30 -26
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/importSorter.js +1 -1
- package/dist/languageService/importSorter.js.map +1 -1
- package/dist/languageService/quickActions.js +10 -6
- package/dist/languageService/quickActions.js.map +1 -1
- package/dist/languageService/referencesProvider.d.ts +1 -1
- package/dist/languageService/referencesProvider.js +24 -20
- package/dist/languageService/referencesProvider.js.map +1 -1
- package/dist/languageService/signatureHelpProvider.js +8 -4
- package/dist/languageService/signatureHelpProvider.js.map +1 -1
- package/dist/languageService/symbolIndexer.js +8 -4
- package/dist/languageService/symbolIndexer.js.map +1 -1
- package/dist/languageService/tooltipUtils.js +20 -16
- package/dist/languageService/tooltipUtils.js.map +1 -1
- package/dist/languageService/workspaceSymbolProvider.js +5 -1
- package/dist/languageService/workspaceSymbolProvider.js.map +1 -1
- package/dist/localization/localize.d.ts +10 -12
- package/dist/localization/localize.js +8 -5
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.cs.json +5 -8
- package/dist/localization/package.nls.de.json +5 -8
- package/dist/localization/package.nls.en-us.json +12 -9
- package/dist/localization/package.nls.es.json +5 -8
- package/dist/localization/package.nls.fr.json +5 -8
- package/dist/localization/package.nls.it.json +5 -8
- package/dist/localization/package.nls.ja.json +5 -8
- package/dist/localization/package.nls.ko.json +5 -8
- package/dist/localization/package.nls.pl.json +5 -8
- package/dist/localization/package.nls.pt-br.json +5 -8
- package/dist/localization/package.nls.qps-ploc.json +2 -5
- package/dist/localization/package.nls.ru.json +5 -8
- package/dist/localization/package.nls.tr.json +5 -8
- package/dist/localization/package.nls.zh-cn.json +5 -8
- package/dist/localization/package.nls.zh-tw.json +5 -8
- package/dist/parser/characterStream.js +3 -3
- package/dist/parser/characterStream.js.map +1 -1
- package/dist/parser/characters.js +13 -9
- package/dist/parser/characters.js.map +1 -1
- package/dist/parser/parseNodes.d.ts +12 -12
- package/dist/parser/parseNodes.js +193 -193
- package/dist/parser/parseNodes.js.map +1 -1
- package/dist/parser/parser.js +563 -559
- package/dist/parser/parser.js.map +1 -1
- package/dist/parser/stringTokenUtils.js +47 -47
- package/dist/parser/stringTokenUtils.js.map +1 -1
- package/dist/parser/tokenizer.js +288 -288
- package/dist/parser/tokenizer.js.map +1 -1
- package/dist/parser/tokenizerTypes.js +35 -35
- package/dist/parser/tokenizerTypes.js.map +1 -1
- package/dist/parser/unicode.d.ts +3 -3
- package/dist/pyright.js +38 -18
- package/dist/pyright.js.map +1 -1
- package/dist/pyrightFileSystem.d.ts +1 -0
- package/dist/pyrightFileSystem.js +1 -1
- package/dist/pyrightFileSystem.js.map +1 -1
- package/dist/readonlyAugmentedFileSystem.d.ts +1 -0
- package/dist/tests/chainedSourceFiles.test.js +5 -1
- package/dist/tests/chainedSourceFiles.test.js.map +1 -1
- package/dist/tests/checker.test.js +5 -1
- package/dist/tests/checker.test.js.map +1 -1
- package/dist/tests/collectionUtils.test.js +5 -1
- package/dist/tests/collectionUtils.test.js.map +1 -1
- package/dist/tests/common.test.js +5 -1
- package/dist/tests/common.test.js.map +1 -1
- package/dist/tests/config.test.js +7 -5
- package/dist/tests/config.test.js.map +1 -1
- package/dist/tests/debug.test.js +8 -4
- package/dist/tests/debug.test.js.map +1 -1
- package/dist/tests/deferred.test.js +5 -1
- package/dist/tests/deferred.test.js.map +1 -1
- package/dist/tests/diagnosticOverrides.test.js +5 -1
- package/dist/tests/diagnosticOverrides.test.js.map +1 -1
- package/dist/tests/docStringConversion.test.js +0 -22
- package/dist/tests/docStringConversion.test.js.map +1 -1
- package/dist/tests/docStringUtils.test.js +5 -1
- package/dist/tests/docStringUtils.test.js.map +1 -1
- package/dist/tests/filesystem.test.js +5 -1
- package/dist/tests/filesystem.test.js.map +1 -1
- package/dist/tests/fourSlashParser.test.js +5 -1
- package/dist/tests/fourSlashParser.test.js.map +1 -1
- package/dist/tests/fourSlashRunner.test.js +5 -1
- package/dist/tests/fourSlashRunner.test.js.map +1 -1
- package/dist/tests/fourslash/completions.params.fourslash.js +11 -0
- package/dist/tests/fourslash/completions.params.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docstring.split.fourslash.js +10 -0
- package/dist/tests/fourslash/hover.docstring.split.fourslash.js.map +1 -1
- package/dist/tests/harness/fourslash/fourSlashParser.js +13 -13
- package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -1
- package/dist/tests/harness/fourslash/fourSlashTypes.js +11 -7
- package/dist/tests/harness/fourslash/fourSlashTypes.js.map +1 -1
- package/dist/tests/harness/fourslash/runner.d.ts +1 -1
- package/dist/tests/harness/fourslash/runner.js +5 -1
- package/dist/tests/harness/fourslash/runner.js.map +1 -1
- package/dist/tests/harness/fourslash/testLanguageService.js +5 -1
- package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.Consts.js +6 -2
- package/dist/tests/harness/fourslash/testState.Consts.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.js +17 -13
- package/dist/tests/harness/fourslash/testState.js.map +1 -1
- package/dist/tests/harness/fourslash/testStateUtils.js +9 -5
- package/dist/tests/harness/fourslash/testStateUtils.js.map +1 -1
- package/dist/tests/harness/fourslash/workspaceEditTestUtils.js +5 -1
- package/dist/tests/harness/fourslash/workspaceEditTestUtils.js.map +1 -1
- package/dist/tests/harness/testHost.js +5 -1
- package/dist/tests/harness/testHost.js.map +1 -1
- package/dist/tests/harness/utils.d.ts +13 -12
- package/dist/tests/harness/utils.js.map +1 -1
- package/dist/tests/harness/vfs/factory.js +6 -2
- package/dist/tests/harness/vfs/factory.js.map +1 -1
- package/dist/tests/harness/vfs/filesystem.d.ts +4 -3
- package/dist/tests/harness/vfs/filesystem.js +11 -7
- package/dist/tests/harness/vfs/filesystem.js.map +1 -1
- package/dist/tests/harness/vfs/pathValidation.js +30 -26
- package/dist/tests/harness/vfs/pathValidation.js.map +1 -1
- package/dist/tests/importStatementUtils.test.js +25 -25
- package/dist/tests/importStatementUtils.test.js.map +1 -1
- package/dist/tests/ipythonMode.test.js +6 -6
- package/dist/tests/ipythonMode.test.js.map +1 -1
- package/dist/tests/localizer.test.js +5 -1
- package/dist/tests/localizer.test.js.map +1 -1
- package/dist/tests/logger.test.js +5 -1
- package/dist/tests/logger.test.js.map +1 -1
- package/dist/tests/parseTreeUtils.test.js +10 -10
- package/dist/tests/parseTreeUtils.test.js.map +1 -1
- package/dist/tests/parser.test.js +13 -9
- package/dist/tests/parser.test.js.map +1 -1
- package/dist/tests/pathUtils.test.js +5 -1
- package/dist/tests/pathUtils.test.js.map +1 -1
- package/dist/tests/sourceFile.test.js +5 -1
- package/dist/tests/sourceFile.test.js.map +1 -1
- package/dist/tests/sourceMapperUtils.test.js +5 -1
- package/dist/tests/sourceMapperUtils.test.js.map +1 -1
- package/dist/tests/stringUtils.test.js +10 -6
- package/dist/tests/stringUtils.test.js.map +1 -1
- package/dist/tests/symbolNameUtils.test.js +5 -1
- package/dist/tests/symbolNameUtils.test.js.map +1 -1
- package/dist/tests/testState.test.js +5 -1
- package/dist/tests/testState.test.js.map +1 -1
- package/dist/tests/testUtils.js +11 -7
- package/dist/tests/testUtils.js.map +1 -1
- package/dist/tests/textRange.test.js +5 -1
- package/dist/tests/textRange.test.js.map +1 -1
- package/dist/tests/tokenizer.test.js +463 -459
- package/dist/tests/tokenizer.test.js.map +1 -1
- package/dist/tests/typeEvaluator1.test.js +18 -2
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +19 -3
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +11 -3
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +11 -3
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +5 -1
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/dist/tests/typePrinter.test.js +44 -40
- package/dist/tests/typePrinter.test.js.map +1 -1
- package/dist/tests/workspaceEditUtils.test.js +5 -1
- package/dist/tests/workspaceEditUtils.test.js.map +1 -1
- package/dist/tests/zipfs.test.js +5 -1
- package/dist/tests/zipfs.test.js.map +1 -1
- package/dist/workspaceFactory.js +2 -2
- package/dist/workspaceFactory.js.map +1 -1
- package/package.json +2 -2
package/dist/parser/tokenizer.js
CHANGED
@@ -20,90 +20,90 @@ const characterStream_1 = require("./characterStream");
|
|
20
20
|
const tokenizerTypes_1 = require("./tokenizerTypes");
|
21
21
|
// This must be a Map, as operations like {}["constructor"] succeed.
|
22
22
|
const PythonKeywords = new Map([
|
23
|
-
['and', 0 /* And */],
|
24
|
-
['as', 1 /* As */],
|
25
|
-
['assert', 2 /* Assert */],
|
26
|
-
['async', 3 /* Async */],
|
27
|
-
['await', 4 /* Await */],
|
28
|
-
['break', 5 /* Break */],
|
29
|
-
['case', 6 /* Case */],
|
30
|
-
['class', 7 /* Class */],
|
31
|
-
['continue', 8 /* Continue */],
|
32
|
-
['__debug__', 9 /* Debug */],
|
33
|
-
['def', 10 /* Def */],
|
34
|
-
['del', 11 /* Del */],
|
35
|
-
['elif', 12 /* Elif */],
|
36
|
-
['else', 13 /* Else */],
|
37
|
-
['except', 14 /* Except */],
|
38
|
-
['finally', 16 /* Finally */],
|
39
|
-
['for', 17 /* For */],
|
40
|
-
['from', 18 /* From */],
|
41
|
-
['global', 19 /* Global */],
|
42
|
-
['if', 20 /* If */],
|
43
|
-
['import', 21 /* Import */],
|
44
|
-
['in', 22 /* In */],
|
45
|
-
['is', 23 /* Is */],
|
46
|
-
['lambda', 24 /* Lambda */],
|
47
|
-
['match', 25 /* Match */],
|
48
|
-
['nonlocal', 27 /* Nonlocal */],
|
49
|
-
['not', 28 /* Not */],
|
50
|
-
['or', 29 /* Or */],
|
51
|
-
['pass', 30 /* Pass */],
|
52
|
-
['raise', 31 /* Raise */],
|
53
|
-
['return', 32 /* Return */],
|
54
|
-
['try', 34 /* Try */],
|
55
|
-
['type', 35 /* Type */],
|
56
|
-
['while', 36 /* While */],
|
57
|
-
['with', 37 /* With */],
|
58
|
-
['yield', 38 /* Yield */],
|
59
|
-
['False', 15 /* False */],
|
60
|
-
['None', 26 /* None */],
|
61
|
-
['True', 33 /* True */],
|
23
|
+
['and', 0 /* KeywordType.And */],
|
24
|
+
['as', 1 /* KeywordType.As */],
|
25
|
+
['assert', 2 /* KeywordType.Assert */],
|
26
|
+
['async', 3 /* KeywordType.Async */],
|
27
|
+
['await', 4 /* KeywordType.Await */],
|
28
|
+
['break', 5 /* KeywordType.Break */],
|
29
|
+
['case', 6 /* KeywordType.Case */],
|
30
|
+
['class', 7 /* KeywordType.Class */],
|
31
|
+
['continue', 8 /* KeywordType.Continue */],
|
32
|
+
['__debug__', 9 /* KeywordType.Debug */],
|
33
|
+
['def', 10 /* KeywordType.Def */],
|
34
|
+
['del', 11 /* KeywordType.Del */],
|
35
|
+
['elif', 12 /* KeywordType.Elif */],
|
36
|
+
['else', 13 /* KeywordType.Else */],
|
37
|
+
['except', 14 /* KeywordType.Except */],
|
38
|
+
['finally', 16 /* KeywordType.Finally */],
|
39
|
+
['for', 17 /* KeywordType.For */],
|
40
|
+
['from', 18 /* KeywordType.From */],
|
41
|
+
['global', 19 /* KeywordType.Global */],
|
42
|
+
['if', 20 /* KeywordType.If */],
|
43
|
+
['import', 21 /* KeywordType.Import */],
|
44
|
+
['in', 22 /* KeywordType.In */],
|
45
|
+
['is', 23 /* KeywordType.Is */],
|
46
|
+
['lambda', 24 /* KeywordType.Lambda */],
|
47
|
+
['match', 25 /* KeywordType.Match */],
|
48
|
+
['nonlocal', 27 /* KeywordType.Nonlocal */],
|
49
|
+
['not', 28 /* KeywordType.Not */],
|
50
|
+
['or', 29 /* KeywordType.Or */],
|
51
|
+
['pass', 30 /* KeywordType.Pass */],
|
52
|
+
['raise', 31 /* KeywordType.Raise */],
|
53
|
+
['return', 32 /* KeywordType.Return */],
|
54
|
+
['try', 34 /* KeywordType.Try */],
|
55
|
+
['type', 35 /* KeywordType.Type */],
|
56
|
+
['while', 36 /* KeywordType.While */],
|
57
|
+
['with', 37 /* KeywordType.With */],
|
58
|
+
['yield', 38 /* KeywordType.Yield */],
|
59
|
+
['False', 15 /* KeywordType.False */],
|
60
|
+
['None', 26 /* KeywordType.None */],
|
61
|
+
['True', 33 /* KeywordType.True */],
|
62
62
|
]);
|
63
63
|
const _softKeywords = new Set(['match', 'case', 'type']);
|
64
64
|
const _operatorInfo = {
|
65
|
-
[0 /* Add */]: 1 /* Unary */ | 2 /* Binary */,
|
66
|
-
[1 /* AddEqual */]: 4 /* Assignment */,
|
67
|
-
[2 /* Assign */]: 4 /* Assignment */,
|
68
|
-
[3 /* BitwiseAnd */]: 2 /* Binary */,
|
69
|
-
[4 /* BitwiseAndEqual */]: 4 /* Assignment */,
|
70
|
-
[5 /* BitwiseInvert */]: 1 /* Unary */,
|
71
|
-
[6 /* BitwiseOr */]: 2 /* Binary */,
|
72
|
-
[7 /* BitwiseOrEqual */]: 4 /* Assignment */,
|
73
|
-
[8 /* BitwiseXor */]: 2 /* Binary */,
|
74
|
-
[9 /* BitwiseXorEqual */]: 4 /* Assignment */,
|
75
|
-
[10 /* Divide */]: 2 /* Binary */,
|
76
|
-
[11 /* DivideEqual */]: 4 /* Assignment */,
|
77
|
-
[12 /* Equals */]: 2 /* Binary */ | 8 /* Comparison */,
|
78
|
-
[13 /* FloorDivide */]: 2 /* Binary */,
|
79
|
-
[14 /* FloorDivideEqual */]: 4 /* Assignment */,
|
80
|
-
[15 /* GreaterThan */]: 2 /* Binary */ | 8 /* Comparison */,
|
81
|
-
[16 /* GreaterThanOrEqual */]: 2 /* Binary */ | 8 /* Comparison */,
|
82
|
-
[17 /* LeftShift */]: 2 /* Binary */,
|
83
|
-
[18 /* LeftShiftEqual */]: 4 /* Assignment */,
|
84
|
-
[19 /* LessOrGreaterThan */]: 2 /* Binary */ | 8 /* Comparison */ | 16 /* Deprecated */,
|
85
|
-
[20 /* LessThan */]: 2 /* Binary */ | 8 /* Comparison */,
|
86
|
-
[21 /* LessThanOrEqual */]: 2 /* Binary */ | 8 /* Comparison */,
|
87
|
-
[22 /* MatrixMultiply */]: 2 /* Binary */,
|
88
|
-
[23 /* MatrixMultiplyEqual */]: 4 /* Assignment */,
|
89
|
-
[24 /* Mod */]: 2 /* Binary */,
|
90
|
-
[25 /* ModEqual */]: 4 /* Assignment */,
|
91
|
-
[26 /* Multiply */]: 2 /* Binary */,
|
92
|
-
[27 /* MultiplyEqual */]: 4 /* Assignment */,
|
93
|
-
[28 /* NotEquals */]: 2 /* Binary */ | 8 /* Comparison */,
|
94
|
-
[29 /* Power */]: 2 /* Binary */,
|
95
|
-
[30 /* PowerEqual */]: 4 /* Assignment */,
|
96
|
-
[31 /* RightShift */]: 2 /* Binary */,
|
97
|
-
[32 /* RightShiftEqual */]: 4 /* Assignment */,
|
98
|
-
[33 /* Subtract */]: 2 /* Binary */,
|
99
|
-
[34 /* SubtractEqual */]: 4 /* Assignment */,
|
100
|
-
[36 /* And */]: 2 /* Binary */,
|
101
|
-
[37 /* Or */]: 2 /* Binary */,
|
102
|
-
[38 /* Not */]: 1 /* Unary */,
|
103
|
-
[39 /* Is */]: 2 /* Binary */,
|
104
|
-
[40 /* IsNot */]: 2 /* Binary */,
|
105
|
-
[41 /* In */]: 2 /* Binary */,
|
106
|
-
[42 /* NotIn */]: 2 /* Binary */,
|
65
|
+
[0 /* OperatorType.Add */]: 1 /* OperatorFlags.Unary */ | 2 /* OperatorFlags.Binary */,
|
66
|
+
[1 /* OperatorType.AddEqual */]: 4 /* OperatorFlags.Assignment */,
|
67
|
+
[2 /* OperatorType.Assign */]: 4 /* OperatorFlags.Assignment */,
|
68
|
+
[3 /* OperatorType.BitwiseAnd */]: 2 /* OperatorFlags.Binary */,
|
69
|
+
[4 /* OperatorType.BitwiseAndEqual */]: 4 /* OperatorFlags.Assignment */,
|
70
|
+
[5 /* OperatorType.BitwiseInvert */]: 1 /* OperatorFlags.Unary */,
|
71
|
+
[6 /* OperatorType.BitwiseOr */]: 2 /* OperatorFlags.Binary */,
|
72
|
+
[7 /* OperatorType.BitwiseOrEqual */]: 4 /* OperatorFlags.Assignment */,
|
73
|
+
[8 /* OperatorType.BitwiseXor */]: 2 /* OperatorFlags.Binary */,
|
74
|
+
[9 /* OperatorType.BitwiseXorEqual */]: 4 /* OperatorFlags.Assignment */,
|
75
|
+
[10 /* OperatorType.Divide */]: 2 /* OperatorFlags.Binary */,
|
76
|
+
[11 /* OperatorType.DivideEqual */]: 4 /* OperatorFlags.Assignment */,
|
77
|
+
[12 /* OperatorType.Equals */]: 2 /* OperatorFlags.Binary */ | 8 /* OperatorFlags.Comparison */,
|
78
|
+
[13 /* OperatorType.FloorDivide */]: 2 /* OperatorFlags.Binary */,
|
79
|
+
[14 /* OperatorType.FloorDivideEqual */]: 4 /* OperatorFlags.Assignment */,
|
80
|
+
[15 /* OperatorType.GreaterThan */]: 2 /* OperatorFlags.Binary */ | 8 /* OperatorFlags.Comparison */,
|
81
|
+
[16 /* OperatorType.GreaterThanOrEqual */]: 2 /* OperatorFlags.Binary */ | 8 /* OperatorFlags.Comparison */,
|
82
|
+
[17 /* OperatorType.LeftShift */]: 2 /* OperatorFlags.Binary */,
|
83
|
+
[18 /* OperatorType.LeftShiftEqual */]: 4 /* OperatorFlags.Assignment */,
|
84
|
+
[19 /* OperatorType.LessOrGreaterThan */]: 2 /* OperatorFlags.Binary */ | 8 /* OperatorFlags.Comparison */ | 16 /* OperatorFlags.Deprecated */,
|
85
|
+
[20 /* OperatorType.LessThan */]: 2 /* OperatorFlags.Binary */ | 8 /* OperatorFlags.Comparison */,
|
86
|
+
[21 /* OperatorType.LessThanOrEqual */]: 2 /* OperatorFlags.Binary */ | 8 /* OperatorFlags.Comparison */,
|
87
|
+
[22 /* OperatorType.MatrixMultiply */]: 2 /* OperatorFlags.Binary */,
|
88
|
+
[23 /* OperatorType.MatrixMultiplyEqual */]: 4 /* OperatorFlags.Assignment */,
|
89
|
+
[24 /* OperatorType.Mod */]: 2 /* OperatorFlags.Binary */,
|
90
|
+
[25 /* OperatorType.ModEqual */]: 4 /* OperatorFlags.Assignment */,
|
91
|
+
[26 /* OperatorType.Multiply */]: 2 /* OperatorFlags.Binary */,
|
92
|
+
[27 /* OperatorType.MultiplyEqual */]: 4 /* OperatorFlags.Assignment */,
|
93
|
+
[28 /* OperatorType.NotEquals */]: 2 /* OperatorFlags.Binary */ | 8 /* OperatorFlags.Comparison */,
|
94
|
+
[29 /* OperatorType.Power */]: 2 /* OperatorFlags.Binary */,
|
95
|
+
[30 /* OperatorType.PowerEqual */]: 4 /* OperatorFlags.Assignment */,
|
96
|
+
[31 /* OperatorType.RightShift */]: 2 /* OperatorFlags.Binary */,
|
97
|
+
[32 /* OperatorType.RightShiftEqual */]: 4 /* OperatorFlags.Assignment */,
|
98
|
+
[33 /* OperatorType.Subtract */]: 2 /* OperatorFlags.Binary */,
|
99
|
+
[34 /* OperatorType.SubtractEqual */]: 4 /* OperatorFlags.Assignment */,
|
100
|
+
[36 /* OperatorType.And */]: 2 /* OperatorFlags.Binary */,
|
101
|
+
[37 /* OperatorType.Or */]: 2 /* OperatorFlags.Binary */,
|
102
|
+
[38 /* OperatorType.Not */]: 1 /* OperatorFlags.Unary */,
|
103
|
+
[39 /* OperatorType.Is */]: 2 /* OperatorFlags.Binary */,
|
104
|
+
[40 /* OperatorType.IsNot */]: 2 /* OperatorFlags.Binary */,
|
105
|
+
[41 /* OperatorType.In */]: 2 /* OperatorFlags.Binary */,
|
106
|
+
[42 /* OperatorType.NotIn */]: 2 /* OperatorFlags.Binary */,
|
107
107
|
};
|
108
108
|
const _byteOrderMarker = 0xfeff;
|
109
109
|
const defaultTabSize = 8;
|
@@ -176,24 +176,24 @@ class Tokenizer {
|
|
176
176
|
}
|
177
177
|
// Insert any implied FStringEnd tokens.
|
178
178
|
while (this._activeFString) {
|
179
|
-
this._tokens.push(tokenizerTypes_1.FStringEndToken.create(this._cs.position, 0, this._activeFString.startToken.flags | 65536 /* Unterminated */));
|
179
|
+
this._tokens.push(tokenizerTypes_1.FStringEndToken.create(this._cs.position, 0, this._activeFString.startToken.flags | 65536 /* StringTokenFlags.Unterminated */));
|
180
180
|
this._activeFString = this._fStringStack.pop();
|
181
181
|
}
|
182
182
|
// Insert an implied new line to make parsing easier.
|
183
|
-
if (this._tokens.length === 0 || this._tokens[this._tokens.length - 1].type !== 2 /* NewLine */) {
|
184
|
-
this._tokens.push(tokenizerTypes_1.NewLineToken.create(this._cs.position, 0, 3 /* Implied */, this._getComments()));
|
183
|
+
if (this._tokens.length === 0 || this._tokens[this._tokens.length - 1].type !== 2 /* TokenType.NewLine */) {
|
184
|
+
this._tokens.push(tokenizerTypes_1.NewLineToken.create(this._cs.position, 0, 3 /* NewLineType.Implied */, this._getComments()));
|
185
185
|
}
|
186
186
|
// Insert any implied dedent tokens.
|
187
187
|
this._setIndent(this._cs.position, 0, 0, /* isSpacePresent */ false, /* isTabPresent */ false);
|
188
188
|
// Add a final end-of-stream token to make parsing easier.
|
189
|
-
this._tokens.push(tokenizerTypes_1.Token.create(1 /* EndOfStream */, this._cs.position, 0, this._getComments()));
|
189
|
+
this._tokens.push(tokenizerTypes_1.Token.create(1 /* TokenType.EndOfStream */, this._cs.position, 0, this._getComments()));
|
190
190
|
// Add the final line range.
|
191
191
|
this._addLineRange();
|
192
192
|
// If the last line ended in a line-end character, add an empty line.
|
193
193
|
if (this._lineRanges.length > 0) {
|
194
194
|
const lastLine = this._lineRanges[this._lineRanges.length - 1];
|
195
195
|
const lastCharOfLastLine = text.charCodeAt(lastLine.start + lastLine.length - 1);
|
196
|
-
if (lastCharOfLastLine === 13 /* CarriageReturn */ || lastCharOfLastLine === 10 /* LineFeed */) {
|
196
|
+
if (lastCharOfLastLine === 13 /* Char.CarriageReturn */ || lastCharOfLastLine === 10 /* Char.LineFeed */) {
|
197
197
|
this._lineRanges.push({ start: this._cs.position, length: 0 });
|
198
198
|
}
|
199
199
|
}
|
@@ -257,13 +257,13 @@ class Tokenizer {
|
|
257
257
|
if (operatorType === undefined || _operatorInfo[operatorType] === undefined) {
|
258
258
|
return false;
|
259
259
|
}
|
260
|
-
return (_operatorInfo[operatorType] & 4 /* Assignment */) !== 0;
|
260
|
+
return (_operatorInfo[operatorType] & 4 /* OperatorFlags.Assignment */) !== 0;
|
261
261
|
}
|
262
262
|
static isOperatorComparison(operatorType) {
|
263
263
|
if (operatorType === undefined || _operatorInfo[operatorType] === undefined) {
|
264
264
|
return false;
|
265
265
|
}
|
266
|
-
return (_operatorInfo[operatorType] & 8 /* Comparison */) !== 0;
|
266
|
+
return (_operatorInfo[operatorType] & 8 /* OperatorFlags.Comparison */) !== 0;
|
267
267
|
}
|
268
268
|
_addNextToken() {
|
269
269
|
// Are we in the middle of an f-string but not in a replacement field?
|
@@ -297,25 +297,25 @@ class Tokenizer {
|
|
297
297
|
this._cs.advance(stringPrefixLength);
|
298
298
|
}
|
299
299
|
const quoteTypeFlags = this._getQuoteTypeFlags(stringPrefix);
|
300
|
-
if (quoteTypeFlags !== 0 /* None */) {
|
300
|
+
if (quoteTypeFlags !== 0 /* StringTokenFlags.None */) {
|
301
301
|
this._handleString(quoteTypeFlags, stringPrefixLength);
|
302
302
|
return true;
|
303
303
|
}
|
304
304
|
}
|
305
|
-
if (this._cs.currentChar === 35 /* Hash */) {
|
305
|
+
if (this._cs.currentChar === 35 /* Char.Hash */) {
|
306
306
|
this._handleComment();
|
307
307
|
return true;
|
308
308
|
}
|
309
309
|
if (this._ipythonMode) {
|
310
310
|
const kind = this._getIPythonMagicsKind();
|
311
311
|
if (kind === 'line') {
|
312
|
-
this._handleIPythonMagics(this._cs.currentChar === 37 /* Percent */ ? 1 /* IPythonMagic */ : 2 /* IPythonShellEscape */);
|
312
|
+
this._handleIPythonMagics(this._cs.currentChar === 37 /* Char.Percent */ ? 1 /* CommentType.IPythonMagic */ : 2 /* CommentType.IPythonShellEscape */);
|
313
313
|
return true;
|
314
314
|
}
|
315
315
|
if (kind === 'cell') {
|
316
|
-
this._handleIPythonMagics(this._cs.currentChar === 37 /* Percent */
|
317
|
-
? 3 /* IPythonCellMagic */
|
318
|
-
: 4 /* IPythonCellShellEscape */);
|
316
|
+
this._handleIPythonMagics(this._cs.currentChar === 37 /* Char.Percent */
|
317
|
+
? 3 /* CommentType.IPythonCellMagic */
|
318
|
+
: 4 /* CommentType.IPythonCellShellEscape */);
|
319
319
|
return true;
|
320
320
|
}
|
321
321
|
}
|
@@ -327,19 +327,19 @@ class Tokenizer {
|
|
327
327
|
}
|
328
328
|
return this._handleInvalid();
|
329
329
|
}
|
330
|
-
case 13 /* CarriageReturn */: {
|
331
|
-
const length = this._cs.nextChar === 10 /* LineFeed */ ? 2 : 1;
|
332
|
-
const newLineType = length === 2 ? 2 /* CarriageReturnLineFeed */ : 0 /* CarriageReturn */;
|
330
|
+
case 13 /* Char.CarriageReturn */: {
|
331
|
+
const length = this._cs.nextChar === 10 /* Char.LineFeed */ ? 2 : 1;
|
332
|
+
const newLineType = length === 2 ? 2 /* NewLineType.CarriageReturnLineFeed */ : 0 /* NewLineType.CarriageReturn */;
|
333
333
|
this._handleNewLine(length, newLineType);
|
334
334
|
return true;
|
335
335
|
}
|
336
|
-
case 10 /* LineFeed */: {
|
337
|
-
this._handleNewLine(1, 1 /* LineFeed */);
|
336
|
+
case 10 /* Char.LineFeed */: {
|
337
|
+
this._handleNewLine(1, 1 /* NewLineType.LineFeed */);
|
338
338
|
return true;
|
339
339
|
}
|
340
|
-
case 92 /* Backslash */: {
|
341
|
-
if (this._cs.nextChar === 13 /* CarriageReturn */) {
|
342
|
-
if (this._cs.lookAhead(2) === 10 /* LineFeed */) {
|
340
|
+
case 92 /* Char.Backslash */: {
|
341
|
+
if (this._cs.nextChar === 13 /* Char.CarriageReturn */) {
|
342
|
+
if (this._cs.lookAhead(2) === 10 /* Char.LineFeed */) {
|
343
343
|
this._cs.advance(3);
|
344
344
|
}
|
345
345
|
else {
|
@@ -348,40 +348,40 @@ class Tokenizer {
|
|
348
348
|
this._addLineRange();
|
349
349
|
return true;
|
350
350
|
}
|
351
|
-
else if (this._cs.nextChar === 10 /* LineFeed */) {
|
351
|
+
else if (this._cs.nextChar === 10 /* Char.LineFeed */) {
|
352
352
|
this._cs.advance(2);
|
353
353
|
this._addLineRange();
|
354
354
|
return true;
|
355
355
|
}
|
356
356
|
return this._handleInvalid();
|
357
357
|
}
|
358
|
-
case 40 /* OpenParenthesis */: {
|
358
|
+
case 40 /* Char.OpenParenthesis */: {
|
359
359
|
this._parenDepth++;
|
360
|
-
this._tokens.push(tokenizerTypes_1.Token.create(13 /* OpenParenthesis */, this._cs.position, 1, this._getComments()));
|
360
|
+
this._tokens.push(tokenizerTypes_1.Token.create(13 /* TokenType.OpenParenthesis */, this._cs.position, 1, this._getComments()));
|
361
361
|
break;
|
362
362
|
}
|
363
|
-
case 41 /* CloseParenthesis */: {
|
363
|
+
case 41 /* Char.CloseParenthesis */: {
|
364
364
|
if (this._parenDepth > 0) {
|
365
365
|
this._parenDepth--;
|
366
366
|
}
|
367
|
-
this._tokens.push(tokenizerTypes_1.Token.create(14 /* CloseParenthesis */, this._cs.position, 1, this._getComments()));
|
367
|
+
this._tokens.push(tokenizerTypes_1.Token.create(14 /* TokenType.CloseParenthesis */, this._cs.position, 1, this._getComments()));
|
368
368
|
break;
|
369
369
|
}
|
370
|
-
case 91 /* OpenBracket */: {
|
370
|
+
case 91 /* Char.OpenBracket */: {
|
371
371
|
this._parenDepth++;
|
372
|
-
this._tokens.push(tokenizerTypes_1.Token.create(15 /* OpenBracket */, this._cs.position, 1, this._getComments()));
|
372
|
+
this._tokens.push(tokenizerTypes_1.Token.create(15 /* TokenType.OpenBracket */, this._cs.position, 1, this._getComments()));
|
373
373
|
break;
|
374
374
|
}
|
375
|
-
case 93 /* CloseBracket */: {
|
375
|
+
case 93 /* Char.CloseBracket */: {
|
376
376
|
if (this._parenDepth > 0) {
|
377
377
|
this._parenDepth--;
|
378
378
|
}
|
379
|
-
this._tokens.push(tokenizerTypes_1.Token.create(16 /* CloseBracket */, this._cs.position, 1, this._getComments()));
|
379
|
+
this._tokens.push(tokenizerTypes_1.Token.create(16 /* TokenType.CloseBracket */, this._cs.position, 1, this._getComments()));
|
380
380
|
break;
|
381
381
|
}
|
382
|
-
case 123 /* OpenBrace */: {
|
382
|
+
case 123 /* Char.OpenBrace */: {
|
383
383
|
this._parenDepth++;
|
384
|
-
this._tokens.push(tokenizerTypes_1.Token.create(17 /* OpenCurlyBrace */, this._cs.position, 1, this._getComments()));
|
384
|
+
this._tokens.push(tokenizerTypes_1.Token.create(17 /* TokenType.OpenCurlyBrace */, this._cs.position, 1, this._getComments()));
|
385
385
|
if (this._activeFString) {
|
386
386
|
// Are we starting a new replacement field?
|
387
387
|
if (!this._activeFString.activeReplacementField ||
|
@@ -400,7 +400,7 @@ class Tokenizer {
|
|
400
400
|
}
|
401
401
|
break;
|
402
402
|
}
|
403
|
-
case 125 /* CloseBrace */: {
|
403
|
+
case 125 /* Char.CloseBrace */: {
|
404
404
|
if (this._activeFString &&
|
405
405
|
((_a = this._activeFString.activeReplacementField) === null || _a === void 0 ? void 0 : _a.parenDepth) === this._parenDepth) {
|
406
406
|
this._activeFString.activeReplacementField = this._activeFString.replacementFieldStack.pop();
|
@@ -408,32 +408,32 @@ class Tokenizer {
|
|
408
408
|
if (this._parenDepth > 0) {
|
409
409
|
this._parenDepth--;
|
410
410
|
}
|
411
|
-
this._tokens.push(tokenizerTypes_1.Token.create(18 /* CloseCurlyBrace */, this._cs.position, 1, this._getComments()));
|
411
|
+
this._tokens.push(tokenizerTypes_1.Token.create(18 /* TokenType.CloseCurlyBrace */, this._cs.position, 1, this._getComments()));
|
412
412
|
break;
|
413
413
|
}
|
414
|
-
case 44 /* Comma */: {
|
415
|
-
this._tokens.push(tokenizerTypes_1.Token.create(12 /* Comma */, this._cs.position, 1, this._getComments()));
|
414
|
+
case 44 /* Char.Comma */: {
|
415
|
+
this._tokens.push(tokenizerTypes_1.Token.create(12 /* TokenType.Comma */, this._cs.position, 1, this._getComments()));
|
416
416
|
break;
|
417
417
|
}
|
418
|
-
case 96 /* Backtick */: {
|
419
|
-
this._tokens.push(tokenizerTypes_1.Token.create(22 /* Backtick */, this._cs.position, 1, this._getComments()));
|
418
|
+
case 96 /* Char.Backtick */: {
|
419
|
+
this._tokens.push(tokenizerTypes_1.Token.create(22 /* TokenType.Backtick */, this._cs.position, 1, this._getComments()));
|
420
420
|
break;
|
421
421
|
}
|
422
|
-
case 59 /* Semicolon */: {
|
423
|
-
this._tokens.push(tokenizerTypes_1.Token.create(11 /* Semicolon */, this._cs.position, 1, this._getComments()));
|
422
|
+
case 59 /* Char.Semicolon */: {
|
423
|
+
this._tokens.push(tokenizerTypes_1.Token.create(11 /* TokenType.Semicolon */, this._cs.position, 1, this._getComments()));
|
424
424
|
break;
|
425
425
|
}
|
426
|
-
case 58 /* Colon */: {
|
427
|
-
if (this._cs.nextChar === 61 /* Equal */) {
|
426
|
+
case 58 /* Char.Colon */: {
|
427
|
+
if (this._cs.nextChar === 61 /* Char.Equal */) {
|
428
428
|
if (!this._activeFString ||
|
429
429
|
!this._activeFString.activeReplacementField ||
|
430
430
|
this._activeFString.activeReplacementField.parenDepth !== this._parenDepth) {
|
431
|
-
this._tokens.push(tokenizerTypes_1.OperatorToken.create(this._cs.position, 2, 35 /* Walrus */, this._getComments()));
|
431
|
+
this._tokens.push(tokenizerTypes_1.OperatorToken.create(this._cs.position, 2, 35 /* OperatorType.Walrus */, this._getComments()));
|
432
432
|
this._cs.advance(1);
|
433
433
|
break;
|
434
434
|
}
|
435
435
|
}
|
436
|
-
this._tokens.push(tokenizerTypes_1.Token.create(10 /* Colon */, this._cs.position, 1, this._getComments()));
|
436
|
+
this._tokens.push(tokenizerTypes_1.Token.create(10 /* TokenType.Colon */, this._cs.position, 1, this._getComments()));
|
437
437
|
if (((_b = this._activeFString) === null || _b === void 0 ? void 0 : _b.activeReplacementField) &&
|
438
438
|
this._parenDepth === this._activeFString.activeReplacementField.parenDepth) {
|
439
439
|
this._activeFString.activeReplacementField.inFormatSpecifier = true;
|
@@ -446,13 +446,13 @@ class Tokenizer {
|
|
446
446
|
return true;
|
447
447
|
}
|
448
448
|
}
|
449
|
-
if (this._cs.currentChar === 46 /* Period */) {
|
450
|
-
if (this._cs.nextChar === 46 /* Period */ && this._cs.lookAhead(2) === 46 /* Period */) {
|
451
|
-
this._tokens.push(tokenizerTypes_1.Token.create(19 /* Ellipsis */, this._cs.position, 3, this._getComments()));
|
449
|
+
if (this._cs.currentChar === 46 /* Char.Period */) {
|
450
|
+
if (this._cs.nextChar === 46 /* Char.Period */ && this._cs.lookAhead(2) === 46 /* Char.Period */) {
|
451
|
+
this._tokens.push(tokenizerTypes_1.Token.create(19 /* TokenType.Ellipsis */, this._cs.position, 3, this._getComments()));
|
452
452
|
this._cs.advance(3);
|
453
453
|
return true;
|
454
454
|
}
|
455
|
-
this._tokens.push(tokenizerTypes_1.Token.create(20 /* Dot */, this._cs.position, 1, this._getComments()));
|
455
|
+
this._tokens.push(tokenizerTypes_1.Token.create(20 /* TokenType.Dot */, this._cs.position, 1, this._getComments()));
|
456
456
|
break;
|
457
457
|
}
|
458
458
|
if (!this._tryIdentifier()) {
|
@@ -473,17 +473,17 @@ class Tokenizer {
|
|
473
473
|
this._prevLineStart = this._cs.position;
|
474
474
|
}
|
475
475
|
_handleNewLine(length, newLineType) {
|
476
|
-
if (this._parenDepth === 0 && newLineType !== 3 /* Implied */) {
|
476
|
+
if (this._parenDepth === 0 && newLineType !== 3 /* NewLineType.Implied */) {
|
477
477
|
// New lines are ignored within parentheses.
|
478
478
|
// We'll also avoid adding multiple newlines in a row to simplify parsing.
|
479
|
-
if (this._tokens.length === 0 || this._tokens[this._tokens.length - 1].type !== 2 /* NewLine */) {
|
479
|
+
if (this._tokens.length === 0 || this._tokens[this._tokens.length - 1].type !== 2 /* TokenType.NewLine */) {
|
480
480
|
this._tokens.push(tokenizerTypes_1.NewLineToken.create(this._cs.position, length, newLineType, this._getComments()));
|
481
481
|
}
|
482
482
|
}
|
483
|
-
if (newLineType === 0 /* CarriageReturn */) {
|
483
|
+
if (newLineType === 0 /* NewLineType.CarriageReturn */) {
|
484
484
|
this._crCount++;
|
485
485
|
}
|
486
|
-
else if (newLineType === 2 /* CarriageReturnLineFeed */) {
|
486
|
+
else if (newLineType === 2 /* NewLineType.CarriageReturnLineFeed */) {
|
487
487
|
this._crLfCount++;
|
488
488
|
}
|
489
489
|
else {
|
@@ -501,13 +501,13 @@ class Tokenizer {
|
|
501
501
|
const startOffset = this._cs.position;
|
502
502
|
while (!this._cs.isEndOfStream()) {
|
503
503
|
switch (this._cs.currentChar) {
|
504
|
-
case 32 /* Space */:
|
504
|
+
case 32 /* Char.Space */:
|
505
505
|
tab1Spaces++;
|
506
506
|
tab8Spaces++;
|
507
507
|
isSpacePresent = true;
|
508
508
|
this._cs.moveNext();
|
509
509
|
break;
|
510
|
-
case 9 /* Tab */:
|
510
|
+
case 9 /* Char.Tab */:
|
511
511
|
// Translate tabs into spaces assuming both 1-space
|
512
512
|
// and 8-space tab stops.
|
513
513
|
tab1Spaces++;
|
@@ -515,7 +515,7 @@ class Tokenizer {
|
|
515
515
|
isTabPresent = true;
|
516
516
|
this._cs.moveNext();
|
517
517
|
break;
|
518
|
-
case 12 /* FormFeed */:
|
518
|
+
case 12 /* Char.FormFeed */:
|
519
519
|
tab1Spaces = 0;
|
520
520
|
tab8Spaces = 0;
|
521
521
|
isTabPresent = false;
|
@@ -526,9 +526,9 @@ class Tokenizer {
|
|
526
526
|
// Non-blank line. Set the current indent level.
|
527
527
|
this._setIndent(startOffset, tab1Spaces, tab8Spaces, isSpacePresent, isTabPresent);
|
528
528
|
return;
|
529
|
-
case 35 /* Hash */:
|
530
|
-
case 10 /* LineFeed */:
|
531
|
-
case 13 /* CarriageReturn */:
|
529
|
+
case 35 /* Char.Hash */:
|
530
|
+
case 10 /* Char.LineFeed */:
|
531
|
+
case 13 /* Char.CarriageReturn */:
|
532
532
|
// Blank line -- no need to adjust indentation.
|
533
533
|
return;
|
534
534
|
}
|
@@ -658,18 +658,18 @@ class Tokenizer {
|
|
658
658
|
if ((0, characters_1.isDecimal)(this._cs.currentChar)) {
|
659
659
|
return true;
|
660
660
|
}
|
661
|
-
if (this._cs.currentChar === 46 /* Period */ && (0, characters_1.isDecimal)(this._cs.nextChar)) {
|
661
|
+
if (this._cs.currentChar === 46 /* Char.Period */ && (0, characters_1.isDecimal)(this._cs.nextChar)) {
|
662
662
|
return true;
|
663
663
|
}
|
664
664
|
return false;
|
665
665
|
}
|
666
666
|
_tryNumber() {
|
667
667
|
const start = this._cs.position;
|
668
|
-
if (this._cs.currentChar === 48 /* _0 */) {
|
668
|
+
if (this._cs.currentChar === 48 /* Char._0 */) {
|
669
669
|
let radix = 0;
|
670
670
|
let leadingChars = 0;
|
671
671
|
// Try hex => hexinteger: "0" ("x" | "X") (["_"] hexdigit)+
|
672
|
-
if ((this._cs.nextChar === 120 /* x */ || this._cs.nextChar === 88 /* X */) && (0, characters_1.isHex)(this._cs.lookAhead(2))) {
|
672
|
+
if ((this._cs.nextChar === 120 /* Char.x */ || this._cs.nextChar === 88 /* Char.X */) && (0, characters_1.isHex)(this._cs.lookAhead(2))) {
|
673
673
|
this._cs.advance(2);
|
674
674
|
leadingChars = 2;
|
675
675
|
while ((0, characters_1.isHex)(this._cs.currentChar)) {
|
@@ -678,7 +678,7 @@ class Tokenizer {
|
|
678
678
|
radix = 16;
|
679
679
|
}
|
680
680
|
// Try binary => bininteger: "0" ("b" | "B") (["_"] bindigit)+
|
681
|
-
else if ((this._cs.nextChar === 98 /* b */ || this._cs.nextChar === 66 /* B */) &&
|
681
|
+
else if ((this._cs.nextChar === 98 /* Char.b */ || this._cs.nextChar === 66 /* Char.B */) &&
|
682
682
|
(0, characters_1.isBinary)(this._cs.lookAhead(2))) {
|
683
683
|
this._cs.advance(2);
|
684
684
|
leadingChars = 2;
|
@@ -688,7 +688,7 @@ class Tokenizer {
|
|
688
688
|
radix = 2;
|
689
689
|
}
|
690
690
|
// Try octal => octinteger: "0" ("o" | "O") (["_"] octdigit)+
|
691
|
-
else if ((this._cs.nextChar === 111 /* o */ || this._cs.nextChar === 79 /* O */) && (0, characters_1.isOctal)(this._cs.lookAhead(2))) {
|
691
|
+
else if ((this._cs.nextChar === 111 /* Char.o */ || this._cs.nextChar === 79 /* Char.O */) && (0, characters_1.isOctal)(this._cs.lookAhead(2))) {
|
692
692
|
this._cs.advance(2);
|
693
693
|
leadingChars = 2;
|
694
694
|
while ((0, characters_1.isOctal)(this._cs.currentChar)) {
|
@@ -718,27 +718,27 @@ class Tokenizer {
|
|
718
718
|
// decinteger: nonzerodigit (["_"] digit)* | "0" (["_"] "0")*
|
719
719
|
// nonzerodigit: "1"..."9"
|
720
720
|
// digit: "0"..."9"
|
721
|
-
if (this._cs.currentChar >= 49 /* _1 */ && this._cs.currentChar <= 57 /* _9 */) {
|
721
|
+
if (this._cs.currentChar >= 49 /* Char._1 */ && this._cs.currentChar <= 57 /* Char._9 */) {
|
722
722
|
while ((0, characters_1.isDecimal)(this._cs.currentChar)) {
|
723
723
|
mightBeFloatingPoint = true;
|
724
724
|
this._cs.moveNext();
|
725
725
|
}
|
726
726
|
isDecimalInteger =
|
727
|
-
this._cs.currentChar !== 46 /* Period */ &&
|
728
|
-
this._cs.currentChar !== 101 /* e */ &&
|
729
|
-
this._cs.currentChar !== 69 /* E */;
|
727
|
+
this._cs.currentChar !== 46 /* Char.Period */ &&
|
728
|
+
this._cs.currentChar !== 101 /* Char.e */ &&
|
729
|
+
this._cs.currentChar !== 69 /* Char.E */;
|
730
730
|
}
|
731
731
|
// "0" (["_"] "0")*
|
732
|
-
if (this._cs.currentChar === 48 /* _0 */) {
|
732
|
+
if (this._cs.currentChar === 48 /* Char._0 */) {
|
733
733
|
mightBeFloatingPoint = true;
|
734
|
-
while (this._cs.currentChar === 48 /* _0 */ || this._cs.currentChar === 95 /* Underscore */) {
|
734
|
+
while (this._cs.currentChar === 48 /* Char._0 */ || this._cs.currentChar === 95 /* Char.Underscore */) {
|
735
735
|
this._cs.moveNext();
|
736
736
|
}
|
737
737
|
isDecimalInteger =
|
738
|
-
this._cs.currentChar !== 46 /* Period */ &&
|
739
|
-
this._cs.currentChar !== 101 /* e */ &&
|
740
|
-
this._cs.currentChar !== 69 /* E */ &&
|
741
|
-
(this._cs.currentChar < 49 /* _1 */ || this._cs.currentChar > 57 /* _9 */);
|
738
|
+
this._cs.currentChar !== 46 /* Char.Period */ &&
|
739
|
+
this._cs.currentChar !== 101 /* Char.e */ &&
|
740
|
+
this._cs.currentChar !== 69 /* Char.E */ &&
|
741
|
+
(this._cs.currentChar < 49 /* Char._1 */ || this._cs.currentChar > 57 /* Char._9 */);
|
742
742
|
}
|
743
743
|
if (isDecimalInteger) {
|
744
744
|
let text = this._cs.getText().substring(start, this._cs.position);
|
@@ -752,7 +752,7 @@ class Tokenizer {
|
|
752
752
|
bigIntValue > Number.MAX_SAFE_INTEGER) {
|
753
753
|
intValue = bigIntValue;
|
754
754
|
}
|
755
|
-
if (this._cs.currentChar === 106 /* j */ || this._cs.currentChar === 74 /* J */) {
|
755
|
+
if (this._cs.currentChar === 106 /* Char.j */ || this._cs.currentChar === 74 /* Char.J */) {
|
756
756
|
isImaginary = true;
|
757
757
|
text += String.fromCharCode(this._cs.currentChar);
|
758
758
|
this._cs.moveNext();
|
@@ -764,13 +764,13 @@ class Tokenizer {
|
|
764
764
|
// Floating point. Sign and leading digits were already skipped over.
|
765
765
|
this._cs.position = start;
|
766
766
|
if (mightBeFloatingPoint ||
|
767
|
-
(this._cs.currentChar === 46 /* Period */ && this._cs.nextChar >= 48 /* _0 */ && this._cs.nextChar <= 57 /* _9 */)) {
|
767
|
+
(this._cs.currentChar === 46 /* Char.Period */ && this._cs.nextChar >= 48 /* Char._0 */ && this._cs.nextChar <= 57 /* Char._9 */)) {
|
768
768
|
if (this._skipFloatingPointCandidate()) {
|
769
769
|
let text = this._cs.getText().substring(start, this._cs.position);
|
770
770
|
const value = parseFloat(text);
|
771
771
|
if (!isNaN(value)) {
|
772
772
|
let isImaginary = false;
|
773
|
-
if (this._cs.currentChar === 106 /* j */ || this._cs.currentChar === 74 /* J */) {
|
773
|
+
if (this._cs.currentChar === 106 /* Char.j */ || this._cs.currentChar === 74 /* Char.J */) {
|
774
774
|
isImaginary = true;
|
775
775
|
text += String.fromCharCode(this._cs.currentChar);
|
776
776
|
this._cs.moveNext();
|
@@ -789,111 +789,111 @@ class Tokenizer {
|
|
789
789
|
const nextChar = this._cs.nextChar;
|
790
790
|
let operatorType;
|
791
791
|
switch (this._cs.currentChar) {
|
792
|
-
case 43 /* Plus */:
|
793
|
-
length = nextChar === 61 /* Equal */ ? 2 : 1;
|
794
|
-
operatorType = length === 2 ? 1 /* AddEqual */ : 0 /* Add */;
|
792
|
+
case 43 /* Char.Plus */:
|
793
|
+
length = nextChar === 61 /* Char.Equal */ ? 2 : 1;
|
794
|
+
operatorType = length === 2 ? 1 /* OperatorType.AddEqual */ : 0 /* OperatorType.Add */;
|
795
795
|
break;
|
796
|
-
case 38 /* Ampersand */:
|
797
|
-
length = nextChar === 61 /* Equal */ ? 2 : 1;
|
798
|
-
operatorType = length === 2 ? 4 /* BitwiseAndEqual */ : 3 /* BitwiseAnd */;
|
796
|
+
case 38 /* Char.Ampersand */:
|
797
|
+
length = nextChar === 61 /* Char.Equal */ ? 2 : 1;
|
798
|
+
operatorType = length === 2 ? 4 /* OperatorType.BitwiseAndEqual */ : 3 /* OperatorType.BitwiseAnd */;
|
799
799
|
break;
|
800
|
-
case 124 /* Bar */:
|
801
|
-
length = nextChar === 61 /* Equal */ ? 2 : 1;
|
802
|
-
operatorType = length === 2 ? 7 /* BitwiseOrEqual */ : 6 /* BitwiseOr */;
|
800
|
+
case 124 /* Char.Bar */:
|
801
|
+
length = nextChar === 61 /* Char.Equal */ ? 2 : 1;
|
802
|
+
operatorType = length === 2 ? 7 /* OperatorType.BitwiseOrEqual */ : 6 /* OperatorType.BitwiseOr */;
|
803
803
|
break;
|
804
|
-
case 94 /* Caret */:
|
805
|
-
length = nextChar === 61 /* Equal */ ? 2 : 1;
|
806
|
-
operatorType = length === 2 ? 9 /* BitwiseXorEqual */ : 8 /* BitwiseXor */;
|
804
|
+
case 94 /* Char.Caret */:
|
805
|
+
length = nextChar === 61 /* Char.Equal */ ? 2 : 1;
|
806
|
+
operatorType = length === 2 ? 9 /* OperatorType.BitwiseXorEqual */ : 8 /* OperatorType.BitwiseXor */;
|
807
807
|
break;
|
808
|
-
case 61 /* Equal */:
|
808
|
+
case 61 /* Char.Equal */:
|
809
809
|
if (((_a = this._activeFString) === null || _a === void 0 ? void 0 : _a.activeReplacementField) &&
|
810
810
|
((_b = this._activeFString) === null || _b === void 0 ? void 0 : _b.activeReplacementField.parenDepth) === this._parenDepth &&
|
811
811
|
!this._activeFString.activeReplacementField.inFormatSpecifier &&
|
812
|
-
nextChar !== 61 /* Equal */) {
|
812
|
+
nextChar !== 61 /* Char.Equal */) {
|
813
813
|
length = 1;
|
814
|
-
operatorType = 2 /* Assign */;
|
814
|
+
operatorType = 2 /* OperatorType.Assign */;
|
815
815
|
break;
|
816
816
|
}
|
817
|
-
length = nextChar === 61 /* Equal */ ? 2 : 1;
|
818
|
-
operatorType = length === 2 ? 12 /* Equals */ : 2 /* Assign */;
|
817
|
+
length = nextChar === 61 /* Char.Equal */ ? 2 : 1;
|
818
|
+
operatorType = length === 2 ? 12 /* OperatorType.Equals */ : 2 /* OperatorType.Assign */;
|
819
819
|
break;
|
820
|
-
case 33 /* ExclamationMark */:
|
821
|
-
if (nextChar !== 61 /* Equal */) {
|
820
|
+
case 33 /* Char.ExclamationMark */:
|
821
|
+
if (nextChar !== 61 /* Char.Equal */) {
|
822
822
|
if (this._activeFString) {
|
823
823
|
// Handle the conversion separator (!) within an f-string.
|
824
|
-
this._tokens.push(tokenizerTypes_1.Token.create(23 /* ExclamationMark */, this._cs.position, 1, this._getComments()));
|
824
|
+
this._tokens.push(tokenizerTypes_1.Token.create(23 /* TokenType.ExclamationMark */, this._cs.position, 1, this._getComments()));
|
825
825
|
this._cs.advance(1);
|
826
826
|
return true;
|
827
827
|
}
|
828
828
|
return false;
|
829
829
|
}
|
830
830
|
length = 2;
|
831
|
-
operatorType = 28 /* NotEquals */;
|
831
|
+
operatorType = 28 /* OperatorType.NotEquals */;
|
832
832
|
break;
|
833
|
-
case 37 /* Percent */:
|
834
|
-
length = nextChar === 61 /* Equal */ ? 2 : 1;
|
835
|
-
operatorType = length === 2 ? 25 /* ModEqual */ : 24 /* Mod */;
|
833
|
+
case 37 /* Char.Percent */:
|
834
|
+
length = nextChar === 61 /* Char.Equal */ ? 2 : 1;
|
835
|
+
operatorType = length === 2 ? 25 /* OperatorType.ModEqual */ : 24 /* OperatorType.Mod */;
|
836
836
|
break;
|
837
|
-
case 126 /* Tilde */:
|
837
|
+
case 126 /* Char.Tilde */:
|
838
838
|
length = 1;
|
839
|
-
operatorType = 5 /* BitwiseInvert */;
|
839
|
+
operatorType = 5 /* OperatorType.BitwiseInvert */;
|
840
840
|
break;
|
841
|
-
case 45 /* Hyphen */:
|
842
|
-
if (nextChar === 62 /* Greater */) {
|
843
|
-
this._tokens.push(tokenizerTypes_1.Token.create(21 /* Arrow */, this._cs.position, 2, this._getComments()));
|
841
|
+
case 45 /* Char.Hyphen */:
|
842
|
+
if (nextChar === 62 /* Char.Greater */) {
|
843
|
+
this._tokens.push(tokenizerTypes_1.Token.create(21 /* TokenType.Arrow */, this._cs.position, 2, this._getComments()));
|
844
844
|
this._cs.advance(2);
|
845
845
|
return true;
|
846
846
|
}
|
847
|
-
length = nextChar === 61 /* Equal */ ? 2 : 1;
|
848
|
-
operatorType = length === 2 ? 34 /* SubtractEqual */ : 33 /* Subtract */;
|
847
|
+
length = nextChar === 61 /* Char.Equal */ ? 2 : 1;
|
848
|
+
operatorType = length === 2 ? 34 /* OperatorType.SubtractEqual */ : 33 /* OperatorType.Subtract */;
|
849
849
|
break;
|
850
|
-
case 42 /* Asterisk */:
|
851
|
-
if (nextChar === 42 /* Asterisk */) {
|
852
|
-
length = this._cs.lookAhead(2) === 61 /* Equal */ ? 3 : 2;
|
853
|
-
operatorType = length === 3 ? 30 /* PowerEqual */ : 29 /* Power */;
|
850
|
+
case 42 /* Char.Asterisk */:
|
851
|
+
if (nextChar === 42 /* Char.Asterisk */) {
|
852
|
+
length = this._cs.lookAhead(2) === 61 /* Char.Equal */ ? 3 : 2;
|
853
|
+
operatorType = length === 3 ? 30 /* OperatorType.PowerEqual */ : 29 /* OperatorType.Power */;
|
854
854
|
}
|
855
855
|
else {
|
856
|
-
length = nextChar === 61 /* Equal */ ? 2 : 1;
|
857
|
-
operatorType = length === 2 ? 27 /* MultiplyEqual */ : 26 /* Multiply */;
|
856
|
+
length = nextChar === 61 /* Char.Equal */ ? 2 : 1;
|
857
|
+
operatorType = length === 2 ? 27 /* OperatorType.MultiplyEqual */ : 26 /* OperatorType.Multiply */;
|
858
858
|
}
|
859
859
|
break;
|
860
|
-
case 47 /* Slash */:
|
861
|
-
if (nextChar === 47 /* Slash */) {
|
862
|
-
length = this._cs.lookAhead(2) === 61 /* Equal */ ? 3 : 2;
|
863
|
-
operatorType = length === 3 ? 14 /* FloorDivideEqual */ : 13 /* FloorDivide */;
|
860
|
+
case 47 /* Char.Slash */:
|
861
|
+
if (nextChar === 47 /* Char.Slash */) {
|
862
|
+
length = this._cs.lookAhead(2) === 61 /* Char.Equal */ ? 3 : 2;
|
863
|
+
operatorType = length === 3 ? 14 /* OperatorType.FloorDivideEqual */ : 13 /* OperatorType.FloorDivide */;
|
864
864
|
}
|
865
865
|
else {
|
866
|
-
length = nextChar === 61 /* Equal */ ? 2 : 1;
|
867
|
-
operatorType = length === 2 ? 11 /* DivideEqual */ : 10 /* Divide */;
|
866
|
+
length = nextChar === 61 /* Char.Equal */ ? 2 : 1;
|
867
|
+
operatorType = length === 2 ? 11 /* OperatorType.DivideEqual */ : 10 /* OperatorType.Divide */;
|
868
868
|
}
|
869
869
|
break;
|
870
|
-
case 60 /* Less */:
|
871
|
-
if (nextChar === 60 /* Less */) {
|
872
|
-
length = this._cs.lookAhead(2) === 61 /* Equal */ ? 3 : 2;
|
873
|
-
operatorType = length === 3 ? 18 /* LeftShiftEqual */ : 17 /* LeftShift */;
|
870
|
+
case 60 /* Char.Less */:
|
871
|
+
if (nextChar === 60 /* Char.Less */) {
|
872
|
+
length = this._cs.lookAhead(2) === 61 /* Char.Equal */ ? 3 : 2;
|
873
|
+
operatorType = length === 3 ? 18 /* OperatorType.LeftShiftEqual */ : 17 /* OperatorType.LeftShift */;
|
874
874
|
}
|
875
|
-
else if (nextChar === 62 /* Greater */) {
|
875
|
+
else if (nextChar === 62 /* Char.Greater */) {
|
876
876
|
length = 2;
|
877
|
-
operatorType = 19 /* LessOrGreaterThan */;
|
877
|
+
operatorType = 19 /* OperatorType.LessOrGreaterThan */;
|
878
878
|
}
|
879
879
|
else {
|
880
|
-
length = nextChar === 61 /* Equal */ ? 2 : 1;
|
881
|
-
operatorType = length === 2 ? 21 /* LessThanOrEqual */ : 20 /* LessThan */;
|
880
|
+
length = nextChar === 61 /* Char.Equal */ ? 2 : 1;
|
881
|
+
operatorType = length === 2 ? 21 /* OperatorType.LessThanOrEqual */ : 20 /* OperatorType.LessThan */;
|
882
882
|
}
|
883
883
|
break;
|
884
|
-
case 62 /* Greater */:
|
885
|
-
if (nextChar === 62 /* Greater */) {
|
886
|
-
length = this._cs.lookAhead(2) === 61 /* Equal */ ? 3 : 2;
|
887
|
-
operatorType = length === 3 ? 32 /* RightShiftEqual */ : 31 /* RightShift */;
|
884
|
+
case 62 /* Char.Greater */:
|
885
|
+
if (nextChar === 62 /* Char.Greater */) {
|
886
|
+
length = this._cs.lookAhead(2) === 61 /* Char.Equal */ ? 3 : 2;
|
887
|
+
operatorType = length === 3 ? 32 /* OperatorType.RightShiftEqual */ : 31 /* OperatorType.RightShift */;
|
888
888
|
}
|
889
889
|
else {
|
890
|
-
length = nextChar === 61 /* Equal */ ? 2 : 1;
|
891
|
-
operatorType = length === 2 ? 16 /* GreaterThanOrEqual */ : 15 /* GreaterThan */;
|
890
|
+
length = nextChar === 61 /* Char.Equal */ ? 2 : 1;
|
891
|
+
operatorType = length === 2 ? 16 /* OperatorType.GreaterThanOrEqual */ : 15 /* OperatorType.GreaterThan */;
|
892
892
|
}
|
893
893
|
break;
|
894
|
-
case 64 /* At */:
|
895
|
-
length = nextChar === 61 /* Equal */ ? 2 : 1;
|
896
|
-
operatorType = length === 2 ? 23 /* MatrixMultiplyEqual */ : 22 /* MatrixMultiply */;
|
894
|
+
case 64 /* Char.At */:
|
895
|
+
length = nextChar === 61 /* Char.Equal */ ? 2 : 1;
|
896
|
+
operatorType = length === 2 ? 23 /* OperatorType.MatrixMultiplyEqual */ : 22 /* OperatorType.MatrixMultiply */;
|
897
897
|
break;
|
898
898
|
default:
|
899
899
|
return false;
|
@@ -905,8 +905,8 @@ class Tokenizer {
|
|
905
905
|
_handleInvalid() {
|
906
906
|
const start = this._cs.position;
|
907
907
|
while (true) {
|
908
|
-
if (this._cs.currentChar === 10 /* LineFeed */ ||
|
909
|
-
this._cs.currentChar === 13 /* CarriageReturn */ ||
|
908
|
+
if (this._cs.currentChar === 10 /* Char.LineFeed */ ||
|
909
|
+
this._cs.currentChar === 13 /* Char.CarriageReturn */ ||
|
910
910
|
this._cs.isAtWhiteSpace() ||
|
911
911
|
this._cs.isEndOfStream()) {
|
912
912
|
break;
|
@@ -921,7 +921,7 @@ class Tokenizer {
|
|
921
921
|
}
|
922
922
|
const length = this._cs.position - start;
|
923
923
|
if (length > 0) {
|
924
|
-
this._tokens.push(tokenizerTypes_1.Token.create(0 /* Invalid */, start, length, this._getComments()));
|
924
|
+
this._tokens.push(tokenizerTypes_1.Token.create(0 /* TokenType.Invalid */, start, length, this._getComments()));
|
925
925
|
return true;
|
926
926
|
}
|
927
927
|
return false;
|
@@ -946,7 +946,7 @@ class Tokenizer {
|
|
946
946
|
}
|
947
947
|
return 'line';
|
948
948
|
function isMagicChar(ch) {
|
949
|
-
return ch === 37 /* Percent */ || ch === 33 /* ExclamationMark */;
|
949
|
+
return ch === 37 /* Char.Percent */ || ch === 33 /* Char.ExclamationMark */;
|
950
950
|
}
|
951
951
|
}
|
952
952
|
_handleIPythonMagics(type) {
|
@@ -954,7 +954,7 @@ class Tokenizer {
|
|
954
954
|
let begin = start;
|
955
955
|
do {
|
956
956
|
this._cs.skipToEol();
|
957
|
-
if (type === 1 /* IPythonMagic */ || type === 2 /* IPythonShellEscape */) {
|
957
|
+
if (type === 1 /* CommentType.IPythonMagic */ || type === 2 /* CommentType.IPythonShellEscape */) {
|
958
958
|
const length = this._cs.position - begin;
|
959
959
|
const value = this._cs.getText().substring(begin, begin + length);
|
960
960
|
// is it multiline magics?
|
@@ -990,7 +990,7 @@ class Tokenizer {
|
|
990
990
|
range: textRange,
|
991
991
|
rulesList: this._getIgnoreCommentRulesList(commentStart, typeIgnoreRegexMatch),
|
992
992
|
};
|
993
|
-
if (this._tokens.findIndex((t) => t.type !== 2 /* NewLine */ && t && t.type !== 3 /* Indent */) < 0) {
|
993
|
+
if (this._tokens.findIndex((t) => t.type !== 2 /* TokenType.NewLine */ && t && t.type !== 3 /* TokenType.Indent */) < 0) {
|
994
994
|
this._typeIgnoreAll = ignoreComment;
|
995
995
|
}
|
996
996
|
else {
|
@@ -1043,27 +1043,27 @@ class Tokenizer {
|
|
1043
1043
|
}
|
1044
1044
|
}
|
1045
1045
|
_getStringPrefixLength() {
|
1046
|
-
if (this._cs.currentChar === 39 /* SingleQuote */ || this._cs.currentChar === 34 /* DoubleQuote */) {
|
1046
|
+
if (this._cs.currentChar === 39 /* Char.SingleQuote */ || this._cs.currentChar === 34 /* Char.DoubleQuote */) {
|
1047
1047
|
// Simple string, no prefix
|
1048
1048
|
return 0;
|
1049
1049
|
}
|
1050
|
-
if (this._cs.nextChar === 39 /* SingleQuote */ || this._cs.nextChar === 34 /* DoubleQuote */) {
|
1050
|
+
if (this._cs.nextChar === 39 /* Char.SingleQuote */ || this._cs.nextChar === 34 /* Char.DoubleQuote */) {
|
1051
1051
|
switch (this._cs.currentChar) {
|
1052
|
-
case 102 /* f */:
|
1053
|
-
case 70 /* F */:
|
1054
|
-
case 114 /* r */:
|
1055
|
-
case 82 /* R */:
|
1056
|
-
case 98 /* b */:
|
1057
|
-
case 66 /* B */:
|
1058
|
-
case 117 /* u */:
|
1059
|
-
case 85 /* U */:
|
1052
|
+
case 102 /* Char.f */:
|
1053
|
+
case 70 /* Char.F */:
|
1054
|
+
case 114 /* Char.r */:
|
1055
|
+
case 82 /* Char.R */:
|
1056
|
+
case 98 /* Char.b */:
|
1057
|
+
case 66 /* Char.B */:
|
1058
|
+
case 117 /* Char.u */:
|
1059
|
+
case 85 /* Char.U */:
|
1060
1060
|
// Single-char prefix like u"" or r""
|
1061
1061
|
return 1;
|
1062
1062
|
default:
|
1063
1063
|
break;
|
1064
1064
|
}
|
1065
1065
|
}
|
1066
|
-
if (this._cs.lookAhead(2) === 39 /* SingleQuote */ || this._cs.lookAhead(2) === 34 /* DoubleQuote */) {
|
1066
|
+
if (this._cs.lookAhead(2) === 39 /* Char.SingleQuote */ || this._cs.lookAhead(2) === 34 /* Char.DoubleQuote */) {
|
1067
1067
|
const prefix = this._cs
|
1068
1068
|
.getText()
|
1069
1069
|
.substring(this._cs.position, this._cs.position + 2)
|
@@ -1083,34 +1083,34 @@ class Tokenizer {
|
|
1083
1083
|
return -1;
|
1084
1084
|
}
|
1085
1085
|
_getQuoteTypeFlags(prefix) {
|
1086
|
-
let flags = 0 /* None */;
|
1086
|
+
let flags = 0 /* StringTokenFlags.None */;
|
1087
1087
|
prefix = prefix.toLowerCase();
|
1088
1088
|
for (let i = 0; i < prefix.length; i++) {
|
1089
1089
|
switch (prefix[i]) {
|
1090
1090
|
case 'u':
|
1091
|
-
flags |= 16 /* Unicode */;
|
1091
|
+
flags |= 16 /* StringTokenFlags.Unicode */;
|
1092
1092
|
break;
|
1093
1093
|
case 'b':
|
1094
|
-
flags |= 32 /* Bytes */;
|
1094
|
+
flags |= 32 /* StringTokenFlags.Bytes */;
|
1095
1095
|
break;
|
1096
1096
|
case 'r':
|
1097
|
-
flags |= 8 /* Raw */;
|
1097
|
+
flags |= 8 /* StringTokenFlags.Raw */;
|
1098
1098
|
break;
|
1099
1099
|
case 'f':
|
1100
|
-
flags |= 64 /* Format */;
|
1100
|
+
flags |= 64 /* StringTokenFlags.Format */;
|
1101
1101
|
break;
|
1102
1102
|
}
|
1103
1103
|
}
|
1104
|
-
if (this._cs.currentChar === 39 /* SingleQuote */) {
|
1105
|
-
flags |= 1 /* SingleQuote */;
|
1106
|
-
if (this._cs.nextChar === 39 /* SingleQuote */ && this._cs.lookAhead(2) === 39 /* SingleQuote */) {
|
1107
|
-
flags |= 4 /* Triplicate */;
|
1104
|
+
if (this._cs.currentChar === 39 /* Char.SingleQuote */) {
|
1105
|
+
flags |= 1 /* StringTokenFlags.SingleQuote */;
|
1106
|
+
if (this._cs.nextChar === 39 /* Char.SingleQuote */ && this._cs.lookAhead(2) === 39 /* Char.SingleQuote */) {
|
1107
|
+
flags |= 4 /* StringTokenFlags.Triplicate */;
|
1108
1108
|
}
|
1109
1109
|
}
|
1110
|
-
else if (this._cs.currentChar === 34 /* DoubleQuote */) {
|
1111
|
-
flags |= 2 /* DoubleQuote */;
|
1112
|
-
if (this._cs.nextChar === 34 /* DoubleQuote */ && this._cs.lookAhead(2) === 34 /* DoubleQuote */) {
|
1113
|
-
flags |= 4 /* Triplicate */;
|
1110
|
+
else if (this._cs.currentChar === 34 /* Char.DoubleQuote */) {
|
1111
|
+
flags |= 2 /* StringTokenFlags.DoubleQuote */;
|
1112
|
+
if (this._cs.nextChar === 34 /* Char.DoubleQuote */ && this._cs.lookAhead(2) === 34 /* Char.DoubleQuote */) {
|
1113
|
+
flags |= 4 /* StringTokenFlags.Triplicate */;
|
1114
1114
|
}
|
1115
1115
|
}
|
1116
1116
|
return flags;
|
@@ -1118,8 +1118,8 @@ class Tokenizer {
|
|
1118
1118
|
_handleString(flags, stringPrefixLength) {
|
1119
1119
|
var _a;
|
1120
1120
|
const start = this._cs.position - stringPrefixLength;
|
1121
|
-
if (flags & 64 /* Format */) {
|
1122
|
-
if (flags & 4 /* Triplicate */) {
|
1121
|
+
if (flags & 64 /* StringTokenFlags.Format */) {
|
1122
|
+
if (flags & 4 /* StringTokenFlags.Triplicate */) {
|
1123
1123
|
this._cs.advance(3);
|
1124
1124
|
}
|
1125
1125
|
else {
|
@@ -1139,12 +1139,12 @@ class Tokenizer {
|
|
1139
1139
|
this._tokens.push(fStringStartToken);
|
1140
1140
|
}
|
1141
1141
|
else {
|
1142
|
-
if (flags & 4 /* Triplicate */) {
|
1142
|
+
if (flags & 4 /* StringTokenFlags.Triplicate */) {
|
1143
1143
|
this._cs.advance(3);
|
1144
1144
|
}
|
1145
1145
|
else {
|
1146
1146
|
this._cs.moveNext();
|
1147
|
-
if (flags & 1 /* SingleQuote */) {
|
1147
|
+
if (flags & 1 /* StringTokenFlags.SingleQuote */) {
|
1148
1148
|
this._singleQuoteCount++;
|
1149
1149
|
}
|
1150
1150
|
else {
|
@@ -1157,15 +1157,15 @@ class Tokenizer {
|
|
1157
1157
|
// of an active f-string. If so, we'll treat it as an f-string end
|
1158
1158
|
// token rather than an unterminated regular string. This helps with
|
1159
1159
|
// parse error recovery if a closing bracket is missing in an f-string.
|
1160
|
-
if ((stringLiteralInfo.flags & 65536 /* Unterminated */) !== 0 &&
|
1160
|
+
if ((stringLiteralInfo.flags & 65536 /* StringTokenFlags.Unterminated */) !== 0 &&
|
1161
1161
|
((_a = this._activeFString) === null || _a === void 0 ? void 0 : _a.activeReplacementField)) {
|
1162
1162
|
if ((flags &
|
1163
|
-
(32 /* Bytes */ |
|
1164
|
-
16 /* Unicode */ |
|
1165
|
-
8 /* Raw */ |
|
1166
|
-
64 /* Format */)) ===
|
1163
|
+
(32 /* StringTokenFlags.Bytes */ |
|
1164
|
+
16 /* StringTokenFlags.Unicode */ |
|
1165
|
+
8 /* StringTokenFlags.Raw */ |
|
1166
|
+
64 /* StringTokenFlags.Format */)) ===
|
1167
1167
|
0) {
|
1168
|
-
const quoteTypeMask = 4 /* Triplicate */ | 2 /* DoubleQuote */ | 1 /* SingleQuote */;
|
1168
|
+
const quoteTypeMask = 4 /* StringTokenFlags.Triplicate */ | 2 /* StringTokenFlags.DoubleQuote */ | 1 /* StringTokenFlags.SingleQuote */;
|
1169
1169
|
if ((this._activeFString.startToken.flags & quoteTypeMask) === (flags & quoteTypeMask)) {
|
1170
1170
|
// Unwind to the start of this string token and terminate any replacement fields
|
1171
1171
|
// that are active. This will cause the tokenizer to re-process the quote as an
|
@@ -1193,9 +1193,9 @@ class Tokenizer {
|
|
1193
1193
|
const flags = activeFString.startToken.flags;
|
1194
1194
|
const stringLiteralInfo = this._skipToEndOfStringLiteral(flags, inFormatSpecifier);
|
1195
1195
|
const end = this._cs.position;
|
1196
|
-
const isUnterminated = (stringLiteralInfo.flags & 65536 /* Unterminated */) !== 0;
|
1197
|
-
const sawReplacementFieldStart = (stringLiteralInfo.flags & 128 /* ReplacementFieldStart */) !== 0;
|
1198
|
-
const sawReplacementFieldEnd = (stringLiteralInfo.flags & 256 /* ReplacementFieldEnd */) !== 0;
|
1196
|
+
const isUnterminated = (stringLiteralInfo.flags & 65536 /* StringTokenFlags.Unterminated */) !== 0;
|
1197
|
+
const sawReplacementFieldStart = (stringLiteralInfo.flags & 128 /* StringTokenFlags.ReplacementFieldStart */) !== 0;
|
1198
|
+
const sawReplacementFieldEnd = (stringLiteralInfo.flags & 256 /* StringTokenFlags.ReplacementFieldEnd */) !== 0;
|
1199
1199
|
const sawEndQuote = !isUnterminated && !sawReplacementFieldStart && !sawReplacementFieldEnd;
|
1200
1200
|
let middleTokenLength = end - start;
|
1201
1201
|
if (sawEndQuote) {
|
@@ -1213,39 +1213,39 @@ class Tokenizer {
|
|
1213
1213
|
}
|
1214
1214
|
}
|
1215
1215
|
_skipToEndOfStringLiteral(flags, inFormatSpecifier = false) {
|
1216
|
-
const quoteChar = flags & 1 /* SingleQuote */ ? 39 /* SingleQuote */ : 34 /* DoubleQuote */;
|
1217
|
-
const isTriplicate = (flags & 4 /* Triplicate */) !== 0;
|
1218
|
-
const isFString = (flags & 64 /* Format */) !== 0;
|
1216
|
+
const quoteChar = flags & 1 /* StringTokenFlags.SingleQuote */ ? 39 /* Char.SingleQuote */ : 34 /* Char.DoubleQuote */;
|
1217
|
+
const isTriplicate = (flags & 4 /* StringTokenFlags.Triplicate */) !== 0;
|
1218
|
+
const isFString = (flags & 64 /* StringTokenFlags.Format */) !== 0;
|
1219
1219
|
let isInNamedUnicodeEscape = false;
|
1220
1220
|
let escapedValueParts = [];
|
1221
1221
|
while (true) {
|
1222
1222
|
if (this._cs.isEndOfStream()) {
|
1223
1223
|
// Hit the end of file without a termination.
|
1224
|
-
flags |= 65536 /* Unterminated */;
|
1224
|
+
flags |= 65536 /* StringTokenFlags.Unterminated */;
|
1225
1225
|
return { escapedValue: String.fromCharCode.apply(undefined, escapedValueParts), flags };
|
1226
1226
|
}
|
1227
|
-
if (this._cs.currentChar === 92 /* Backslash */) {
|
1227
|
+
if (this._cs.currentChar === 92 /* Char.Backslash */) {
|
1228
1228
|
escapedValueParts.push(this._cs.currentChar);
|
1229
1229
|
// Move past the escape (backslash) character.
|
1230
1230
|
this._cs.moveNext();
|
1231
1231
|
// Handle the special escape sequence /N{name} for unicode characters.
|
1232
1232
|
if (!isInNamedUnicodeEscape &&
|
1233
|
-
this._cs.getCurrentChar() === 78 /* N */ &&
|
1234
|
-
this._cs.nextChar === 123 /* OpenBrace */) {
|
1233
|
+
this._cs.getCurrentChar() === 78 /* Char.N */ &&
|
1234
|
+
this._cs.nextChar === 123 /* Char.OpenBrace */) {
|
1235
1235
|
isInNamedUnicodeEscape = true;
|
1236
1236
|
}
|
1237
1237
|
else {
|
1238
1238
|
// If this is an f-string, the only escapes that are allowed is for
|
1239
1239
|
// a single or double quote symbol or a newline/carriage return.
|
1240
|
-
const isEscapedQuote = this._cs.getCurrentChar() === 39 /* SingleQuote */ ||
|
1241
|
-
this._cs.getCurrentChar() === 34 /* DoubleQuote */;
|
1242
|
-
const isEscapedNewLine = this._cs.getCurrentChar() === 13 /* CarriageReturn */ ||
|
1243
|
-
this._cs.getCurrentChar() === 10 /* LineFeed */;
|
1244
|
-
const isEscapedBackslash = this._cs.getCurrentChar() === 92 /* Backslash */;
|
1240
|
+
const isEscapedQuote = this._cs.getCurrentChar() === 39 /* Char.SingleQuote */ ||
|
1241
|
+
this._cs.getCurrentChar() === 34 /* Char.DoubleQuote */;
|
1242
|
+
const isEscapedNewLine = this._cs.getCurrentChar() === 13 /* Char.CarriageReturn */ ||
|
1243
|
+
this._cs.getCurrentChar() === 10 /* Char.LineFeed */;
|
1244
|
+
const isEscapedBackslash = this._cs.getCurrentChar() === 92 /* Char.Backslash */;
|
1245
1245
|
if (!isFString || isEscapedBackslash || isEscapedQuote || isEscapedNewLine) {
|
1246
1246
|
if (isEscapedNewLine) {
|
1247
|
-
if (this._cs.getCurrentChar() === 13 /* CarriageReturn */ &&
|
1248
|
-
this._cs.nextChar === 10 /* LineFeed */) {
|
1247
|
+
if (this._cs.getCurrentChar() === 13 /* Char.CarriageReturn */ &&
|
1248
|
+
this._cs.nextChar === 10 /* Char.LineFeed */) {
|
1249
1249
|
escapedValueParts.push(this._cs.currentChar);
|
1250
1250
|
this._cs.moveNext();
|
1251
1251
|
}
|
@@ -1260,14 +1260,14 @@ class Tokenizer {
|
|
1260
1260
|
}
|
1261
1261
|
}
|
1262
1262
|
}
|
1263
|
-
else if (this._cs.currentChar === 10 /* LineFeed */ || this._cs.currentChar === 13 /* CarriageReturn */) {
|
1263
|
+
else if (this._cs.currentChar === 10 /* Char.LineFeed */ || this._cs.currentChar === 13 /* Char.CarriageReturn */) {
|
1264
1264
|
if (!isTriplicate && !isFString) {
|
1265
1265
|
// Unterminated single-line string
|
1266
|
-
flags |= 65536 /* Unterminated */;
|
1266
|
+
flags |= 65536 /* StringTokenFlags.Unterminated */;
|
1267
1267
|
return { escapedValue: String.fromCharCode.apply(undefined, escapedValueParts), flags };
|
1268
1268
|
}
|
1269
1269
|
// Skip over the new line (either one or two characters).
|
1270
|
-
if (this._cs.currentChar === 13 /* CarriageReturn */ && this._cs.nextChar === 10 /* LineFeed */) {
|
1270
|
+
if (this._cs.currentChar === 13 /* Char.CarriageReturn */ && this._cs.nextChar === 10 /* Char.LineFeed */) {
|
1271
1271
|
escapedValueParts.push(this._cs.currentChar);
|
1272
1272
|
this._cs.moveNext();
|
1273
1273
|
}
|
@@ -1286,9 +1286,9 @@ class Tokenizer {
|
|
1286
1286
|
this._cs.advance(3);
|
1287
1287
|
break;
|
1288
1288
|
}
|
1289
|
-
else if (!isInNamedUnicodeEscape && isFString && this._cs.currentChar === 123 /* OpenBrace */) {
|
1290
|
-
if (inFormatSpecifier || this._cs.nextChar !== 123 /* OpenBrace */) {
|
1291
|
-
flags |= 128 /* ReplacementFieldStart */;
|
1289
|
+
else if (!isInNamedUnicodeEscape && isFString && this._cs.currentChar === 123 /* Char.OpenBrace */) {
|
1290
|
+
if (inFormatSpecifier || this._cs.nextChar !== 123 /* Char.OpenBrace */) {
|
1291
|
+
flags |= 128 /* StringTokenFlags.ReplacementFieldStart */;
|
1292
1292
|
break;
|
1293
1293
|
}
|
1294
1294
|
else {
|
@@ -1298,14 +1298,14 @@ class Tokenizer {
|
|
1298
1298
|
this._cs.moveNext();
|
1299
1299
|
}
|
1300
1300
|
}
|
1301
|
-
else if (isInNamedUnicodeEscape && this._cs.currentChar === 125 /* CloseBrace */) {
|
1301
|
+
else if (isInNamedUnicodeEscape && this._cs.currentChar === 125 /* Char.CloseBrace */) {
|
1302
1302
|
isInNamedUnicodeEscape = false;
|
1303
1303
|
escapedValueParts.push(this._cs.currentChar);
|
1304
1304
|
this._cs.moveNext();
|
1305
1305
|
}
|
1306
|
-
else if (isFString && this._cs.currentChar === 125 /* CloseBrace */) {
|
1307
|
-
if (inFormatSpecifier || this._cs.nextChar !== 125 /* CloseBrace */) {
|
1308
|
-
flags |= 256 /* ReplacementFieldEnd */;
|
1306
|
+
else if (isFString && this._cs.currentChar === 125 /* Char.CloseBrace */) {
|
1307
|
+
if (inFormatSpecifier || this._cs.nextChar !== 125 /* Char.CloseBrace */) {
|
1308
|
+
flags |= 256 /* StringTokenFlags.ReplacementFieldEnd */;
|
1309
1309
|
break;
|
1310
1310
|
}
|
1311
1311
|
else {
|
@@ -1326,7 +1326,7 @@ class Tokenizer {
|
|
1326
1326
|
// a string literal or a docstring, so this should be fine.
|
1327
1327
|
if (escapedValueParts.length > exports.maxStringTokenLength) {
|
1328
1328
|
escapedValueParts = escapedValueParts.slice(0, exports.maxStringTokenLength);
|
1329
|
-
flags |= 131072 /* ExceedsMaxSize */;
|
1329
|
+
flags |= 131072 /* StringTokenFlags.ExceedsMaxSize */;
|
1330
1330
|
}
|
1331
1331
|
return { escapedValue: String.fromCharCode.apply(undefined, escapedValueParts), flags };
|
1332
1332
|
}
|
@@ -1336,7 +1336,7 @@ class Tokenizer {
|
|
1336
1336
|
this._skipFractionalNumber();
|
1337
1337
|
if (this._cs.position > start) {
|
1338
1338
|
// Optional exponent sign
|
1339
|
-
if (this._cs.currentChar === 101 /* e */ || this._cs.currentChar === 69 /* E */) {
|
1339
|
+
if (this._cs.currentChar === 101 /* Char.e */ || this._cs.currentChar === 69 /* Char.E */) {
|
1340
1340
|
this._cs.moveNext();
|
1341
1341
|
// Skip exponent value
|
1342
1342
|
this._skipDecimalNumber(/* allowSign */ true);
|
@@ -1346,14 +1346,14 @@ class Tokenizer {
|
|
1346
1346
|
}
|
1347
1347
|
_skipFractionalNumber() {
|
1348
1348
|
this._skipDecimalNumber(false);
|
1349
|
-
if (this._cs.currentChar === 46 /* Period */) {
|
1349
|
+
if (this._cs.currentChar === 46 /* Char.Period */) {
|
1350
1350
|
// Optional period
|
1351
1351
|
this._cs.moveNext();
|
1352
1352
|
}
|
1353
1353
|
this._skipDecimalNumber(false);
|
1354
1354
|
}
|
1355
1355
|
_skipDecimalNumber(allowSign) {
|
1356
|
-
if (allowSign && (this._cs.currentChar === 45 /* Hyphen */ || this._cs.currentChar === 43 /* Plus */)) {
|
1356
|
+
if (allowSign && (this._cs.currentChar === 45 /* Char.Hyphen */ || this._cs.currentChar === 43 /* Char.Plus */)) {
|
1357
1357
|
// Optional sign
|
1358
1358
|
this._cs.moveNext();
|
1359
1359
|
}
|