forked from github/quartz
feat(bases): migrate from vault to upstream
Signed-off-by: Aaron Pham <contact@aarnphm.xyz>
This commit is contained in:
42
quartz/util/base/compiler/tokens.ts
Normal file
42
quartz/util/base/compiler/tokens.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { Span } from "./ast"
|
||||
|
||||
export type Operator =
|
||||
| "=="
|
||||
| "!="
|
||||
| ">="
|
||||
| "<="
|
||||
| ">"
|
||||
| "<"
|
||||
| "&&"
|
||||
| "||"
|
||||
| "+"
|
||||
| "-"
|
||||
| "*"
|
||||
| "/"
|
||||
| "%"
|
||||
| "!"
|
||||
|
||||
export type Punctuation = "." | "," | "(" | ")" | "[" | "]"
|
||||
|
||||
export type NumberToken = { type: "number"; value: number; span: Span }
|
||||
export type StringToken = { type: "string"; value: string; span: Span }
|
||||
export type BooleanToken = { type: "boolean"; value: boolean; span: Span }
|
||||
export type NullToken = { type: "null"; span: Span }
|
||||
export type IdentifierToken = { type: "identifier"; value: string; span: Span }
|
||||
export type ThisToken = { type: "this"; span: Span }
|
||||
export type OperatorToken = { type: "operator"; value: Operator; span: Span }
|
||||
export type PunctuationToken = { type: "punctuation"; value: Punctuation; span: Span }
|
||||
export type RegexToken = { type: "regex"; pattern: string; flags: string; span: Span }
|
||||
export type EofToken = { type: "eof"; span: Span }
|
||||
|
||||
export type Token =
|
||||
| NumberToken
|
||||
| StringToken
|
||||
| BooleanToken
|
||||
| NullToken
|
||||
| IdentifierToken
|
||||
| ThisToken
|
||||
| OperatorToken
|
||||
| PunctuationToken
|
||||
| RegexToken
|
||||
| EofToken
|
||||
Reference in New Issue
Block a user