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:
22
packages/molang/src/parser/parselets/scope.ts
Normal file
22
packages/molang/src/parser/parselets/scope.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { Parser } from '../parse'
|
||||
import { Token } from '../../tokenizer/token'
|
||||
import { IPrefixParselet } from './prefix'
|
||||
import { GroupExpression } from '../expressions/group'
|
||||
|
||||
export class ScopeParselet implements IPrefixParselet {
|
||||
constructor(public precedence = 0) {}
|
||||
|
||||
parse(parser: Parser, token: Token) {
|
||||
let expr = parser.parseExpression(this.precedence)
|
||||
|
||||
if (
|
||||
parser.config.useOptimizer &&
|
||||
parser.config.earlyReturnsSkipTokenization &&
|
||||
expr.isReturn
|
||||
)
|
||||
parser.match('CURLY_RIGHT')
|
||||
else parser.consume('CURLY_RIGHT')
|
||||
|
||||
return parser.config.keepGroups ? new GroupExpression(expr, '{}') : expr
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user