import type { Annotation, DocumentLocation, DocumentReference, ModelDef, ModelAnnotation, NamedModelObject, Query, StructDef } from '../../../model/malloy_types'; import { Tag } from '@malloydata/malloy-tag'; import type { LogMessageOptions, MessageLogger, MessageParameterType, MessageCode } from '../../parse-log'; import type { MalloyTranslation } from '../../parse-malloy'; import type { ModelDataRequest } from '../../translate-response'; import type { DocumentCompileResult } from './document-compile-result'; import type { ExprValue } from './expr-value'; import type { ModelEntry } from './model-entry'; import type { NameSpace } from './name-space'; import type { Noteable } from './noteable'; import { extendNoteMethod } from './noteable'; export declare abstract class MalloyElement { abstract elementType: string; codeLocation?: DocumentLocation; children: ElementChildren; parent: MalloyElement | null; /** * @param kids All children passed to the constructor are not optional */ constructor(kids?: ElementChildren); /** * Record all elements as children of this element, and mark this * element as their parent. * @param kids Some of these might be undefined, in which case they are ignored */ has(kids: Record): void; get location(): DocumentLocation; set location(loc: DocumentLocation | undefined); get code(): string; protected document(): Document | undefined; protected namespace(): NameSpace | undefined; getDialectNamespace(dialectName: string): NameSpace | undefined; modelEntry(reference: string | ModelEntryReference): ModelEntry | undefined; private xlate?; /** * @returns The eldest of them all */ kupuna(): MalloyElement; translator(): MalloyTranslation | undefined; setTranslator(x: MalloyTranslation): void; addReference(reference: DocumentReference): void; private get sourceURL(); private readonly logged; private log; logError(code: T, parameters: MessageParameterType, options?: Omit): T; logWarning(code: T, parameters: MessageParameterType, options?: Omit): T; loggedErrorExpr(code: T, parameters: MessageParameterType, options?: LogMessageOptions): ExprValue; get logger(): MessageLogger; /** * Mostly for debugging / testing. A string-y version of this object which * is used to ask "are these two AST segments equal". Formatted so that * errors would be human readable. * @param indent only used for recursion */ toString(): string; private stringify; walk(): Generator; private varInfo; protected internalError(msg: string): Error; needs(doc: Document): ModelDataRequest | undefined; inExperiment(experimentId: string, silent?: boolean): boolean; } export declare class Unimplemented extends MalloyElement { elementType: string; reported: boolean; } type ChildBody = MalloyElement | MalloyElement[]; type ElementChildren = Record; export declare class ModelEntryReference extends MalloyElement { readonly name: string; elementType: string; constructor(name: string); get refString(): string; toString(): string; getNamed(): NamedModelObject | undefined; } export interface DocStatement extends MalloyElement { execute(doc: Document): void; } export declare class ExperimentalExperiment extends MalloyElement implements DocStatement { readonly id: string; elementType: string; constructor(id: string); execute(_doc: Document): void; } export declare function isDocStatement(e: MalloyElement): e is DocStatement; export declare function isDocStatementOrDocStatementList(el: MalloyElement): el is DocStatement | DocStatementList; export declare abstract class ListOf extends MalloyElement { protected elements: ET[]; constructor(elements: ET[]); protected newContents(): void; get list(): ET[]; empty(): boolean; notEmpty(): boolean; push(...el: ET[]): ET[]; needs(doc: Document): ModelDataRequest | undefined; } export declare class DocStatementList extends ListOf implements Noteable { elementType: string; execCursor: number; readonly isNoteableObj = true; extendNote: typeof extendNoteMethod; note?: Annotation; noteCursor: number; executeList(doc: Document): ModelDataRequest; } /** * The Document class is a little weird because we might need to bounce back * to the requestor, which might be on the other side of a wire, to get * back some schema information. The intended translation of a Document * is to call initModelDef(), and then to call modelDataRequest() until it * returns undefined. At any time you can call modelDef to get the model * as it exists so far, but the translation is not complete until * modelDataRequest() returns undefined; * * TODO probably modelRequest should be the method and you call it * until it returns a model with no additional data needed ... * that can be tomorrow */ export declare class Document extends MalloyElement implements NameSpace { elementType: string; globalNameSpace: NameSpace; documentModel: Record; queryList: Query[]; statements: DocStatementList; didInitModel: boolean; annotation: Annotation; experiments: Tag; constructor(statements: (DocStatement | DocStatementList)[]); initModelDef(extendingModelDef: ModelDef | undefined): void; compile(): DocumentCompileResult; private modelAnnotationTodoList; rememberToAddModelAnnotations(sd: StructDef): void; hasAnnotation(): boolean; currentModelAnnotation(): ModelAnnotation | undefined; modelDef(): ModelDef; getEntry(str: string): ModelEntry; setEntry(str: string, ent: ModelEntry): void; /** * Return an error message if this dialect is the first reference to this particular * dialect, and the dialect is marked as experimental, and we are not running tests. * @param dialect The dialect name * @returns The error message or undefined */ checkExperimentalDialect(me: MalloyElement, dialect: string): void; private readonly dialectNameSpaces; getDialectNamespace(dialectName: string): NameSpace | undefined; } export {};