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:
18
packages/molang/src/parser/parselets/groupParselet.ts
Normal file
18
packages/molang/src/parser/parselets/groupParselet.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { IPrefixParselet } from './prefix'
|
||||
import { Token } from '../../tokenizer/token'
|
||||
import { Parser } from '../parse'
|
||||
import { GroupExpression } from '../expressions/group'
|
||||
|
||||
export class GroupParselet implements IPrefixParselet {
|
||||
constructor(public precedence = 0) {}
|
||||
|
||||
parse(parser: Parser, token: Token) {
|
||||
const expression = parser.parseExpression(this.precedence)
|
||||
parser.consume('RIGHT_PARENT')
|
||||
|
||||
if (parser.config.keepGroups)
|
||||
return new GroupExpression(expression, '()')
|
||||
|
||||
return expression
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user