Skip to content

Commit

Permalink
refactor: add enum names
Browse files Browse the repository at this point in the history
  • Loading branch information
koladilip committed Nov 10, 2023
1 parent d9e218c commit 8973af0
Showing 1 changed file with 65 additions and 66 deletions.
131 changes: 65 additions & 66 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,82 +17,81 @@ export enum Keyword {
}

export enum TokenType {
UNKNOWN,
ID,
INT,
FLOAT,
STR,
BOOL,
NULL,
UNDEFINED,
LAMBDA_ARG,
PUNCT,
THROW,
KEYWORD,
EOT,
UNKNOWN = 'unknown',
ID = 'id',
INT = 'int',
FLOAT = 'float',
STR = 'str',
BOOL = 'bool',
NULL = 'null',
UNDEFINED = 'undefined',
LAMBDA_ARG = 'lambda_arg',
PUNCT = 'punct',
THROW = 'throw',
KEYWORD = 'keyword',
EOT = 'eot',
}

// In the order of precedence

export enum OperatorType {
BASE,
CONDITIONAL,
ASSIGNMENT,
COALESCING,
OR,
AND,
EQUALITY,
RELATIONAL,
SHIFT,
ADDITION,
MULTIPLICATION,
POWER,
UNARY,
PREFIX_INCREMENT,
POSTFIX_INCREMENT,
BASE = 'base',
CONDITIONAL = 'conditional',
ASSIGNMENT = 'assignment',
COALESCING = 'coalescing',
OR = 'or',
AND = 'and',
EQUALITY = 'equality',
RELATIONAL = 'relational',
SHIFT = 'shift',
ADDITION = 'addition',
MULTIPLICATION = 'multiplication',
POWER = 'power',
UNARY = 'unary',
PREFIX_INCREMENT = 'prefix_increment',
POSTFIX_INCREMENT = 'postfix_increment',
}

export enum SyntaxType {
EMPTY,
PATH,
PATH_OPTIONS,
SELECTOR,
LAMBDA_ARG,
INCREMENT,
LITERAL,
LOGICAL_COALESCE_EXPR,
LOGICAL_OR_EXPR,
LOGICAL_AND_EXPR,
COMPARISON_EXPR,
IN_EXPR,
MATH_EXPR,
UNARY_EXPR,
SPREAD_EXPR,
CONDITIONAL_EXPR,
ARRAY_INDEX_FILTER_EXPR,
OBJECT_INDEX_FILTER_EXPR,
RANGE_FILTER_EXPR,
OBJECT_FILTER_EXPR,
ARRAY_FILTER_EXPR,
DEFINITION_EXPR,
ASSIGNMENT_EXPR,
OBJECT_PROP_EXPR,
OBJECT_EXPR,
ARRAY_EXPR,
BLOCK_EXPR,
FUNCTION_EXPR,
FUNCTION_CALL_ARG,
FUNCTION_CALL_EXPR,
RETURN_EXPR,
THROW_EXPR,
STATEMENTS_EXPR,
LOOP_CONTROL_EXPR,
LOOP_EXPR,
EMPTY = 'empty',
PATH = 'path',
PATH_OPTIONS = 'path_options',
SELECTOR = 'selector',
LAMBDA_ARG = 'lambda_arg',
INCREMENT = 'increment',
LITERAL = 'literal',
LOGICAL_COALESCE_EXPR = 'logical_coalesce_expr',
LOGICAL_OR_EXPR = 'logical_or_expr',
LOGICAL_AND_EXPR = 'logical_and_expr',
COMPARISON_EXPR = 'comparison_expr',
IN_EXPR = 'in_expr',
MATH_EXPR = 'math_expr',
UNARY_EXPR = 'unary_expr',
SPREAD_EXPR = 'spread_expr',
CONDITIONAL_EXPR = 'conditional_expr',
ARRAY_INDEX_FILTER_EXPR = 'array_index_filter_expr',
OBJECT_INDEX_FILTER_EXPR = 'object_index_filter_expr',
RANGE_FILTER_EXPR = 'range_filter_expr',
OBJECT_FILTER_EXPR = 'object_filter_expr',
ARRAY_FILTER_EXPR = 'array_filter_expr',
DEFINITION_EXPR = 'definition_expr',
ASSIGNMENT_EXPR = 'assignment_expr',
OBJECT_PROP_EXPR = 'object_prop_expr',
OBJECT_EXPR = 'object_expr',
ARRAY_EXPR = 'array_expr',
BLOCK_EXPR = 'block_expr',
FUNCTION_EXPR = 'function_expr',
FUNCTION_CALL_ARG = 'function_call_arg',
FUNCTION_CALL_EXPR = 'function_call_expr',
RETURN_EXPR = 'return_expr',
THROW_EXPR = 'throw_expr',
STATEMENTS_EXPR = 'statements_expr',
LOOP_CONTROL_EXPR = 'loop_control_expr',
LOOP_EXPR = 'loop_expr',
}

export enum PathType {
SIMPLE,
RICH,
SIMPLE = 'simple',
RICH = 'rich',
}

export interface EngineOptions {
Expand Down

0 comments on commit 8973af0

Please sign in to comment.