// SPDX-FileCopyrightText: 2022 Johannes Loher // // SPDX-License-Identifier: MIT export type Token = TokenWithSymbol | TokenWithoutSymbol; export interface TokenWithSymbol { type: TypeWithSymbol; symbol: string; pos: number; } interface TokenWithoutSymbol { type: TypeWithoutSymbol; pos: number; } type TypeWithSymbol = "iden" | "number" | "string"; type TypeWithoutSymbol = | "+" | "-" | "*" | "**" | "/" | "%" | "===" | "!==" | "==" | "!=" | "<" | "<=" | ">" | ">=" | "&&" | "||" | "&" | "|" | "~" | "^" | "<<" | ">>" | ">>>" | "." | "?." | "??" | "!" | "?" | ":" | "(" | ")" | "[" | "]" | "," | "{" | "}" | "invalid" | "eof"; export const literals = ["true", "false", "null", "undefined"]; export const safeOperators = ["in", "instanceof", "typeof", "void"];