@bscotch/gml-parser
Version:
A parser for GML (GameMaker Language) files for programmatic manipulation and analysis of GameMaker projects.
66 lines • 3.71 kB
TypeScript
import type { CstNodeLocation } from 'chevrotain';
import type { Docs } from './parser.js';
import type { Code } from './project.code.js';
import { DiagnosticSeverity } from './project.diagnostics.js';
import { Position, Range, type IRange, type Scope } from './project.location.js';
import { Type, WithableType, type EnumType, type StructType } from './types.js';
export declare const diagnosticCollections: ("GLOBAL_SELF" | "INVALID_OPERATION" | "JSDOC_MISMATCH" | "UNDECLARED_GLOBAL_REFERENCE")[];
export declare class SignifierProcessor {
readonly file: Code;
protected readonly localScopeStack: StructType[];
protected readonly selfStack: (WithableType | EnumType)[];
/** The current ScopeRange, updated as we push/pop local and self */
scope: Scope;
readonly position: Position;
unusedJsdoc: Docs | undefined;
/**
* For the current node, the "definitive" self. This is the
* self that is used definitionally, e.g. a constructor's self
* or a Create event's self. This is only set when we are inside
* a "definitive" location for the self, so that we can use this
* value to determine if currentSelf is also the definitiveSelf,
* or if we are accessing that self externally to where it is defined.
*/
protected readonly definitiveSelfStack: (StructType | undefined)[];
constructor(file: Code);
consumeJsdoc(): Docs | undefined;
/**
* If a single node is provided, create a range from it.
* If two are provided, use the start of the first and end
* of the second to create the range.
*/
range(loc: CstNodeLocation, endLoc?: CstNodeLocation): Range;
addDiagnostic(kind: (typeof diagnosticCollections)[number], where: IRange | CstNodeLocation, message: string, severity?: DiagnosticSeverity): void;
get fullScope(): {
local: StructType;
self: WithableType | EnumType;
definitiveSelf: StructType | undefined;
global: StructType;
selfIsGlobal: boolean;
};
get asset(): import("./project.asset.js").Asset<"animcurves" | "extensions" | "fonts" | "notes" | "objects" | "particles" | "paths" | "rooms" | "roomui" | "scripts" | "sequences" | "shaders" | "sounds" | "sprites" | "tilesets" | "timelines">;
get project(): import("./project.js").Project;
get globalSelf(): StructType;
get currentLocalScope(): StructType;
get currentSelf(): WithableType | EnumType;
get currentDefinitiveSelf(): StructType | undefined;
get outerSelf(): WithableType | EnumType;
protected nextScope(token: CstNodeLocation, fromTokenEnd: boolean): Scope;
/**
* After parsing the entire file, the last scope might not
* have an appropriate end position. Set it here!
*/
setLastScopeEnd(rootNode: CstNodeLocation): void;
createStruct(token: CstNodeLocation, endToken?: CstNodeLocation): Type<"Struct">;
pushScope(startToken: CstNodeLocation, self: WithableType | EnumType, localScope: StructType, fromTokenEnd: boolean): void;
popScope(nextScopeToken: CstNodeLocation, nextScopeStartsFromTokenEnd: boolean): void;
pushLocalScope(startToken: CstNodeLocation, fromTokenEnd: boolean, localScope?: Type<"Struct">): void;
pushSelfScope(startToken: CstNodeLocation, self: EnumType | WithableType, fromTokenEnd: boolean, options?: {
accessorScope?: boolean;
}): void;
popLocalScope(nextScopeToken: CstNodeLocation, nextScopeStartsFromTokenEnd: boolean): void;
popSelfScope(nextScopeToken: CstNodeLocation, nextScopeStartsFromTokenEnd: boolean): void;
pushDefinitiveSelf(self: StructType | undefined): void;
popDefinitiveSelf(): void;
}
//# sourceMappingURL=visitor.processor.d.ts.map