@bscotch/gml-parser
Version:
A parser for GML (GameMaker Language) files for programmatic manipulation and analysis of GameMaker projects.
59 lines • 2.9 kB
TypeScript
import type { CstNode, CstNodeLocation, IToken } from 'chevrotain';
import { EnumStatementCstChildren, FunctionExpressionCstChildren, GlobalVarDeclarationCstChildren, IdentifierAccessorCstChildren, JsdocGmlCstChildren, JsdocJsCstChildren, MacroStatementCstChildren } from '../gml-cst.js';
import { JsdocSummary } from './jsdoc.js';
import { GmlVisitorBase } from './parser.js';
import type { Code } from './project.code.js';
import { Position, Range } from './project.location.js';
import { Signifier } from './signifiers.js';
import { StructType } from './types.js';
export declare function registerGlobals(file: Code): void;
declare class GlobalDeclarationsProcessor {
readonly file: Code;
protected readonly localScopeStack: StructType[];
readonly start: Position;
constructor(file: Code);
range(loc: CstNodeLocation): Range;
get currentLocalScope(): StructType;
pushLocalScope(): void;
popLocalScope(): void;
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;
}
/**
* Visits the CST and creates symbols for global signifiers.
*/
export declare class GmlGlobalDeclarationsVisitor extends GmlVisitorBase {
readonly PROCESSOR: GlobalDeclarationsProcessor;
static validated: boolean;
EXTRACT_GLOBAL_DECLARATIONS(input: CstNode): GlobalDeclarationsProcessor;
/**
* Register a global identifier from its declaration. Note that
* global identifiers are not deleted when their definitions are,
* so we need to either create *or update* the corresponding symbol/typeMember.
*/
REGISTER_GLOBAL(children: {
Identifier?: IToken[];
}): Signifier | undefined;
REGISTER_GLOBAL_BY_NAME(name: string, range: Range, isNotDef?: boolean): Signifier;
REGISTER_JSDOC_GLOBAL(jsdoc: JsdocSummary): void;
jsdocJs(children: JsdocJsCstChildren): void;
jsdocGml(children: JsdocGmlCstChildren): void;
/**
* Collect the enum symbol *and* its members, since all of those
* are globally visible.
*/
enumStatement(children: EnumStatementCstChildren): void;
/**
* Identify global function declarations and store them as
* symbols or `global.` types. For constructors, add the
* corresponding types.
*/
functionExpression(children: FunctionExpressionCstChildren): void;
globalVarDeclaration(children: GlobalVarDeclarationCstChildren): void;
macroStatement(children: MacroStatementCstChildren): void;
identifierAccessor(children: IdentifierAccessorCstChildren): void;
constructor(PROCESSOR: GlobalDeclarationsProcessor);
}
export {};
//# sourceMappingURL=visitor.globals.d.ts.map