diff --git a/package.json b/package.json index 9dd958c4..3d5f2fab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@microsoft/powerquery-parser", - "version": "0.15.8", + "version": "0.15.9", "description": "A parser for the Power Query/M formula language.", "author": "Microsoft", "license": "MIT", @@ -57,4 +57,4 @@ "files": [ "lib/powerquery-parser/**/*" ] -} \ No newline at end of file +} diff --git a/src/powerquery-parser/common/partialResult/partialResult.ts b/src/powerquery-parser/common/partialResult/partialResult.ts index 9f1013c3..8a9d2c11 100644 --- a/src/powerquery-parser/common/partialResult/partialResult.ts +++ b/src/powerquery-parser/common/partialResult/partialResult.ts @@ -33,7 +33,7 @@ export type PartialResult = | PartialResultIncomplete | PartialResultError; -export const enum PartialResultKind { +export enum PartialResultKind { Ok = "Ok", Incomplete = "Incomplete", Error = "Error", diff --git a/src/powerquery-parser/common/result/result.ts b/src/powerquery-parser/common/result/result.ts index c1e262df..9fb094b3 100644 --- a/src/powerquery-parser/common/result/result.ts +++ b/src/powerquery-parser/common/result/result.ts @@ -3,7 +3,7 @@ export type Result = OkResult | ErrorResult; -export const enum ResultKind { +export enum ResultKind { Ok = "Ok", Error = "Error", } diff --git a/src/powerquery-parser/common/stringUtils.ts b/src/powerquery-parser/common/stringUtils.ts index 375c1f44..002f9370 100644 --- a/src/powerquery-parser/common/stringUtils.ts +++ b/src/powerquery-parser/common/stringUtils.ts @@ -14,7 +14,7 @@ export interface FoundQuotes { readonly quoteLength: number; } -export const enum NewlineKind { +export enum NewlineKind { SingleCharacter = "SingleCharacter", DoubleCharacter = "DoubleCharacter", // CARRIAGE RETURN + LINE FEED } diff --git a/src/powerquery-parser/common/trace.ts b/src/powerquery-parser/common/trace.ts index faf9dc8a..6a75150b 100644 --- a/src/powerquery-parser/common/trace.ts +++ b/src/powerquery-parser/common/trace.ts @@ -40,7 +40,7 @@ import performanceNow = require("performance-now"); // foobar(10); // Constants used in multiple files as part of a trace's phase/task/message/details. -export const enum TraceConstant { +export enum TraceConstant { CorrelationId = "CorrelationId", Empty = "[Empty]", Entry = "Entry", diff --git a/src/powerquery-parser/common/traversal.ts b/src/powerquery-parser/common/traversal.ts index 61928837..22c413cc 100644 --- a/src/powerquery-parser/common/traversal.ts +++ b/src/powerquery-parser/common/traversal.ts @@ -29,7 +29,7 @@ export type TExpandNodesFn, ResultType collection: NodesById, ) => Promise>; -export const enum VisitNodeStrategy { +export enum VisitNodeStrategy { BreadthFirst = "BreadthFirst", DepthFirst = "DepthFirst", } diff --git a/src/powerquery-parser/language/ast/ast.ts b/src/powerquery-parser/language/ast/ast.ts index fdb772f0..927796d3 100644 --- a/src/powerquery-parser/language/ast/ast.ts +++ b/src/powerquery-parser/language/ast/ast.ts @@ -4,7 +4,7 @@ import { Constant } from ".."; import { TokenRange } from "../token"; -export const enum NodeKind { +export enum NodeKind { ArithmeticExpression = "ArithmeticExpression", ArrayWrapper = "ArrayWrapper", AsExpression = "AsExpression", @@ -355,7 +355,7 @@ export type TPrimaryExpression = // ---------- 12.2.3.11 Literal expression ---------- // -------------------------------------------------- -export const enum LiteralKind { +export enum LiteralKind { List = "List", Logical = "Logical", Null = "Null", @@ -557,7 +557,7 @@ export type ErrorRaisingExpression = IPairedConstant< // ---------- 12.2.3.27 Error handling expression ---------- // --------------------------------------------------------- -export const enum ErrorHandlerKind { +export enum ErrorHandlerKind { Catch = "Catch", Otherwise = "Otherwise", } @@ -883,7 +883,7 @@ export interface Identifier extends INode { readonly identifierContextKind: IdentifierContextKind; } -export const enum IdentifierContextKind { +export enum IdentifierContextKind { Key = "Key", Keyword = "Keyword", Parameter = "Parameter", diff --git a/src/powerquery-parser/language/comment.ts b/src/powerquery-parser/language/comment.ts index fdbb08ed..1a2dcb68 100644 --- a/src/powerquery-parser/language/comment.ts +++ b/src/powerquery-parser/language/comment.ts @@ -5,7 +5,7 @@ import { TokenPosition } from "./token"; export type TComment = LineComment | MultilineComment; -export const enum CommentKind { +export enum CommentKind { Line = "Line", Multiline = "Multiline", } diff --git a/src/powerquery-parser/language/constant/constant.ts b/src/powerquery-parser/language/constant/constant.ts index bb269f96..8c01dd73 100644 --- a/src/powerquery-parser/language/constant/constant.ts +++ b/src/powerquery-parser/language/constant/constant.ts @@ -27,13 +27,13 @@ export type TBinOpExpressionOperator = // ---------- const enums ---------- // --------------------------------- -export const enum LanguageConstant { +export enum LanguageConstant { Catch = "catch", Nullable = "nullable", Optional = "optional", } -export const enum KeywordConstant { +export enum KeywordConstant { As = "as", Each = "each", Else = "else", @@ -54,7 +54,7 @@ export const enum KeywordConstant { } // Mostly direct mappings from their respective TokenKind -export const enum MiscConstant { +export enum MiscConstant { Ampersand = "&", AtSign = "@", Comma = ",", @@ -67,7 +67,7 @@ export const enum MiscConstant { QuestionMark = "?", } -export const enum PrimitiveTypeConstant { +export enum PrimitiveTypeConstant { Action = "action", Any = "any", AnyNonNull = "anynonnull", @@ -89,7 +89,7 @@ export const enum PrimitiveTypeConstant { Type = "type", } -export const enum WrapperConstant { +export enum WrapperConstant { LeftBrace = "{", LeftBracket = "[", LeftParenthesis = "(", @@ -102,7 +102,7 @@ export const enum WrapperConstant { // ---------- operator const enums ---------- // ------------------------------------------ -export const enum ArithmeticOperator { +export enum ArithmeticOperator { Multiplication = "*", Division = "/", Addition = "+", @@ -110,24 +110,24 @@ export const enum ArithmeticOperator { And = "&", } -export const enum EqualityOperator { +export enum EqualityOperator { EqualTo = "=", NotEqualTo = "<>", } -export const enum LogicalOperator { +export enum LogicalOperator { And = "and", Or = "or", } -export const enum RelationalOperator { +export enum RelationalOperator { LessThan = "<", LessThanEqualTo = "<=", GreaterThan = ">", GreaterThanEqualTo = ">=", } -export const enum UnaryOperator { +export enum UnaryOperator { Positive = "+", Negative = "-", Not = "not", diff --git a/src/powerquery-parser/language/keyword/keyword.ts b/src/powerquery-parser/language/keyword/keyword.ts index aa840e8b..b541e7a3 100644 --- a/src/powerquery-parser/language/keyword/keyword.ts +++ b/src/powerquery-parser/language/keyword/keyword.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export const enum KeywordKind { +export enum KeywordKind { And = "and", As = "as", Each = "each", diff --git a/src/powerquery-parser/language/textUtils.ts b/src/powerquery-parser/language/textUtils.ts index 62f2780d..058e3483 100644 --- a/src/powerquery-parser/language/textUtils.ts +++ b/src/powerquery-parser/language/textUtils.ts @@ -3,7 +3,7 @@ import { Assert, Pattern, StringUtils } from "../common"; -export const enum IdentifierKind { +export enum IdentifierKind { Generalized = "Generalized", Invalid = "Invalid", Quote = "Quote", diff --git a/src/powerquery-parser/language/token.ts b/src/powerquery-parser/language/token.ts index 3dbd732e..44454f5a 100644 --- a/src/powerquery-parser/language/token.ts +++ b/src/powerquery-parser/language/token.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export const enum LineTokenKindAdditions { +export enum LineTokenKindAdditions { LineComment = "LineComment", MultilineComment = "MultilineComment", MultilineCommentContent = "MultilineCommentContent", @@ -15,7 +15,7 @@ export const enum LineTokenKindAdditions { QuotedIdentifierStart = "QuotedIdentifierStart", } -export const enum TokenKind { +export enum TokenKind { Ampersand = "Ampersand", Asterisk = "Asterisk", AtSign = "AtSign", @@ -80,7 +80,7 @@ export const enum TokenKind { TextLiteral = "TextLiteral", } -export const enum LineTokenKind { +export enum LineTokenKind { Ampersand = TokenKind.Ampersand, Asterisk = TokenKind.Asterisk, AtSign = TokenKind.AtSign, diff --git a/src/powerquery-parser/language/type/type.ts b/src/powerquery-parser/language/type/type.ts index 175e2bf7..af157241 100644 --- a/src/powerquery-parser/language/type/type.ts +++ b/src/powerquery-parser/language/type/type.ts @@ -116,7 +116,7 @@ export type TFields = OrderedFields | UnorderedFields; export type OrderedFields = OrderedMap; export type UnorderedFields = Map; -export const enum TypeKind { +export enum TypeKind { Any = "Any", AnyNonNull = "AnyNonNull", Binary = "Binary", @@ -168,7 +168,7 @@ export const TypeKinds: ReadonlyArray = [ TypeKind.Type, ]; -export const enum ExtendedTypeKind { +export enum ExtendedTypeKind { // In Power Query if you want a union type, such as when a function returns either a `text` OR a `number`, // then you're only option is to give it the 'any' type. // This is a narrower definition which restricts that typing to the union `text | number`. diff --git a/src/powerquery-parser/language/type/typeUtils/typeTraceConstant.ts b/src/powerquery-parser/language/type/typeUtils/typeTraceConstant.ts index 40e6ed46..fae6b94d 100644 --- a/src/powerquery-parser/language/type/typeUtils/typeTraceConstant.ts +++ b/src/powerquery-parser/language/type/typeUtils/typeTraceConstant.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export const enum TypeUtilsTraceConstant { +export enum TypeUtilsTraceConstant { AnyUnion = "CreateAnyUnion", Categorize = "Categorize", IsCompatible = "IsCompatible", diff --git a/src/powerquery-parser/lexer/error.ts b/src/powerquery-parser/lexer/error.ts index 3d76b744..20269146 100644 --- a/src/powerquery-parser/lexer/error.ts +++ b/src/powerquery-parser/lexer/error.ts @@ -18,14 +18,14 @@ export type TInnerLexError = | UnexpectedReadError | UnterminatedMultilineTokenError; -export const enum BadLineNumberKind { +export enum BadLineNumberKind { LessThanZero = "LessThanZero", GreaterThanNumLines = "GreaterThanNumLines", } // do not these sort variants, // they are in order that logical checks are made, which in turn help create logical variants -export const enum BadRangeKind { +export enum BadRangeKind { SameLine_LineCodeUnitStart_Higher = "SameLine_LineCodeUnitStart_Higher", LineNumberStart_GreaterThan_LineNumberEnd = "LineNumberStart_GreaterThan_LineNumberEnd", LineNumberStart_LessThan_Zero = "LineNumberStart_LessThan_Zero", @@ -35,13 +35,13 @@ export const enum BadRangeKind { LineCodeUnitEnd_GreaterThan_LineLength = "LineCodeUnitEnd_GreaterThan_LineLength", } -export const enum ExpectedKind { +export enum ExpectedKind { HexLiteral = "HexLiteral", KeywordOrIdentifier = "KeywordOrIdentifier", Numeric = "Numeric", } -export const enum UnterminatedMultilineTokenKind { +export enum UnterminatedMultilineTokenKind { MultilineComment = "MultilineComment", QuotedIdentifier = "QuotedIdentifier", Text = "Text", diff --git a/src/powerquery-parser/lexer/lexer.ts b/src/powerquery-parser/lexer/lexer.ts index 332c09f4..3e7e0af5 100644 --- a/src/powerquery-parser/lexer/lexer.ts +++ b/src/powerquery-parser/lexer/lexer.ts @@ -40,7 +40,7 @@ export type TLine = TouchedLine | UntouchedLine | TouchedWithErrorLine | ErrorLi export type TErrorLine = ErrorLine | TouchedWithErrorLine; -export const enum LineKind { +export enum LineKind { Error = "Error", Touched = "Touched", TouchedWithError = "TouchedWithError", @@ -53,7 +53,7 @@ export const enum LineKind { // * Continuation of a multiline token (eg. multiline comment) // // All LineModes other than Default are a type of multiline tokenization. -export const enum LineMode { +export enum LineMode { Comment = "Comment", Default = "Default", QuotedIdentifier = "QuotedIdentifier", diff --git a/src/powerquery-parser/localization/locale.ts b/src/powerquery-parser/localization/locale.ts index 1d0d02ec..89717819 100644 --- a/src/powerquery-parser/localization/locale.ts +++ b/src/powerquery-parser/localization/locale.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -export const enum Locale { +export enum Locale { bg_BG = "bg-BG", ca_EZ = "ca-EZ", cs_CZ = "cs-CZ", diff --git a/src/powerquery-parser/parser/disambiguation/disambiguation.ts b/src/powerquery-parser/parser/disambiguation/disambiguation.ts index 033b4296..9af74dff 100644 --- a/src/powerquery-parser/parser/disambiguation/disambiguation.ts +++ b/src/powerquery-parser/parser/disambiguation/disambiguation.ts @@ -10,18 +10,18 @@ export type TAmbiguousBracketNode = Ast.FieldProjection | Ast.FieldSelector | As export type TAmbiguousParenthesisNode = Ast.FunctionExpression | Ast.ParenthesizedExpression | Ast.TLogicalExpression; -export const enum DismabiguationBehavior { +export enum DismabiguationBehavior { Strict = "Strict", Thorough = "Thorough", } -export const enum BracketDisambiguation { +export enum BracketDisambiguation { FieldProjection = "FieldProjection", FieldSelection = "FieldSelection", RecordExpression = "RecordExpression", } -export const enum ParenthesisDisambiguation { +export enum ParenthesisDisambiguation { FunctionExpression = "FunctionExpression", ParenthesizedExpression = "ParenthesizedExpression", } diff --git a/src/powerquery-parser/parser/error.ts b/src/powerquery-parser/parser/error.ts index 5d10d5d1..00a9c6d9 100644 --- a/src/powerquery-parser/parser/error.ts +++ b/src/powerquery-parser/parser/error.ts @@ -20,12 +20,12 @@ export type TInnerParseError = | UnterminatedSequence | UnusedTokensRemainError; -export const enum CsvContinuationKind { +export enum CsvContinuationKind { DanglingComma = "DanglingComma", LetExpression = "LetExpression", } -export const enum SequenceKind { +export enum SequenceKind { Bracket = "Bracket", Parenthesis = "Parenthesis", } diff --git a/src/powerquery-parser/parser/nodeIdMap/nodeIdMapIterator.ts b/src/powerquery-parser/parser/nodeIdMap/nodeIdMapIterator.ts index b0de137c..918f16ad 100644 --- a/src/powerquery-parser/parser/nodeIdMap/nodeIdMapIterator.ts +++ b/src/powerquery-parser/parser/nodeIdMap/nodeIdMapIterator.ts @@ -35,7 +35,7 @@ export interface SectionKeyValuePair extends IKeyValuePair { readonly pairKind: PairKind.SectionMember; } -export const enum PairKind { +export enum PairKind { FieldSpecification = "RecordType", LetExpression = "LetExpression", Record = "Record", diff --git a/src/powerquery-parser/parser/nodeIdMap/xorNode.ts b/src/powerquery-parser/parser/nodeIdMap/xorNode.ts index 372c9766..54d75e32 100644 --- a/src/powerquery-parser/parser/nodeIdMap/xorNode.ts +++ b/src/powerquery-parser/parser/nodeIdMap/xorNode.ts @@ -4,7 +4,7 @@ import { Ast } from "../../language"; import { ParseContext } from ".."; -export const enum XorNodeKind { +export enum XorNodeKind { Ast = "Ast", Context = "Context", } diff --git a/src/powerquery-parser/parser/parsers/combinatorialParserV2/commonTypes.ts b/src/powerquery-parser/parser/parsers/combinatorialParserV2/commonTypes.ts index b8e1ac09..5589387c 100644 --- a/src/powerquery-parser/parser/parsers/combinatorialParserV2/commonTypes.ts +++ b/src/powerquery-parser/parser/parsers/combinatorialParserV2/commonTypes.ts @@ -5,7 +5,7 @@ import { Ast } from "../../../language"; export type TOperand = Ast.TBinOpExpression | Ast.TUnaryExpression | Ast.TNullablePrimitiveType; -export const enum CombinatorialParserV2TraceConstant { +export enum CombinatorialParserV2TraceConstant { CombinatorialParseV2 = "CombinatorialParseV2", } diff --git a/src/powerquery-parser/task/task.ts b/src/powerquery-parser/task/task.ts index 1c36193d..118c299a 100644 --- a/src/powerquery-parser/task/task.ts +++ b/src/powerquery-parser/task/task.ts @@ -14,7 +14,7 @@ export type TriedParseTask = ParseTaskOk | ParseTaskCommonError | ParseTaskParse export type TriedLexParseTask = LexTaskError | TriedParseTask; -export const enum TaskStage { +export enum TaskStage { Lex = "Lex", Parse = "Parse", } diff --git a/tsconfig.json b/tsconfig.json index 7f6749fa..38dd1d41 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,6 @@ "noUnusedLocals": true, "noUnusedParameters": true, "outDir": "lib", - "preserveConstEnums": true, "resolveJsonModule": true, "rootDir": "src", "sourceMap": true,