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:
2022-02-12 16:29:40 +08:00
parent 5ed61829e1
commit 6816e51239
73 changed files with 3103 additions and 129 deletions

View File

@@ -0,0 +1,29 @@
import { Parser } from '../parse'
import { Token } from '../../tokenizer/token'
import { IPrefixParselet } from './prefix'
import { IExpression } from '../expression'
import { ForEachExpression } from '../expressions/forEach'
export class ForEachParselet implements IPrefixParselet {
constructor(public precedence = 0) {}
parse(parser: Parser, token: Token) {
parser.consume('LEFT_PARENT')
const args: IExpression[] = []
if (parser.match('RIGHT_PARENT'))
throw new Error(`for_each() called without arguments`)
do {
args.push(parser.parseExpression())
} while (parser.match('COMMA'))
parser.consume('RIGHT_PARENT')
if (args.length !== 3)
throw new Error(
`There must be exactly three for_each() arguments; found ${args.length}`
)
return new ForEachExpression(args[0], args[1], args[2])
}
}