import { Token, Items, TokenBase, Pattern } from '../syntax/index.js'; export type Expr = Items; export type Statement = Items; export type Identifier = Token; export type Type = Items; export type Binder = { id: Identifier; type?: Type; }; export interface TurnAction { } export interface FacetSetupAction extends TurnAction { body: Statement; } export interface SpawnStatement extends FacetSetupAction { name?: Expr; linkedToken: TokenBase | null; parentBinders: Binder[]; parentInits: Expr[]; } export interface FieldDeclarationStatement extends TurnAction { field: Binder; init?: Expr; } export interface AssertionEndpointStatement extends TurnAction { isDynamic: boolean; template: Expr; test?: Expr; } export interface StatementTurnAction extends TurnAction { body: Statement; } export type FacetToStop = 'default' | Expr; export interface StopStatement extends StatementTurnAction { facetToStop: FacetToStop; } export interface SyncStatement extends StatementTurnAction { peerToSyncWith: Expr; } export interface GenericEventEndpointStatement extends StatementTurnAction { facetToStop: FacetToStop | 'none' | 'once-wrapper'; once: boolean; isDynamic: boolean; } export interface DataflowEndpointStatement extends GenericEventEndpointStatement { triggerType: 'dataflow'; predicate: Expr; } export interface PseudoEventEndpointStatement extends GenericEventEndpointStatement { triggerType: 'stop'; } export interface AssertionEventEndpointStatement extends GenericEventEndpointStatement { triggerType: 'asserted' | 'retracted' | 'message'; pattern: ValuePattern; test?: Expr; } export type EventHandlerEndpointStatement = DataflowEndpointStatement | PseudoEventEndpointStatement | AssertionEventEndpointStatement; export interface TypeDefinitionStatement { expectedUse: 'message' | 'assertion'; label: Identifier; fields: Binder[]; wireName?: Expr; } export interface MessageSendStatement extends TurnAction { expr: Expr; } export interface DuringStatement extends FacetSetupAction { pattern: ValuePattern; test?: Expr; } export interface ReactStatement extends FacetSetupAction { label: Identifier | null; } export interface AtStatement { target: Expr; body: Statement; } export interface CreateExpression { entity: Expr; } export interface PCapture { type: 'PCapture'; binder: Binder; inner: ValuePattern; } export interface PDiscard { type: 'PDiscard'; } export interface PConstant { type: 'PConstant'; value: Expr; } export interface PConstructor { type: 'PConstructor'; ctor: Expr; arguments: ValuePattern[]; } export interface PArray { type: 'PArray'; elements: ValuePattern[]; } export interface PDict { type: 'PDict'; elements: [Expr, ValuePattern][]; } export interface PUnquote { type: 'PUnquote'; unquoted: ValuePattern; } export interface POuterUnquote { type: 'POuterUnquote'; outer: Expr; } export interface PQuote { type: 'PQuote'; quoted: ValuePattern; } export type ValuePattern = PCapture | PDiscard | PConstant | PConstructor | PArray | PDict | PUnquote | POuterUnquote | PQuote; export interface StaticAnalysis { skeleton: Expr; captureBinders: Binder[]; } export declare class SyndicateParser { block(acc?: Items): Pattern; readonly statementBoundary: Pattern; readonly exprBoundary: Pattern; readonly identifier: Pattern; binder(..._extraStops: Pattern[]): Pattern; readonly defaultBinder: Pattern; expr(...extraStops: Pattern[]): Pattern; expr1(...extraStops: Pattern[]): Pattern; propertyNameExpr(): Pattern; readonly type: (...extraStops: Pattern[]) => Pattern; statement(acc: Items): Pattern; turnAction(pattern: (scope: T) => Pattern): Pattern; readonly headerExpr: Pattern; readonly spawn: Pattern; readonly fieldDeclarationStatement: Pattern; readonly assertionEndpointStatement: Pattern; blockTurnAction(kw: Pattern): Pattern; readonly dataflowStatement: Pattern; mandatoryIfNotTerminal(o: GenericEventEndpointStatement, p: Pattern): Pattern; readonly eventHandlerEndpointStatement: Pattern; readonly typeDefinitionStatement: Pattern; readonly messageSendStatement: Pattern; readonly duringStatement: Pattern; readonly reactStatement: Pattern; readonly stopStatement: Pattern; readonly syncStatement: Pattern; readonly atStatement: Pattern; readonly createExpression: Pattern; pCaptureBinder: (b: Pattern) => Pattern; readonly pCaptureDefaultBinder: Pattern; readonly pDiscard: Pattern; pUnquote(level: number, extraStops: Pattern[]): Pattern; pQuote(level: number, extraStops: Pattern[]): Pattern; hasCapturesOrDiscards(e: Expr): boolean; pArray(level: number): Pattern; pDict(level: number): Pattern; pConstructor(level: number, extraStops: Pattern[]): Pattern; valuePattern(level: number, ...extraStops: Pattern[]): Pattern; } export declare class SyndicateTypedParser extends SyndicateParser { binder(...extraStops: Pattern[]): Pattern; } export declare function compilePattern(pattern: ValuePattern): StaticAnalysis;