UNPKG

@bscotch/gml-parser

Version:

A parser for GML (GameMaker Language) files for programmatic manipulation and analysis of GameMaker projects.

89 lines 10.5 kB
import type { CstNode } from 'chevrotain'; import type { ArrayLiteralCstChildren, AssignmentRightHandSideCstChildren, CatchStatementCstChildren, ExpressionCstChildren, FunctionExpressionCstChildren, FunctionStatementCstChildren, GlobalVarDeclarationCstChildren, IdentifierAccessorCstChildren, IdentifierCstChildren, JsdocGmlCstChildren, JsdocJsCstChildren, LocalVarDeclarationCstChildren, MacroStatementCstChildren, MultilineDoubleStringLiteralCstChildren, MultilineSingleStringLiteralCstChildren, ParenthesizedExpressionCstChildren, PrimaryExpressionCstChildren, ReturnStatementCstChildren, StaticVarDeclarationsCstChildren, StringLiteralCstChildren, StructLiteralCstChildren, TemplateLiteralCstChildren, VariableAssignmentCstChildren, WithStatementCstChildren } from '../gml-cst.js'; import { JsdocSummary } from './jsdoc.js'; import { GmlVisitorBase, VisitorContext } from './parser.js'; import type { Code } from './project.code.js'; import { Range, Reference } from './project.location.js'; import { Signifier } from './signifiers.js'; import { EnumType, Type, TypeStore, WithableType } from './types.js'; import { SignifierProcessor } from './visitor.processor.js'; export declare function registerSignifiers(file: Code): void; export interface FindSignifierOptions { excludeParents?: boolean; excludeGlobal?: boolean; } export declare class GmlSignifierVisitor extends GmlVisitorBase { readonly PROCESSOR: SignifierProcessor; static validated: boolean; constructor(PROCESSOR: SignifierProcessor); get FILE(): Code; get ASSET(): import("./project.asset.js").Asset<"animcurves" | "extensions" | "fonts" | "notes" | "objects" | "particles" | "paths" | "rooms" | "roomui" | "scripts" | "sequences" | "shaders" | "sounds" | "sprites" | "tilesets" | "timelines">; /** Entrypoint */ UPDATE_SIGNIFIERS(input: CstNode): SignifierProcessor; visit(cstNode: CstNode | CstNode[], ctx: VisitorContext): void | TypeStore<"Real" | "Undefined" | "Enum" | "Function" | "Array" | "Bool" | "Pointer" | "String" | "Struct" | "ArgumentIdentity" | "Any" | "Asset.GMAnimCurve" | "Asset.GMAudioGroup" | "Asset.GMFont" | "Asset.GMObject" | "Asset.GMParticleSystem" | "Asset.GMPath" | "Asset.GMRoom" | "Asset.GMScript" | "Asset.GMSequence" | "Asset.GMShader" | "Asset.GMSound" | "Asset.GMSprite" | "Asset.GMTileSet" | "Asset.GMTimeline" | "Asset.Script" | "Id.AudioEmitter" | "Id.AudioListener" | "Id.AudioSyncGroup" | "Id.BackgroundElement" | "Id.BinaryFile" | "Id.Buffer" | "Id.Camera" | "Id.DsGrid" | "Id.DsList" | "Id.DsMap" | "Id.DsPriority" | "Id.DsQueue" | "Id.DsStack" | "Id.ExternalCall" | "Id.Gif" | "Id.Instance" | "Id.Layer" | "Id.MpGrid" | "Id.ParticleEmitter" | "Id.ParticleSystem" | "Id.ParticleType" | "Id.PhysicsIndex" | "Id.PhysicsParticleGroup" | "Id.Sampler" | "Id.SequenceElement" | "Id.Socket" | "Id.Sound" | "Id.SpriteElement" | "Id.Surface" | "Id.TextFile" | "Id.Texture" | "Id.TileElementId" | "Id.TileMapElement" | "Id.TimeSource" | "Id.Uniform" | "Id.VertexBuffer" | "Id.VertexFormat" | "Mixed" | "EnumMember" | "Unknown" | "Never" | "InstanceType" | "ObjectType" | "StaticType"> | Type<"Real" | "Undefined" | "Enum" | "Function" | "Array" | "Bool" | "Pointer" | "String" | "Struct" | "ArgumentIdentity" | "Any" | "Asset.GMAnimCurve" | "Asset.GMAudioGroup" | "Asset.GMFont" | "Asset.GMObject" | "Asset.GMParticleSystem" | "Asset.GMPath" | "Asset.GMRoom" | "Asset.GMScript" | "Asset.GMSequence" | "Asset.GMShader" | "Asset.GMSound" | "Asset.GMSprite" | "Asset.GMTileSet" | "Asset.GMTimeline" | "Asset.Script" | "Id.AudioEmitter" | "Id.AudioListener" | "Id.AudioSyncGroup" | "Id.BackgroundElement" | "Id.BinaryFile" | "Id.Buffer" | "Id.Camera" | "Id.DsGrid" | "Id.DsList" | "Id.DsMap" | "Id.DsPriority" | "Id.DsQueue" | "Id.DsStack" | "Id.ExternalCall" | "Id.Gif" | "Id.Instance" | "Id.Layer" | "Id.MpGrid" | "Id.ParticleEmitter" | "Id.ParticleSystem" | "Id.ParticleType" | "Id.PhysicsIndex" | "Id.PhysicsParticleGroup" | "Id.Sampler" | "Id.SequenceElement" | "Id.Socket" | "Id.Sound" | "Id.SpriteElement" | "Id.Surface" | "Id.TextFile" | "Id.Texture" | "Id.TileElementId" | "Id.TileMapElement" | "Id.TimeSource" | "Id.Uniform" | "Id.VertexBuffer" | "Id.VertexFormat" | "Mixed" | "EnumMember" | "Unknown" | "Never" | "InstanceType" | "ObjectType" | "StaticType"> | (TypeStore<"Real" | "Undefined" | "Enum" | "Function" | "Array" | "Bool" | "Pointer" | "String" | "Struct" | "ArgumentIdentity" | "Any" | "Asset.GMAnimCurve" | "Asset.GMAudioGroup" | "Asset.GMFont" | "Asset.GMObject" | "Asset.GMParticleSystem" | "Asset.GMPath" | "Asset.GMRoom" | "Asset.GMScript" | "Asset.GMSequence" | "Asset.GMShader" | "Asset.GMSound" | "Asset.GMSprite" | "Asset.GMTileSet" | "Asset.GMTimeline" | "Asset.Script" | "Id.AudioEmitter" | "Id.AudioListener" | "Id.AudioSyncGroup" | "Id.BackgroundElement" | "Id.BinaryFile" | "Id.Buffer" | "Id.Camera" | "Id.DsGrid" | "Id.DsList" | "Id.DsMap" | "Id.DsPriority" | "Id.DsQueue" | "Id.DsStack" | "Id.ExternalCall" | "Id.Gif" | "Id.Instance" | "Id.Layer" | "Id.MpGrid" | "Id.ParticleEmitter" | "Id.ParticleSystem" | "Id.ParticleType" | "Id.PhysicsIndex" | "Id.PhysicsParticleGroup" | "Id.Sampler" | "Id.SequenceElement" | "Id.Socket" | "Id.Sound" | "Id.SpriteElement" | "Id.Surface" | "Id.TextFile" | "Id.Texture" | "Id.TileElementId" | "Id.TileMapElement" | "Id.TimeSource" | "Id.Uniform" | "Id.VertexBuffer" | "Id.VertexFormat" | "Mixed" | "EnumMember" | "Unknown" | "Never" | "InstanceType" | "ObjectType" | "StaticType"> | Type<"Real" | "Undefined" | "Enum" | "Function" | "Array" | "Bool" | "Pointer" | "String" | "Struct" | "ArgumentIdentity" | "Any" | "Asset.GMAnimCurve" | "Asset.GMAudioGroup" | "Asset.GMFont" | "Asset.GMObject" | "Asset.GMParticleSystem" | "Asset.GMPath" | "Asset.GMRoom" | "Asset.GMScript" | "Asset.GMSequence" | "Asset.GMShader" | "Asset.GMSound" | "Asset.GMSprite" | "Asset.GMTileSet" | "Asset.GMTimeline" | "Asset.Script" | "Id.AudioEmitter" | "Id.AudioListener" | "Id.AudioSyncGroup" | "Id.BackgroundElement" | "Id.BinaryFile" | "Id.Buffer" | "Id.Camera" | "Id.DsGrid" | "Id.DsList" | "Id.DsMap" | "Id.DsPriority" | "Id.DsQueue" | "Id.DsStack" | "Id.ExternalCall" | "Id.Gif" | "Id.Instance" | "Id.Layer" | "Id.MpGrid" | "Id.ParticleEmitter" | "Id.ParticleSystem" | "Id.ParticleType" | "Id.PhysicsIndex" | "Id.PhysicsParticleGroup" | "Id.Sampler" | "Id.SequenceElement" | "Id.Socket" | "Id.Sound" | "Id.SpriteElement" | "Id.Surface" | "Id.TextFile" | "Id.Texture" | "Id.TileElementId" | "Id.TileMapElement" | "Id.TimeSource" | "Id.Uniform" | "Id.VertexBuffer" | "Id.VertexFormat" | "Mixed" | "EnumMember" | "Unknown" | "Never" | "InstanceType" | "ObjectType" | "StaticType">)[] | { item: import("./project.location.js").ReferenceableType; ref: Reference; } | undefined; protected FIND_ITEM_BY_NAME(name: string, options?: FindSignifierOptions): Signifier | undefined; protected FIND_GLOBAL_BY_NAME(name: string, options: FindSignifierOptions | undefined): Signifier | undefined; /** Given an identifier in the current scope, find the corresponding item. */ protected FIND_ITEM(children: IdentifierCstChildren, options?: FindSignifierOptions): { item: Signifier | WithableType | EnumType; range: Range; } | undefined; get ANY(): Type<"Any">; get BOOLEAN(): Type<"Bool">; get REAL(): Type<"Real">; get UNDEFINED(): Type<"Undefined">; /** * Given parsed JSDocs, convert into a Type and store * it for use by the next symbol. */ PREPARE_JSDOC(jsdoc: JsdocSummary): void; jsdocJs(children: JsdocJsCstChildren): void; jsdocGml(children: JsdocGmlCstChildren): void; withStatement(children: WithStatementCstChildren, context: VisitorContext): void; catchStatement(children: CatchStatementCstChildren, ctx: VisitorContext): void; functionStatement(children: FunctionStatementCstChildren, ctx: VisitorContext): void; functionExpression(children: FunctionExpressionCstChildren, context: VisitorContext): Type<"Function"> | undefined; returnStatement(children: ReturnStatementCstChildren, ctx: VisitorContext): (Type | TypeStore)[]; /** Called on *naked* identifiers and those that have accessors/suffixes of various sorts. */ identifierAccessor(children: IdentifierAccessorCstChildren, context: VisitorContext): (Type | TypeStore)[]; macroStatement(children: MacroStatementCstChildren, ctx: VisitorContext): void; /** Static params are unambiguously defined. */ staticVarDeclarations(children: StaticVarDeclarationsCstChildren, ctx: VisitorContext): { item: Signifier; ref: Reference; } | undefined; globalVarDeclaration(children: GlobalVarDeclarationCstChildren): { item: Signifier; ref: Reference; } | undefined; localVarDeclaration(children: LocalVarDeclarationCstChildren, ctx: VisitorContext): { item: Signifier; ref: Reference; } | undefined; variableAssignment(children: VariableAssignmentCstChildren, ctx: VisitorContext): { item: Signifier; ref: Reference; } | undefined; structLiteral(children: StructLiteralCstChildren, ctx: VisitorContext): Type<'Struct'>; /** * Fallback identifier handler. Figure out what a given * identifier is referencing, and create appropriate references * to make that work.*/ identifier(children: IdentifierCstChildren): { item: Signifier; ref: Reference; } | undefined; assignmentRightHandSide(children: AssignmentRightHandSideCstChildren, context: VisitorContext): (Type | TypeStore)[]; expression(children: ExpressionCstChildren, context: VisitorContext): (Type | TypeStore)[]; primaryExpression(children: PrimaryExpressionCstChildren, context: VisitorContext): (Type | TypeStore)[]; parenthesizedExpression(children: ParenthesizedExpressionCstChildren, context: VisitorContext): (Type | TypeStore)[]; stringLiteral(children: StringLiteralCstChildren, context: VisitorContext): Type<'String'>; multilineDoubleStringLiteral(children: MultilineDoubleStringLiteralCstChildren, context: VisitorContext): Type<'String'>; multilineSingleStringLiteral(children: MultilineSingleStringLiteralCstChildren, context: VisitorContext): Type<'String'>; templateLiteral(children: TemplateLiteralCstChildren, context: VisitorContext): Type<'String'>; arrayLiteral(children: ArrayLiteralCstChildren, ctx: VisitorContext): Type<'Array'>; } //# sourceMappingURL=visitor.d.ts.map