完成世界书、骰子、apiconfig页面处理

This commit is contained in:
2026-04-30 01:35:10 +08:00
parent a3e3711b2b
commit ba9b925c32
4602 changed files with 785225 additions and 23 deletions

22
frontend/node_modules/chevrotain-allstar/README.md generated vendored Normal file
View File

@@ -0,0 +1,22 @@
# Chevrotain Allstar
This is a lookahead plugin package for the [Chevrotain parser library](https://chevrotain.io/).
It implements the [ALL(*) lookahead algorithm](https://www.antlr.org/papers/allstar-techreport.pdf) introduced for ANTLR4.
The algorithm features unbounded lookahead, compared to the normal LL(*k*) behavior of Chevrotain.
## Usage
When creating your parser, pass an instance of the `LLStarLookaheadStrategy` to the `lookaheadStrategy` property of the base parser constructor options.
```ts
import { LLStarLookaheadStrategy } from "chevrotain-allstar";
class Parser extends EmbeddedActionsParser {
constructor() {
super(tokens, {
lookaheadStrategy: new LLStarLookaheadStrategy()
});
this.performSelfAnalysis()
}
}
```

105
frontend/node_modules/chevrotain-allstar/lib/atn.d.ts generated vendored Normal file
View File

@@ -0,0 +1,105 @@
/******************************************************************************
* Copyright 2022 TypeFox GmbH
* This program and the accompanying materials are made available under the
* terms of the MIT License, which is available in the project root.
******************************************************************************/
import { IProductionWithOccurrence, TokenType, Rule, LookaheadProductionType } from "chevrotain";
export declare function buildATNKey(rule: Rule, type: LookaheadProductionType, occurrence: number): string;
export interface ATN {
decisionMap: Record<string, DecisionState>;
states: ATNState[];
decisionStates: DecisionState[];
ruleToStartState: Map<Rule, RuleStartState>;
ruleToStopState: Map<Rule, RuleStopState>;
}
export declare const ATN_INVALID_TYPE = 0;
export declare const ATN_BASIC = 1;
export declare const ATN_RULE_START = 2;
export declare const ATN_PLUS_BLOCK_START = 4;
export declare const ATN_STAR_BLOCK_START = 5;
export declare const ATN_TOKEN_START = 6;
export declare const ATN_RULE_STOP = 7;
export declare const ATN_BLOCK_END = 8;
export declare const ATN_STAR_LOOP_BACK = 9;
export declare const ATN_STAR_LOOP_ENTRY = 10;
export declare const ATN_PLUS_LOOP_BACK = 11;
export declare const ATN_LOOP_END = 12;
export type ATNState = BasicState | BasicBlockStartState | PlusBlockStartState | PlusLoopbackState | StarBlockStartState | StarLoopbackState | StarLoopEntryState | BlockEndState | RuleStartState | RuleStopState | LoopEndState;
export interface ATNBaseState {
atn: ATN;
production: IProductionWithOccurrence;
stateNumber: number;
rule: Rule;
epsilonOnlyTransitions: boolean;
transitions: Transition[];
nextTokenWithinRule: number[];
}
export interface BasicState extends ATNBaseState {
type: typeof ATN_BASIC;
}
export interface BlockStartState extends DecisionState {
end: BlockEndState;
}
export interface BasicBlockStartState extends BlockStartState {
type: typeof ATN_BASIC;
}
export interface PlusBlockStartState extends BlockStartState {
loopback: PlusLoopbackState;
type: typeof ATN_PLUS_BLOCK_START;
}
export interface PlusLoopbackState extends DecisionState {
type: typeof ATN_PLUS_LOOP_BACK;
}
export interface StarBlockStartState extends BlockStartState {
type: typeof ATN_STAR_BLOCK_START;
}
export interface StarLoopbackState extends ATNBaseState {
type: typeof ATN_STAR_LOOP_BACK;
}
export interface StarLoopEntryState extends DecisionState {
loopback: StarLoopbackState;
type: typeof ATN_STAR_LOOP_ENTRY;
}
export interface BlockEndState extends ATNBaseState {
start: BlockStartState;
type: typeof ATN_BLOCK_END;
}
export interface DecisionState extends ATNBaseState {
decision: number;
}
export interface LoopEndState extends ATNBaseState {
loopback: ATNState;
type: typeof ATN_LOOP_END;
}
export interface RuleStartState extends ATNBaseState {
stop: RuleStopState;
type: typeof ATN_RULE_START;
}
export interface RuleStopState extends ATNBaseState {
type: typeof ATN_RULE_STOP;
}
export interface Transition {
target: ATNState;
isEpsilon(): boolean;
}
export declare abstract class AbstractTransition implements Transition {
target: ATNState;
constructor(target: ATNState);
isEpsilon(): boolean;
}
export declare class AtomTransition extends AbstractTransition {
tokenType: TokenType;
constructor(target: ATNState, tokenType: TokenType);
}
export declare class EpsilonTransition extends AbstractTransition {
constructor(target: ATNState);
isEpsilon(): boolean;
}
export declare class RuleTransition extends AbstractTransition {
rule: Rule;
followState: ATNState;
constructor(ruleStart: RuleStartState, rule: Rule, followState: ATNState);
isEpsilon(): boolean;
}
export declare function createATN(rules: Rule[]): ATN;
//# sourceMappingURL=atn.d.ts.map

37
frontend/node_modules/chevrotain-allstar/lib/dfa.d.ts generated vendored Normal file
View File

@@ -0,0 +1,37 @@
/******************************************************************************
* Copyright 2022 TypeFox GmbH
* This program and the accompanying materials are made available under the
* terms of the MIT License, which is available in the project root.
******************************************************************************/
import { ATNState, DecisionState } from "./atn.js";
export interface DFA {
start?: DFAState;
states: Record<string, DFAState>;
decision: number;
atnStartState: DecisionState;
}
export interface DFAState {
configs: ATNConfigSet;
edges: Record<number, DFAState>;
isAcceptState: boolean;
prediction: number;
}
export declare const DFA_ERROR: DFAState;
export interface ATNConfig {
state: ATNState;
alt: number;
stack: ATNState[];
}
export declare class ATNConfigSet {
private map;
private configs;
uniqueAlt: number | undefined;
get size(): number;
finalize(): void;
add(config: ATNConfig): void;
get elements(): readonly ATNConfig[];
get alts(): number[];
get key(): string;
}
export declare function getATNConfigKey(config: ATNConfig, alt?: boolean): string;
//# sourceMappingURL=dfa.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"dfa.js","sourceRoot":"","sources":["../src/dfa.ts"],"names":[],"mappings":"AAAA;;;;gFAIgF;AAEhF,OAAO,GAAG,MAAM,kBAAkB,CAAA;AAiBlC,MAAM,CAAC,MAAM,SAAS,GAAG,EAAc,CAAA;AAQvC,MAAM,OAAO,YAAY;IAAzB;QACU,QAAG,GAA2B,EAAE,CAAA;QAChC,YAAO,GAAgB,EAAE,CAAA;IAsCnC,CAAC;IAlCC,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAA;IAC5B,CAAC;IAED,QAAQ;QACN,oCAAoC;QACpC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAA;IACf,CAAC;IAED,GAAG,CAAC,MAAiB;QACnB,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;QACnC,wDAAwD;QACxD,qHAAqH;QACrH,IAAI,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE;YACtB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAA;YACnC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;SAC1B;IACH,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,IAAI,IAAI;QACN,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IACxC,CAAC;IAED,IAAI,GAAG;QACL,IAAI,KAAK,GAAG,EAAE,CAAA;QACd,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE;YACxB,KAAK,IAAI,CAAC,GAAG,GAAG,CAAA;SACjB;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAED,MAAM,UAAU,eAAe,CAAC,MAAiB,EAAE,GAAG,GAAG,IAAI;IAC3D,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,IACnC,MAAM,CAAC,KAAK,CAAC,WACf,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;AACnE,CAAC"}

78
frontend/node_modules/chevrotain-allstar/src/dfa.ts generated vendored Normal file
View File

@@ -0,0 +1,78 @@
/******************************************************************************
* Copyright 2022 TypeFox GmbH
* This program and the accompanying materials are made available under the
* terms of the MIT License, which is available in the project root.
******************************************************************************/
import map from "lodash-es/map.js"
import { ATNState, DecisionState } from "./atn.js"
export interface DFA {
start?: DFAState
states: Record<string, DFAState>
decision: number
atnStartState: DecisionState
}
export interface DFAState {
configs: ATNConfigSet
edges: Record<number, DFAState>
isAcceptState: boolean
prediction: number
}
export const DFA_ERROR = {} as DFAState
export interface ATNConfig {
state: ATNState
alt: number
stack: ATNState[]
}
export class ATNConfigSet {
private map: Record<string, number> = {}
private configs: ATNConfig[] = []
uniqueAlt: number | undefined
get size(): number {
return this.configs.length
}
finalize(): void {
// Empties the map to free up memory
this.map = {}
}
add(config: ATNConfig): void {
const key = getATNConfigKey(config)
// Only add configs which don't exist in our map already
// While this does not influence the actual algorithm, adding them anyway would massively increase memory consumption
if (!(key in this.map)) {
this.map[key] = this.configs.length
this.configs.push(config)
}
}
get elements(): readonly ATNConfig[] {
return this.configs
}
get alts(): number[] {
return map(this.configs, (e) => e.alt)
}
get key(): string {
let value = ""
for (const k in this.map) {
value += k + ":"
}
return value
}
}
export function getATNConfigKey(config: ATNConfig, alt = true) {
return `${alt ? `a${config.alt}` : ""}s${
config.state.stateNumber
}:${config.stack.map((e) => e.stateNumber.toString()).join("_")}`
}