UNPKG

@bscotch/gml-parser

Version:

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

79 lines 2.74 kB
import type { IToken } from 'chevrotain'; import type { IPosition, IRange } from './project.location.js'; declare const patterns: { param: string; description: string; function: string; returns: string; pure: string; mixin: string; ignore: string; deprecated: string; self: string; type: string; localvar: string; globalvar: string; instancevar: string; template: string; unknown: string; }; export type JsdocTagKind = keyof typeof patterns; export type JsdocKind = 'function' | 'description' | 'type' | 'template' | 'param' | 'self' | 'localvar' | 'globalvar' | 'instancevar' | 'returns'; export interface JsdocComponent extends IRange { /** The string content of this token */ content: string; } export interface Jsdoc<T extends JsdocKind = JsdocKind> extends IRange { kind: T; tag?: JsdocComponent; description: string; ignore?: boolean; deprecated?: boolean; mixin?: boolean; templates?: Jsdoc<'template'>[]; params?: Jsdoc<'param'>[]; /** Return type as GML typestring */ returns?: Jsdoc<'returns'>; /** Parameter or variable name */ name?: JsdocComponent; /** If is an optional param */ optional?: boolean; /** The GML typestring, for use by a param, type, localvar, etc */ type?: JsdocComponent; /** For functions or self docs, the GML typestring for an @self/@context */ self?: JsdocComponent; } export interface JsdocSummary extends Jsdoc<'description' | 'function' | 'type' | 'self' | 'globalvar' | 'instancevar' | 'localvar'> { /** * The list of all tags found in this block, and their * respective locations, for use e.g. syntax highlighting. */ tags: JsdocComponent[]; diagnostics: (IRange & { message: string; })[]; /** Locations of all of the types parsed from the JSDoc block */ typeRanges: JsdocComponent[]; } interface JsdocLine { content: string; start: IPosition; } /** * Since single-line style comments make it impossible to * tell when we're in a NEW doc, we need to break lines into * groups */ export declare function gmlLinesByGroup(gmlLines: IToken[]): JsdocLine[][]; export declare function parseJsdoc(jsdocLines: JsdocLine[]): JsdocSummary; export declare function parseJsdoc(gmlLines: IToken[]): JsdocSummary; export declare function parseJsdoc(jsBlock: IToken): JsdocSummary; export declare function parseJsdoc(jsdocString: string, /** * The position of the first character of the jsdoc string, * if it has been parsed out of a larger document. This is * used to offset the positions of discovered tag components. */ startPosition?: IPosition): JsdocSummary; export {}; //# sourceMappingURL=jsdoc.d.ts.map