fix: make expression evaluation in active effects more secure
This commit is contained in:
parent
19ba312a44
commit
20ea70d96a
8 changed files with 1222 additions and 1 deletions
61
src/expression-evaluation/grammar.ts
Normal file
61
src/expression-evaluation/grammar.ts
Normal file
|
@ -0,0 +1,61 @@
|
|||
// 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"];
|
Loading…
Add table
Add a link
Reference in a new issue