import { ParserRuleContext } from 'antlr4ts'; import type { ParseTree, TerminalNode } from 'antlr4ts/tree'; import { AbstractParseTreeVisitor } from 'antlr4ts/tree/AbstractParseTreeVisitor'; import type { MalloyParserVisitor } from './lib/Malloy/MalloyParserVisitor'; import type * as Malloy from '@malloydata/malloy-interfaces'; import * as parse from './lib/Malloy/MalloyParser'; import type { LogMessageOptions, MessageCode, MessageLogger, MessageParameterType } from './parse-log'; import type { DocumentLocation } from '../model/malloy_types'; import type { ParseInfo } from './utils'; import type { TimeLiteral } from './ast'; type HasAnnotations = ParserRuleContext & { ANNOTATION: () => TerminalNode[]; }; type Node = Malloy.Query | Malloy.QueryDefinitionWithArrow | Malloy.QueryDefinitionWithQueryReference | Malloy.QueryDefinitionWithRefinement | null; /** * ANTLR visitor pattern parse tree traversal. Generates a Malloy * AST from an ANTLR parse tree. */ export declare class MalloyToQuery extends AbstractParseTreeVisitor implements MalloyParserVisitor { readonly parseInfo: ParseInfo; readonly msgLog: MessageLogger; constructor(parseInfo: ParseInfo, msgLog: MessageLogger); /** * Mostly used to flag a case where the grammar and the type system are * no longer in sync. A visitor was written based on a grammar which * apparently has changed and now an unexpected element type has appeared. * This is a non recoverable error, since the parser and the grammar * are not compatible. * @return an error object to throw. */ protected internalError(cx: ParserRuleContext, message: string): Error; protected getLocation(cx: ParserRuleContext): DocumentLocation; /** * Log an error message relative to a parse node */ protected contextError(cx: ParserRuleContext, code: T, data: MessageParameterType, options?: LogMessageOptions): void; protected getNumber(term: ParseTree): number; protected defaultResult(): Node; /** * Get all the possibly missing annotations from this parse rule * @param cx Any parse context which has an ANNOTATION* rules * @returns Array of texts for the annotations */ protected getAnnotations(cx: HasAnnotations): Malloy.Annotation[] | undefined; protected getIsAnnotations(cx?: parse.IsDefineContext): Malloy.Annotation[] | undefined; protected notAllowed(pcx: ParserRuleContext, what: string): void; protected illegal(pcx: ParserRuleContext, what: string): void; visitMalloyDocument(pcx: parse.MalloyDocumentContext): Malloy.Query | null; visitRunStatement(pcx: parse.RunStatementContext): Malloy.Query | null; protected getSourceArguments(cx: parse.SourceArgumentsContext): Malloy.ParameterValue[] | null; protected getQueryReference(cx: parse.SQIDContext): Malloy.Reference | null; protected getQueryDefinition(cx: parse.SqExprContext): Malloy.QueryDefinition | null; protected getRefinementSegment(cx: parse.SegExprContext): Malloy.ViewDefinition | null; protected getGroupByStatement(gbcx: parse.GroupByStatementContext): Malloy.ViewOperationWithGroupBy[] | null; protected getAggregateStatement(agcx: parse.AggregateStatementContext): Malloy.ViewOperationWithAggregate[] | null; protected getOrderByStatement(obcx: parse.OrderByStatementContext): Malloy.ViewOperationWithOrderBy[] | null; protected getNestStatement(nstcx: parse.NestStatementContext): Malloy.ViewOperationWithNest[] | null; protected getViewExpression(cx: parse.VExprContext): Malloy.ViewDefinition | null; protected getLimitStatement(cx: parse.LimitStatementContext): Malloy.ViewOperationWithLimit | null; protected getSegmentOperation(cx: parse.QueryStatementContext): Malloy.ViewOperation[] | null; protected getFieldPath(pcx: parse.FieldPathContext): { name: string; path?: string[]; }; protected getTimeframe(cx: parse.TimeframeContext): Malloy.TimestampTimeframe | null; protected getQueryField(cx: parse.QueryFieldEntryContext): { name?: string; field: Malloy.Field; } | null; getFieldExpression(cx: parse.FieldExprContext): Malloy.Expression | null; stripQuote(s: string, q: string): string; getFilterString(cx: parse.FilterStringContext): string | null; getFilterExpr(cx: parse.FieldExprContext): Malloy.FilterOperation | null; getTimeLiteral(literalCx: parse.LiteralContext, parse: (text: string) => TimeLiteral | undefined): Malloy.LiteralValueWithDateLiteral | Malloy.LiteralValueWithTimestampLiteral | null; getLiteralIncludingNegativeNumber(cx: parse.FieldExprContext): Malloy.LiteralValue | null; getLiteral(literalCx: parse.LiteralContext): Malloy.LiteralValue | null; getDrill(drillCx: parse.DrillStatementContext): Malloy.DrillOperation[] | null; getWhere(whereCx: parse.WhereStatementContext): Malloy.FilterOperation[] | null; getHaving(havingCx: parse.HavingStatementContext): Malloy.FilterOperation[] | null; protected combineAnnotations(...a: (Malloy.Annotation[] | undefined)[]): Malloy.Annotation[] | undefined; } export declare function malloyToQuery(code: string): { query?: Malloy.Query; logs: Malloy.LogMessage[]; }; export {};