mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-14 17:14:41 +08:00
Still WIP
This commit is contained in:
@@ -1,25 +1,20 @@
|
||||
import Parsernostrum from "parsernostrum"
|
||||
import P from "parsernostrum"
|
||||
import RotatorEntity from "./RotatorEntity.js"
|
||||
|
||||
export default class SimpleSerializationRotatorEntity extends RotatorEntity {
|
||||
|
||||
static grammar = this.createGrammar()
|
||||
|
||||
static createGrammar() {
|
||||
const number = Parsernostrum.number.getParser().parser.regexp.source
|
||||
return Parsernostrum.alt(
|
||||
Parsernostrum.regArray(new RegExp(
|
||||
"(" + number + ")"
|
||||
+ "\\s*,\\s*"
|
||||
+ "(" + number + ")"
|
||||
+ "\\s*,\\s*"
|
||||
+ "(" + number + ")"
|
||||
)).map(([_, p, y, r]) => new this({
|
||||
R: Number(r),
|
||||
P: Number(p),
|
||||
Y: Number(y),
|
||||
})),
|
||||
RotatorEntity.grammar
|
||||
)
|
||||
}
|
||||
static grammar = P.alt(
|
||||
P.regArray(new RegExp(
|
||||
`(${P.number.getParser().parser.regexp.source})`
|
||||
+ String.raw`\s*,\s*`
|
||||
+ `(${P.number.getParser().parser.regexp.source})`
|
||||
+ String.raw`\s*,\s*`
|
||||
+ `(${P.number.getParser().parser.regexp.source})`
|
||||
)).map(([_, p, y, r]) => new this({
|
||||
R: Number(r),
|
||||
P: Number(p),
|
||||
Y: Number(y),
|
||||
})),
|
||||
RotatorEntity.grammar
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user