UNPKG

@bscotch/gml-parser

Version:

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

50 lines 2.22 kB
import { Pathy } from '@bscotch/pathy'; import type { IRange, LinePosition } from './project.location.js'; export declare class StitchParserError extends Error { constructor(message?: string, assertion?: Function); } export type Defined<T> = Exclude<T, undefined>; export type Values<T> = T[keyof T]; export type Constructor<T = {}> = new (...args: any[]) => T; export declare const runningInVscode: boolean; export interface Logger { (...args: unknown[]): void; enabled: boolean; } export declare const log: Logger; export declare function throwError(message?: string, asserter?: Function): never; export declare function assert(condition: any, message?: string): asserts condition; /** @alias assert */ export declare const ok: typeof assert; export declare function stringify(obj: unknown): string; /** * There are multiple ways that Feather/GameMaker accept types to * be encoded in strings. To simplify parsing on our end, we normalize * them all to a single format. */ export declare function normalizeTypeString(typeString: string): string; export declare function isInRange(range: IRange, offset: number | LinePosition): boolean; export declare function isBeforeRange(range: IRange, offset: number | LinePosition): boolean; export declare function isArray<T>(value: unknown): value is T[] | readonly T[]; export declare function isValidIdentifier(name: string): boolean; export declare function assertIsValidIdentifier(name: string): void; /** * Depending on the origin, an asset group path could look like * a regular path (`my/path`) or like the path from a config file * (`folders/my/path.yy`). * * This function returns the POSIX-style path (`my/path`) given * one of those inputs/ */ export declare function groupPathToPosix(path: string): string; export declare function xor(a: any, b: any): any; export declare function neither(a: any, b: any): boolean; export declare function findYyFile(dir: Pathy): Promise<Pathy>; /** * Given the path to an image file, read just enough bytes to * ensure it's a PNG and to get its width and height */ export declare function getPngSize(path: string | Pathy): Promise<{ width: number; height: number; }>; //# sourceMappingURL=util.d.ts.map