Replace `const enum` with `enum` (#380)
This commit is contained in:
Родитель
d8d9d54426
Коммит
a92d1f0016
|
@ -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/**/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ export type PartialResult<Ok, Partial, Error> =
|
|||
| PartialResultIncomplete<Partial>
|
||||
| PartialResultError<Error>;
|
||||
|
||||
export const enum PartialResultKind {
|
||||
export enum PartialResultKind {
|
||||
Ok = "Ok",
|
||||
Incomplete = "Incomplete",
|
||||
Error = "Error",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
export type Result<T, E> = OkResult<T> | ErrorResult<E>;
|
||||
|
||||
export const enum ResultKind {
|
||||
export enum ResultKind {
|
||||
Ok = "Ok",
|
||||
Error = "Error",
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -29,7 +29,7 @@ export type TExpandNodesFn<State extends ITraversalState<ResultType>, ResultType
|
|||
collection: NodesById,
|
||||
) => Promise<ReadonlyArray<Node>>;
|
||||
|
||||
export const enum VisitNodeStrategy {
|
||||
export enum VisitNodeStrategy {
|
||||
BreadthFirst = "BreadthFirst",
|
||||
DepthFirst = "DepthFirst",
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -5,7 +5,7 @@ import { TokenPosition } from "./token";
|
|||
|
||||
export type TComment = LineComment | MultilineComment;
|
||||
|
||||
export const enum CommentKind {
|
||||
export enum CommentKind {
|
||||
Line = "Line",
|
||||
Multiline = "Multiline",
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import { Assert, Pattern, StringUtils } from "../common";
|
||||
|
||||
export const enum IdentifierKind {
|
||||
export enum IdentifierKind {
|
||||
Generalized = "Generalized",
|
||||
Invalid = "Invalid",
|
||||
Quote = "Quote",
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -116,7 +116,7 @@ export type TFields = OrderedFields | UnorderedFields;
|
|||
export type OrderedFields = OrderedMap<string, TPowerQueryType>;
|
||||
export type UnorderedFields = Map<string, TPowerQueryType>;
|
||||
|
||||
export const enum TypeKind {
|
||||
export enum TypeKind {
|
||||
Any = "Any",
|
||||
AnyNonNull = "AnyNonNull",
|
||||
Binary = "Binary",
|
||||
|
@ -168,7 +168,7 @@ export const TypeKinds: ReadonlyArray<TypeKind> = [
|
|||
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`.
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ export interface SectionKeyValuePair extends IKeyValuePair<Ast.Identifier> {
|
|||
readonly pairKind: PairKind.SectionMember;
|
||||
}
|
||||
|
||||
export const enum PairKind {
|
||||
export enum PairKind {
|
||||
FieldSpecification = "RecordType",
|
||||
LetExpression = "LetExpression",
|
||||
Record = "Record",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import { Ast } from "../../language";
|
||||
import { ParseContext } from "..";
|
||||
|
||||
export const enum XorNodeKind {
|
||||
export enum XorNodeKind {
|
||||
Ast = "Ast",
|
||||
Context = "Context",
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
}
|
||||
|
||||
|
|
|
@ -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",
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"outDir": "lib",
|
||||
"preserveConstEnums": true,
|
||||
"resolveJsonModule": true,
|
||||
"rootDir": "src",
|
||||
"sourceMap": true,
|
||||
|
|
Загрузка…
Ссылка в новой задаче