feat: add molang package
1. upgrade bukkit chat 2. fix config update error Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
20
packages/molang/src/parser/parselets/prefix.ts
Normal file
20
packages/molang/src/parser/parselets/prefix.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Parser } from '../parse'
|
||||
import { IExpression } from '../expression'
|
||||
import { Token } from '../../tokenizer/token'
|
||||
import { PrefixExpression } from '../expressions/prefix'
|
||||
|
||||
export interface IPrefixParselet {
|
||||
readonly precedence: number
|
||||
parse: (parser: Parser, token: Token) => IExpression
|
||||
}
|
||||
|
||||
export class PrefixOperator implements IPrefixParselet {
|
||||
constructor(public precedence = 0) {}
|
||||
|
||||
parse(parser: Parser, token: Token) {
|
||||
return new PrefixExpression(
|
||||
token.getType(),
|
||||
parser.parseExpression(this.precedence)
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user