diff --git a/src/Program.spec.ts b/src/Program.spec.ts index f327f8d47..638dfe60c 100644 --- a/src/Program.spec.ts +++ b/src/Program.spec.ts @@ -15,8 +15,10 @@ import { EmptyStatement } from './parser/Statement'; import { expectDiagnostics, expectHasDiagnostics, expectZeroDiagnostics, trim, trimMap } from './testHelpers.spec'; import { doesNotThrow } from 'assert'; import { Logger } from './Logger'; -import { createToken, createVisitor, isBrsFile, WalkMode } from './astUtils'; -import { TokenKind } from './lexer'; +import { createToken } from './astUtils/creators'; +import { createVisitor, WalkMode } from './astUtils/visitors'; +import { isBrsFile } from './astUtils/reflection'; +import { TokenKind } from './lexer/TokenKind'; import type { LiteralExpression } from './parser/Expression'; let sinon = sinonImport.createSandbox(); diff --git a/src/Program.ts b/src/Program.ts index c352f2d2a..94e32b6ed 100644 --- a/src/Program.ts +++ b/src/Program.ts @@ -22,8 +22,8 @@ import { URI } from 'vscode-uri'; import PluginInterface from './PluginInterface'; import { isBrsFile, isXmlFile, isClassMethodStatement, isXmlScope } from './astUtils/reflection'; import type { FunctionStatement, Statement } from './parser/Statement'; -import { ParseMode } from './parser'; -import { TokenKind } from './lexer'; +import { ParseMode } from './parser/Parser'; +import { TokenKind } from './lexer/TokenKind'; import { BscPlugin } from './bscPlugin/BscPlugin'; import { AstEditor } from './astUtils/AstEditor'; const startOfSourcePkgPath = `source${path.sep}`; diff --git a/src/ProgramBuilder.spec.ts b/src/ProgramBuilder.spec.ts index 7fc4debc0..16dd5709f 100644 --- a/src/ProgramBuilder.spec.ts +++ b/src/ProgramBuilder.spec.ts @@ -9,7 +9,7 @@ import { Logger, LogLevel } from './Logger'; import * as diagnosticUtils from './diagnosticUtils'; import type { BscFile, BsDiagnostic } from '.'; import { Range } from '.'; -import { DiagnosticSeverity } from './astUtils'; +import { DiagnosticSeverity } from 'vscode-languageserver'; import { BrsFile } from './files/BrsFile'; import { expectZeroDiagnostics } from './testHelpers.spec'; diff --git a/src/Scope.spec.ts b/src/Scope.spec.ts index 6ca9bae3b..1dab9e47b 100644 --- a/src/Scope.spec.ts +++ b/src/Scope.spec.ts @@ -9,7 +9,7 @@ import PluginInterface from './PluginInterface'; import { expectDiagnostics, expectZeroDiagnostics, trim } from './testHelpers.spec'; import { Logger } from './Logger'; import type { BrsFile } from './files/BrsFile'; -import type { FunctionStatement, NamespaceStatement } from './parser'; +import type { FunctionStatement, NamespaceStatement } from './parser/Statement'; describe('Scope', () => { let sinon = sinonImport.createSandbox(); diff --git a/src/Scope.ts b/src/Scope.ts index b2dde21c9..4caa1c6ff 100644 --- a/src/Scope.ts +++ b/src/Scope.ts @@ -7,8 +7,9 @@ import { DiagnosticMessages } from './DiagnosticMessages'; import type { CallableContainer, BsDiagnostic, FileReference, BscFile, CallableContainerMap } from './interfaces'; import type { FileLink, Program } from './Program'; import { BsClassValidator } from './validators/ClassValidator'; -import type { NamespaceStatement, Statement, NewExpression, FunctionStatement, ClassStatement } from './parser'; -import { ParseMode } from './parser'; +import type { NamespaceStatement, Statement, FunctionStatement, ClassStatement } from './parser/Statement'; +import type { NewExpression } from './parser/Expression'; +import { ParseMode } from './parser/Parser'; import { standardizePath as s, util } from './util'; import { globalCallableMap } from './globalCallables'; import { Cache } from './Cache'; diff --git a/src/astUtils/index.ts b/src/astUtils/index.ts deleted file mode 100644 index 7186b4772..000000000 --- a/src/astUtils/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Range, Position, CancellationToken, CancellationTokenSource, DiagnosticSeverity, DiagnosticTag } from 'vscode-languageserver'; - -// convenience re-export from vscode -export { Range, Position, CancellationToken, CancellationTokenSource, DiagnosticSeverity, DiagnosticTag }; - -export * from './visitors'; -export * from './stackedVisitor'; -export * from './reflection'; -export * from './creators'; -export * from './xml'; diff --git a/src/astUtils/reflection.spec.ts b/src/astUtils/reflection.spec.ts index dd2367d80..9683a2194 100644 --- a/src/astUtils/reflection.spec.ts +++ b/src/astUtils/reflection.spec.ts @@ -2,8 +2,8 @@ import { expect } from 'chai'; import { PrintStatement, Block, Body, AssignmentStatement, CommentStatement, ExitForStatement, ExitWhileStatement, ExpressionStatement, FunctionStatement, IfStatement, IncrementStatement, GotoStatement, LabelStatement, ReturnStatement, EndStatement, StopStatement, ForStatement, ForEachStatement, WhileStatement, DottedSetStatement, IndexedSetStatement, LibraryStatement, NamespaceStatement, ImportStatement, ClassStatement, EmptyStatement } from '../parser/Statement'; import { FunctionExpression, NamespacedVariableNameExpression, BinaryExpression, CallExpression, DottedGetExpression, IndexedGetExpression, GroupingExpression, EscapedCharCodeLiteralExpression, ArrayLiteralExpression, AALiteralExpression, UnaryExpression, VariableExpression, SourceLiteralExpression, NewExpression, CallfuncExpression, TemplateStringQuasiExpression, XmlAttributeGetExpression, TemplateStringExpression, TaggedTemplateStringExpression, AnnotationExpression } from '../parser/Expression'; -import type { Token } from '../lexer'; -import { TokenKind } from '../lexer'; +import type { Token } from '../lexer/Token'; +import { TokenKind } from '../lexer/TokenKind'; import { isPrintStatement, isIfStatement, isBody, isAssignmentStatement, isBlock, isExpressionStatement, isCommentStatement, isExitForStatement, isExitWhileStatement, isFunctionStatement, isIncrementStatement, isGotoStatement, isLabelStatement, isReturnStatement, isEndStatement, isStopStatement, isForStatement, isForEachStatement, isWhileStatement, isDottedSetStatement, isIndexedSetStatement, isLibraryStatement, isNamespaceStatement, isImportStatement, isExpression, isBinaryExpression, isCallExpression, isFunctionExpression, isNamespacedVariableNameExpression, isDottedGetExpression, isXmlAttributeGetExpression, isIndexedGetExpression, isGroupingExpression, isLiteralExpression, isEscapedCharCodeLiteralExpression, isArrayLiteralExpression, isAALiteralExpression, isUnaryExpression, isVariableExpression, isSourceLiteralExpression, isNewExpression, isCallfuncExpression, isTemplateStringQuasiExpression, isTemplateStringExpression, isTaggedTemplateStringExpression, isBrsFile, isXmlFile, isClassStatement, isStatement, isAnnotationExpression } from './reflection'; import { createToken, createStringLiteral, createIdentifier, interpolatedRange as range } from './creators'; import { Program } from '../Program'; diff --git a/src/astUtils/visitors.spec.ts b/src/astUtils/visitors.spec.ts index fd317f6d6..83dd056ea 100644 --- a/src/astUtils/visitors.spec.ts +++ b/src/astUtils/visitors.spec.ts @@ -8,7 +8,7 @@ import { BrsFile } from '../files/BrsFile'; import type { Statement } from '../parser/Statement'; import { PrintStatement, Block, ReturnStatement } from '../parser/Statement'; import type { Expression } from '../parser/Expression'; -import { TokenKind } from '../lexer'; +import { TokenKind } from '../lexer/TokenKind'; import { createVisitor, WalkMode, walkStatements } from './visitors'; import { isPrintStatement } from './reflection'; import { createToken } from './creators'; diff --git a/src/bscPlugin/codeActions/CodeActionsProcessor.ts b/src/bscPlugin/codeActions/CodeActionsProcessor.ts index 8de1e3b77..d86b8b0dd 100644 --- a/src/bscPlugin/codeActions/CodeActionsProcessor.ts +++ b/src/bscPlugin/codeActions/CodeActionsProcessor.ts @@ -6,7 +6,7 @@ import { DiagnosticCodeMap } from '../../DiagnosticMessages'; import type { BrsFile } from '../../files/BrsFile'; import type { XmlFile } from '../../files/XmlFile'; import type { BscFile, OnGetCodeActionsEvent } from '../../interfaces'; -import { ParseMode } from '../../parser'; +import { ParseMode } from '../../parser/Parser'; import { util } from '../../util'; export class CodeActionsProcessor { diff --git a/src/bscPlugin/semanticTokens/SemanticTokensProcessor.ts b/src/bscPlugin/semanticTokens/SemanticTokensProcessor.ts index 812b4103a..b95393ff4 100644 --- a/src/bscPlugin/semanticTokens/SemanticTokensProcessor.ts +++ b/src/bscPlugin/semanticTokens/SemanticTokensProcessor.ts @@ -3,7 +3,7 @@ import { SemanticTokenTypes } from 'vscode-languageserver-protocol'; import { isBrsFile, isCustomType } from '../../astUtils/reflection'; import type { BrsFile } from '../../files/BrsFile'; import type { OnGetSemanticTokensEvent } from '../../interfaces'; -import { ParseMode } from '../../parser'; +import { ParseMode } from '../../parser/Parser'; import util from '../../util'; export class SemanticTokensProcessor { diff --git a/src/files/BrsFile.spec.ts b/src/files/BrsFile.spec.ts index 082beaf18..3c31eb557 100644 --- a/src/files/BrsFile.spec.ts +++ b/src/files/BrsFile.spec.ts @@ -11,7 +11,8 @@ import { IntegerType } from '../types/IntegerType'; import { StringType } from '../types/StringType'; import { BrsFile } from './BrsFile'; import { SourceMapConsumer } from 'source-map'; -import { TokenKind, Lexer, Keywords } from '../lexer'; +import { Lexer } from '../lexer/Lexer'; +import { TokenKind, Keywords } from '../lexer/TokenKind'; import { DiagnosticMessages } from '../DiagnosticMessages'; import type { StandardizedFileEntry } from 'roku-deploy'; import util, { standardizePath as s } from '../util'; diff --git a/src/files/BrsFile.ts b/src/files/BrsFile.ts index e4eb69d89..8d0a59df8 100644 --- a/src/files/BrsFile.ts +++ b/src/files/BrsFile.ts @@ -8,9 +8,10 @@ import type { Scope } from '../Scope'; import { DiagnosticCodeMap, diagnosticCodes, DiagnosticMessages } from '../DiagnosticMessages'; import { FunctionScope } from '../FunctionScope'; import type { Callable, CallableArg, CallableParam, CommentFlag, FunctionCall, BsDiagnostic, FileReference } from '../interfaces'; -import type { Token } from '../lexer'; -import { Lexer, TokenKind, AllowedLocalIdentifiers, Keywords } from '../lexer'; -import { Parser, ParseMode } from '../parser'; +import type { Token } from '../lexer/Token'; +import { Lexer } from '../lexer/Lexer'; +import { TokenKind, AllowedLocalIdentifiers, Keywords } from '../lexer/TokenKind'; +import { Parser, ParseMode } from '../parser/Parser'; import type { FunctionExpression, VariableExpression, Expression } from '../parser/Expression'; import type { ClassStatement, FunctionStatement, NamespaceStatement, ClassMethodStatement, AssignmentStatement, LibraryStatement, ImportStatement, Statement, ClassFieldStatement } from '../parser/Statement'; import type { FileLink, Program, SignatureInfoObj } from '../Program'; diff --git a/src/index.ts b/src/index.ts index 0792c4100..df12d8276 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,8 +8,18 @@ export { Watcher } from './Watcher'; export * from './interfaces'; export * from './LanguageServer'; export * from './XmlScope'; -export * from './lexer'; -export * from './parser'; +export * from './lexer/TokenKind'; +export * from './lexer/Token'; +export { Lexer } from './lexer/Lexer'; +export * from './parser/Parser'; +export * from './parser/Expression'; +export * from './parser/Statement'; export * from './BsConfig'; export * from './deferred'; -export * from './astUtils'; +// convenience re-export from vscode +export { Range, Position, CancellationToken, CancellationTokenSource, DiagnosticSeverity, DiagnosticTag } from 'vscode-languageserver'; +export * from './astUtils/visitors'; +export * from './astUtils/stackedVisitor'; +export * from './astUtils/reflection'; +export * from './astUtils/creators'; +export * from './astUtils/xml'; diff --git a/src/interfaces.ts b/src/interfaces.ts index 3249198f0..b0ddb4d22 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -7,7 +7,8 @@ import type { FunctionType } from './types/FunctionType'; import type { ParseMode } from './parser/Parser'; import type { Program, SourceObj, TranspileObj } from './Program'; import type { ProgramBuilder } from './ProgramBuilder'; -import type { Expression, FunctionStatement } from './parser'; +import type { FunctionStatement } from './parser/Statement'; +import type { Expression } from './parser/Expression'; import type { TranspileState } from './parser/TranspileState'; import type { SourceNode } from 'source-map'; import type { BscType } from './types/BscType'; diff --git a/src/lexer/Lexer.spec.ts b/src/lexer/Lexer.spec.ts index 8572a9518..44938a57f 100644 --- a/src/lexer/Lexer.spec.ts +++ b/src/lexer/Lexer.spec.ts @@ -1,7 +1,7 @@ /* eslint no-template-curly-in-string: 0 */ import { expect } from 'chai'; -import { TokenKind } from '.'; +import { TokenKind } from './TokenKind'; import { Lexer } from './Lexer'; import { isToken } from './Token'; import { rangeToArray } from '../parser/Parser.spec'; diff --git a/src/lexer/Lexer.ts b/src/lexer/Lexer.ts index 95725d346..bc1f38658 100644 --- a/src/lexer/Lexer.ts +++ b/src/lexer/Lexer.ts @@ -1,11 +1,10 @@ /* eslint-disable func-names */ -import { TokenKind, ReservedWords, Keywords } from './TokenKind'; +import { TokenKind, ReservedWords, Keywords, PreceedingRegexTypes } from './TokenKind'; import type { Token } from './Token'; import { isAlpha, isDecimalDigit, isAlphaNumeric, isHexDigit } from './Characters'; import type { Range, Diagnostic } from 'vscode-languageserver'; import { DiagnosticMessages } from '../DiagnosticMessages'; import util from '../util'; -import { PreceedingRegexTypes } from '.'; export class Lexer { /** diff --git a/src/lexer/index.ts b/src/lexer/index.ts deleted file mode 100644 index dbdf2c6da..000000000 --- a/src/lexer/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './TokenKind'; -export * from './Token'; -export { Lexer } from './Lexer'; diff --git a/src/parser/Expression.ts b/src/parser/Expression.ts index d7c663a47..5bb7dd09d 100644 --- a/src/parser/Expression.ts +++ b/src/parser/Expression.ts @@ -1,6 +1,6 @@ /* eslint-disable no-bitwise */ -import type { Token, Identifier } from '../lexer'; -import { TokenKind } from '../lexer'; +import type { Token, Identifier } from '../lexer/Token'; +import { TokenKind } from '../lexer/TokenKind'; import type { Block, CommentStatement, FunctionStatement } from './Statement'; import type { Range } from 'vscode-languageserver'; import util from '../util'; diff --git a/src/parser/Parser.Class.spec.ts b/src/parser/Parser.Class.spec.ts index ac1e78489..6867e2d30 100644 --- a/src/parser/Parser.Class.spec.ts +++ b/src/parser/Parser.Class.spec.ts @@ -1,6 +1,7 @@ import { expect } from 'chai'; import { DiagnosticMessages } from '../DiagnosticMessages'; -import { TokenKind, Lexer, AllowedLocalIdentifiers, AllowedProperties } from '../lexer'; +import { TokenKind, AllowedLocalIdentifiers, AllowedProperties } from '../lexer/TokenKind'; +import { Lexer } from '../lexer/Lexer'; import { Parser, ParseMode } from './Parser'; import type { FunctionStatement, AssignmentStatement, ClassFieldStatement } from './Statement'; import { ClassStatement } from './Statement'; diff --git a/src/parser/Parser.spec.ts b/src/parser/Parser.spec.ts index 5a8fa3fb5..64971237c 100644 --- a/src/parser/Parser.spec.ts +++ b/src/parser/Parser.spec.ts @@ -1,5 +1,6 @@ import { expect, assert } from 'chai'; -import { Lexer, ReservedWords } from '../lexer'; +import { Lexer } from '../lexer/Lexer'; +import { ReservedWords } from '../lexer/TokenKind'; import type { Expression } from './Expression'; import { DottedGetExpression, XmlAttributeGetExpression, CallfuncExpression, AnnotationExpression, CallExpression, FunctionExpression } from './Expression'; import { Parser, ParseMode } from './Parser'; @@ -7,7 +8,7 @@ import type { AssignmentStatement, ClassStatement, Statement } from './Statement import { PrintStatement, FunctionStatement, NamespaceStatement, ImportStatement } from './Statement'; import { Range } from 'vscode-languageserver'; import { DiagnosticMessages } from '../DiagnosticMessages'; -import { isBlock, isCommentStatement, isFunctionStatement, isIfStatement } from '../astUtils'; +import { isBlock, isCommentStatement, isFunctionStatement, isIfStatement } from '../astUtils/reflection'; import { expectZeroDiagnostics } from '../testHelpers.spec'; import { BrsTranspileState } from './BrsTranspileState'; import { SourceNode } from 'source-map'; diff --git a/src/parser/Parser.ts b/src/parser/Parser.ts index 9deb6b6b9..1cf32079c 100644 --- a/src/parser/Parser.ts +++ b/src/parser/Parser.ts @@ -1,21 +1,16 @@ -import type { - Token, - Identifier, - BlockTerminator -} from '../lexer'; +import type { Token, Identifier } from '../lexer/Token'; +import { isToken } from '../lexer/Token'; +import type { BlockTerminator } from '../lexer/TokenKind'; +import { Lexer } from '../lexer/Lexer'; import { - TokenKind, AllowedLocalIdentifiers, AssignmentOperators, DisallowedLocalIdentifiersText, DisallowedFunctionIdentifiersText, AllowedProperties, - Lexer, BrighterScriptSourceLiterals, - isToken, - DeclarableTypes -} from '../lexer'; - + DeclarableTypes, TokenKind +} from '../lexer/TokenKind'; import type { Statement, PrintSeparatorTab, @@ -59,7 +54,6 @@ import { import type { DiagnosticInfo } from '../DiagnosticMessages'; import { DiagnosticMessages } from '../DiagnosticMessages'; import { util } from '../util'; - import type { Expression } from './Expression'; import { AALiteralExpression, @@ -75,6 +69,7 @@ import { LiteralExpression, NamespacedVariableNameExpression, NewExpression, + RegexLiteralExpression, UnaryExpression, VariableExpression, XmlAttributeGetExpression, @@ -93,7 +88,6 @@ import { Logger } from '../Logger'; import { isAAMemberExpression, isAnnotationExpression, isCallExpression, isCallfuncExpression, isClassMethodStatement, isCommentStatement, isDottedGetExpression, isIfStatement, isIndexedGetExpression, isVariableExpression } from '../astUtils/reflection'; import { createVisitor, WalkMode } from '../astUtils/visitors'; import { createStringLiteral, createToken } from '../astUtils/creators'; -import { RegexLiteralExpression } from '.'; export class Parser { /** diff --git a/src/parser/Statement.spec.ts b/src/parser/Statement.spec.ts index ab74065bd..e5bd5f71f 100644 --- a/src/parser/Statement.spec.ts +++ b/src/parser/Statement.spec.ts @@ -2,8 +2,8 @@ import { expect } from 'chai'; import type { NamespaceStatement } from './Statement'; import { Body, ClassStatement, CommentStatement, EmptyStatement } from './Statement'; import { ParseMode, Parser } from './Parser'; -import { CancellationTokenSource, WalkMode } from '../astUtils'; -import { Range } from 'vscode-languageserver'; +import { WalkMode } from '../astUtils/visitors'; +import { CancellationTokenSource, Range } from 'vscode-languageserver'; import { NamespacedVariableNameExpression, VariableExpression } from './Expression'; import { Program } from '../Program'; import * as path from 'path'; diff --git a/src/parser/Statement.ts b/src/parser/Statement.ts index 3c121bca4..7b214d600 100644 --- a/src/parser/Statement.ts +++ b/src/parser/Statement.ts @@ -1,6 +1,6 @@ /* eslint-disable no-bitwise */ -import type { Token, Identifier } from '../lexer'; -import { CompoundAssignmentOperators, TokenKind } from '../lexer'; +import type { Token, Identifier } from '../lexer/Token'; +import { CompoundAssignmentOperators, TokenKind } from '../lexer/TokenKind'; import type { BinaryExpression, Expression, NamespacedVariableNameExpression, FunctionExpression, AnnotationExpression, FunctionParameterExpression } from './Expression'; import { CallExpression, VariableExpression } from './Expression'; import { util } from '../util'; diff --git a/src/parser/index.ts b/src/parser/index.ts deleted file mode 100644 index e72377a22..000000000 --- a/src/parser/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './Parser'; -export * from './Expression'; -export * from './Statement'; diff --git a/src/parser/tests/Parser.spec.ts b/src/parser/tests/Parser.spec.ts index ce2369acb..f6ec177ef 100644 --- a/src/parser/tests/Parser.spec.ts +++ b/src/parser/tests/Parser.spec.ts @@ -1,7 +1,7 @@ -import type { Token } from '../../lexer'; -import { TokenKind, ReservedWords } from '../../lexer'; +import type { Token } from '../../lexer/Token'; +import { TokenKind, ReservedWords } from '../../lexer/TokenKind'; import { interpolatedRange } from '../../astUtils/creators'; -import type { Range } from '../../astUtils'; +import type { Range } from 'vscode-languageserver'; /* A set of utilities to be used while writing tests for the BRS parser. */ diff --git a/src/parser/tests/controlFlow/For.spec.ts b/src/parser/tests/controlFlow/For.spec.ts index 957399562..1a6dc4e49 100644 --- a/src/parser/tests/controlFlow/For.spec.ts +++ b/src/parser/tests/controlFlow/For.spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; import type { ForStatement } from '../../Statement'; diff --git a/src/parser/tests/controlFlow/ForEach.spec.ts b/src/parser/tests/controlFlow/ForEach.spec.ts index 6dd145527..6850a08a4 100644 --- a/src/parser/tests/controlFlow/ForEach.spec.ts +++ b/src/parser/tests/controlFlow/ForEach.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; import { ForEachStatement } from '../../Statement'; diff --git a/src/parser/tests/controlFlow/If.spec.ts b/src/parser/tests/controlFlow/If.spec.ts index d3252cafb..6720222cd 100644 --- a/src/parser/tests/controlFlow/If.spec.ts +++ b/src/parser/tests/controlFlow/If.spec.ts @@ -1,10 +1,10 @@ import { expect } from 'chai'; import * as assert from 'assert'; - import { Parser } from '../../Parser'; -import { TokenKind, Lexer } from '../../../lexer'; +import { Lexer } from '../../../lexer/Lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, rangeMatch, token } from '../Parser.spec'; -import { isBlock, isCommentStatement, isIfStatement } from '../../../astUtils'; +import { isBlock, isCommentStatement, isIfStatement } from '../../../astUtils/reflection'; import type { Block, IfStatement } from '../../Statement'; describe('parser if statements', () => { diff --git a/src/parser/tests/controlFlow/While.spec.ts b/src/parser/tests/controlFlow/While.spec.ts index 061a525ce..e3afb28ce 100644 --- a/src/parser/tests/controlFlow/While.spec.ts +++ b/src/parser/tests/controlFlow/While.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; diff --git a/src/parser/tests/expression/Additive.spec.ts b/src/parser/tests/expression/Additive.spec.ts index 90730454c..b19c6cdc2 100644 --- a/src/parser/tests/expression/Additive.spec.ts +++ b/src/parser/tests/expression/Additive.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; diff --git a/src/parser/tests/expression/ArrayLiterals.spec.ts b/src/parser/tests/expression/ArrayLiterals.spec.ts index 77de98fc3..d50367136 100644 --- a/src/parser/tests/expression/ArrayLiterals.spec.ts +++ b/src/parser/tests/expression/ArrayLiterals.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; diff --git a/src/parser/tests/expression/AssociativeArrayLiterals.spec.ts b/src/parser/tests/expression/AssociativeArrayLiterals.spec.ts index 738dd67d4..da50c6620 100644 --- a/src/parser/tests/expression/AssociativeArrayLiterals.spec.ts +++ b/src/parser/tests/expression/AssociativeArrayLiterals.spec.ts @@ -1,12 +1,12 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; import type { AssignmentStatement } from '../../Statement'; import type { AALiteralExpression } from '../../Expression'; -import { isCommentStatement } from '../../../astUtils'; +import { isCommentStatement } from '../../../astUtils/reflection'; describe('parser associative array literals', () => { describe('empty associative arrays', () => { diff --git a/src/parser/tests/expression/Boolean.spec.ts b/src/parser/tests/expression/Boolean.spec.ts index 170703a20..cd7fa71d4 100644 --- a/src/parser/tests/expression/Boolean.spec.ts +++ b/src/parser/tests/expression/Boolean.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; diff --git a/src/parser/tests/expression/Call.spec.ts b/src/parser/tests/expression/Call.spec.ts index 136188673..b8497148b 100644 --- a/src/parser/tests/expression/Call.spec.ts +++ b/src/parser/tests/expression/Call.spec.ts @@ -1,7 +1,8 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind, Lexer } from '../../../lexer'; +import { Lexer } from '../../../lexer/Lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; diff --git a/src/parser/tests/expression/Exponential.spec.ts b/src/parser/tests/expression/Exponential.spec.ts index b7f4afedb..d2867f563 100644 --- a/src/parser/tests/expression/Exponential.spec.ts +++ b/src/parser/tests/expression/Exponential.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; describe('parser', () => { diff --git a/src/parser/tests/expression/Function.spec.ts b/src/parser/tests/expression/Function.spec.ts index f4cd2d0f8..c8c822ddd 100644 --- a/src/parser/tests/expression/Function.spec.ts +++ b/src/parser/tests/expression/Function.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; diff --git a/src/parser/tests/expression/Indexing.spec.ts b/src/parser/tests/expression/Indexing.spec.ts index debec599b..ca8f64dbe 100644 --- a/src/parser/tests/expression/Indexing.spec.ts +++ b/src/parser/tests/expression/Indexing.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; import { DiagnosticMessages } from '../../../DiagnosticMessages'; diff --git a/src/parser/tests/expression/Multiplicative.spec.ts b/src/parser/tests/expression/Multiplicative.spec.ts index 96b38c3db..b0e808c2e 100644 --- a/src/parser/tests/expression/Multiplicative.spec.ts +++ b/src/parser/tests/expression/Multiplicative.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; describe('parser', () => { diff --git a/src/parser/tests/expression/NullCoalescenceExpression.spec.ts b/src/parser/tests/expression/NullCoalescenceExpression.spec.ts index 8239fa6c9..ab649a57a 100644 --- a/src/parser/tests/expression/NullCoalescenceExpression.spec.ts +++ b/src/parser/tests/expression/NullCoalescenceExpression.spec.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-for-in-array */ import { expect } from 'chai'; import { DiagnosticMessages } from '../../../DiagnosticMessages'; -import { Lexer } from '../../../lexer'; +import { Lexer } from '../../../lexer/Lexer'; import { Parser, ParseMode } from '../../Parser'; import { AssignmentStatement, ExpressionStatement, ForEachStatement } from '../../Statement'; import type { diff --git a/src/parser/tests/expression/PrefixUnary.spec.ts b/src/parser/tests/expression/PrefixUnary.spec.ts index e475ecf2c..91feef687 100644 --- a/src/parser/tests/expression/PrefixUnary.spec.ts +++ b/src/parser/tests/expression/PrefixUnary.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; diff --git a/src/parser/tests/expression/Primary.spec.ts b/src/parser/tests/expression/Primary.spec.ts index 0e696ae30..2543d1f2d 100644 --- a/src/parser/tests/expression/Primary.spec.ts +++ b/src/parser/tests/expression/Primary.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; diff --git a/src/parser/tests/expression/Relational.spec.ts b/src/parser/tests/expression/Relational.spec.ts index 6cf2cbe9d..52c5d00e3 100644 --- a/src/parser/tests/expression/Relational.spec.ts +++ b/src/parser/tests/expression/Relational.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; describe('parser', () => { diff --git a/src/parser/tests/expression/TemplateStringExpression.spec.ts b/src/parser/tests/expression/TemplateStringExpression.spec.ts index 7b2970e8a..3797074b9 100644 --- a/src/parser/tests/expression/TemplateStringExpression.spec.ts +++ b/src/parser/tests/expression/TemplateStringExpression.spec.ts @@ -3,7 +3,7 @@ import { expect } from 'chai'; import { DiagnosticMessages } from '../../../DiagnosticMessages'; -import { Lexer } from '../../../lexer'; +import { Lexer } from '../../../lexer/Lexer'; import { Parser, ParseMode } from '../../Parser'; import { AssignmentStatement } from '../../Statement'; import { Program } from '../../../Program'; diff --git a/src/parser/tests/expression/TernaryExpression.spec.ts b/src/parser/tests/expression/TernaryExpression.spec.ts index 62757523c..d3d1461a2 100644 --- a/src/parser/tests/expression/TernaryExpression.spec.ts +++ b/src/parser/tests/expression/TernaryExpression.spec.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-for-in-array */ import { expect } from 'chai'; import { DiagnosticMessages } from '../../../DiagnosticMessages'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { Parser, ParseMode } from '../../Parser'; import { token, EOF } from '../Parser.spec'; import type { PrintStatement } from '../../Statement'; diff --git a/src/parser/tests/statement/AssignmentOperators.spec.ts b/src/parser/tests/statement/AssignmentOperators.spec.ts index 754a1ceef..d975cf001 100644 --- a/src/parser/tests/statement/AssignmentOperators.spec.ts +++ b/src/parser/tests/statement/AssignmentOperators.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; describe('parser assignment operators', () => { diff --git a/src/parser/tests/statement/Declaration.spec.ts b/src/parser/tests/statement/Declaration.spec.ts index 5a4881e13..106a45868 100644 --- a/src/parser/tests/statement/Declaration.spec.ts +++ b/src/parser/tests/statement/Declaration.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; diff --git a/src/parser/tests/statement/Function.spec.ts b/src/parser/tests/statement/Function.spec.ts index 74b1ff72e..d1565ebf3 100644 --- a/src/parser/tests/statement/Function.spec.ts +++ b/src/parser/tests/statement/Function.spec.ts @@ -1,7 +1,8 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind, Lexer } from '../../../lexer'; +import { Lexer } from '../../../lexer/Lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; describe('parser', () => { diff --git a/src/parser/tests/statement/Goto.spec.ts b/src/parser/tests/statement/Goto.spec.ts index 85e5bf5a9..4ad6ea1f8 100644 --- a/src/parser/tests/statement/Goto.spec.ts +++ b/src/parser/tests/statement/Goto.spec.ts @@ -1,7 +1,8 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind, Lexer } from '../../../lexer'; +import { Lexer } from '../../../lexer/Lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; describe('parser goto statements', () => { diff --git a/src/parser/tests/statement/Increment.spec.ts b/src/parser/tests/statement/Increment.spec.ts index 82749b317..b1d0f11f7 100644 --- a/src/parser/tests/statement/Increment.spec.ts +++ b/src/parser/tests/statement/Increment.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; import { DiagnosticMessages } from '../../../DiagnosticMessages'; diff --git a/src/parser/tests/statement/LibraryStatement.spec.ts b/src/parser/tests/statement/LibraryStatement.spec.ts index e1fff4143..615a733cc 100644 --- a/src/parser/tests/statement/LibraryStatement.spec.ts +++ b/src/parser/tests/statement/LibraryStatement.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { Lexer } from '../../../lexer'; +import { Lexer } from '../../../lexer/Lexer'; import { AssignmentStatement, FunctionStatement as BrsFunction } from '../../Statement'; describe('parser library statements', () => { diff --git a/src/parser/tests/statement/Misc.spec.ts b/src/parser/tests/statement/Misc.spec.ts index 81574037d..0d78de963 100644 --- a/src/parser/tests/statement/Misc.spec.ts +++ b/src/parser/tests/statement/Misc.spec.ts @@ -1,6 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { Lexer, DisallowedLocalIdentifiersText, TokenKind } from '../../../lexer'; +import { Lexer } from '../../../lexer/Lexer'; +import { DisallowedLocalIdentifiersText, TokenKind } from '../../../lexer/TokenKind'; import { Range } from 'vscode-languageserver'; import type { AAMemberExpression } from '../../Expression'; import { expectZeroDiagnostics } from '../../../testHelpers.spec'; diff --git a/src/parser/tests/statement/PrintStatement.spec.ts b/src/parser/tests/statement/PrintStatement.spec.ts index 73d043585..e11ddec20 100644 --- a/src/parser/tests/statement/PrintStatement.spec.ts +++ b/src/parser/tests/statement/PrintStatement.spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; import { Program } from '../../../Program'; diff --git a/src/parser/tests/statement/ReturnStatement.spec.ts b/src/parser/tests/statement/ReturnStatement.spec.ts index 9974418b2..e40bc241e 100644 --- a/src/parser/tests/statement/ReturnStatement.spec.ts +++ b/src/parser/tests/statement/ReturnStatement.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import type { FunctionStatement } from '../../Statement'; import { Range } from 'vscode-languageserver'; diff --git a/src/parser/tests/statement/Set.spec.ts b/src/parser/tests/statement/Set.spec.ts index 976d4a0e1..5b8715191 100644 --- a/src/parser/tests/statement/Set.spec.ts +++ b/src/parser/tests/statement/Set.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind } from '../../../lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, identifier, token } from '../Parser.spec'; import { Range } from 'vscode-languageserver'; diff --git a/src/parser/tests/statement/Stop.spec.ts b/src/parser/tests/statement/Stop.spec.ts index 6dfeb46da..2a64a1e6b 100644 --- a/src/parser/tests/statement/Stop.spec.ts +++ b/src/parser/tests/statement/Stop.spec.ts @@ -1,7 +1,8 @@ import { expect } from 'chai'; import { Parser } from '../../Parser'; -import { TokenKind, Lexer } from '../../../lexer'; +import { Lexer } from '../../../lexer/Lexer'; +import { TokenKind } from '../../../lexer/TokenKind'; import { EOF, token } from '../Parser.spec'; describe('stop statement', () => { diff --git a/src/preprocessor/Chunk.ts b/src/preprocessor/Chunk.ts index 5d850e4f7..d67360d52 100644 --- a/src/preprocessor/Chunk.ts +++ b/src/preprocessor/Chunk.ts @@ -1,4 +1,4 @@ -import type { Token } from '../lexer'; +import type { Token } from '../lexer/Token'; import type { Range } from 'vscode-languageserver'; import util from '../util'; diff --git a/src/preprocessor/Preprocessor.ts b/src/preprocessor/Preprocessor.ts index fef0fc5af..1cbaf0f5f 100644 --- a/src/preprocessor/Preprocessor.ts +++ b/src/preprocessor/Preprocessor.ts @@ -1,5 +1,5 @@ -import type { Token } from '../lexer'; -import { TokenKind } from '../lexer'; +import type { Token } from '../lexer/Token'; +import { TokenKind } from '../lexer/TokenKind'; import type * as CC from './Chunk'; import type { Diagnostic } from 'vscode-languageserver'; import { DiagnosticMessages } from '../DiagnosticMessages'; diff --git a/src/preprocessor/index.ts b/src/preprocessor/index.ts deleted file mode 100644 index fac49ebfa..000000000 --- a/src/preprocessor/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './Chunk'; -export * from './PreprocessorParser'; -export * from './Manifest'; diff --git a/src/util.ts b/src/util.ts index 2c6c07a43..e466b4100 100644 --- a/src/util.ts +++ b/src/util.ts @@ -24,9 +24,10 @@ import { VoidType } from './types/VoidType'; import { ParseMode } from './parser/Parser'; import type { DottedGetExpression, Expression, VariableExpression } from './parser/Expression'; import { Logger, LogLevel } from './Logger'; -import type { Locatable, Token } from './lexer'; -import { TokenKind } from './lexer'; -import { isDottedGetExpression, isExpression, isVariableExpression, WalkMode } from './astUtils'; +import type { Locatable, Token } from './lexer/Token'; +import { TokenKind } from './lexer/TokenKind'; +import { isDottedGetExpression, isExpression, isVariableExpression } from './astUtils/reflection'; +import { WalkMode } from './astUtils/visitors'; import { CustomType } from './types/CustomType'; import { SourceNode } from 'source-map'; import type { SGAttribute } from './parser/SGTypes'; diff --git a/src/validators/ClassValidator.ts b/src/validators/ClassValidator.ts index b028911c5..02d1c53a9 100644 --- a/src/validators/ClassValidator.ts +++ b/src/validators/ClassValidator.ts @@ -8,9 +8,9 @@ import { URI } from 'vscode-uri'; import util from '../util'; import { isCallExpression, isClassFieldStatement, isClassMethodStatement, isCustomType } from '../astUtils/reflection'; import type { BscFile, BsDiagnostic } from '../interfaces'; -import { createVisitor, WalkMode } from '../astUtils'; +import { createVisitor, WalkMode } from '../astUtils/visitors'; import type { BrsFile } from '../files/BrsFile'; -import { TokenKind } from '../lexer'; +import { TokenKind } from '../lexer/TokenKind'; import { DynamicType } from '../types/DynamicType'; export class BsClassValidator {