Documentation
¶
Overview ¶
Plik: flow/core/resolver.go
Index ¶
- func Analyze(resolver CapabilityResolver, expr Expr) error
- func AtomNames(e Expr) []string
- func Build(ctx context.Context, resolver CapabilityResolver, modifiers *ModifierTable, ...) (action.AnyAction, error)
- func BuildEnv(input any) map[string]any
- func CompileAction(resolver CapabilityResolver, dt *DirectiveTable, mt *ModifierTable, ...) *action.BuiltAction[CompileReq, CompileRes]
- func CompileAndRun(resolver CapabilityResolver, dt *DirectiveTable, mt *ModifierTable, ...) *action.BuiltAction[CompileAndRunReq, RunRes]
- func ComposedPipe(left, right action.AnyAction) action.AnyAction
- func Decode[T any](raw map[string]string) (T, error)
- func IndexTopLevel(s string, target byte) int
- func Library(resolver CapabilityResolver, dt *DirectiveTable, mt *ModifierTable, ...) action.Library
- func ModifiersToMap(modifiers []string) map[string]any
- func ParseBlockOptions(lines []string, start int) (opts map[string]string, next int, err error)
- func ParseList(line string) []string
- func Preprocess(ctx context.Context, dt *DirectiveTable, source, file string) (clean string, meta map[string]any, err error)
- func PreprocessDots(src string) string
- func ReadBlock(lines []string, start int) (body []string, next int, err error)
- func Register(id string, factory BundleFactory)
- func RegisterBoundary(spec BoundarySpec)
- func RegisterBundle(id string, factory BundleFactory)
- func RunAction() *action.BuiltAction[RunReq, RunRes]
- func SourceError(pos Position, format string, args ...any) error
- func SplitTopLevel(s string, sep byte) []string
- func SuggestModifierFix(target action.AnyAction, name string) string
- func TrimQuotes(s string) string
- func ValidateBundle(b Bundle) error
- func WithCompileConfig(ctx context.Context, cfg map[string]string, cliArgs []string) context.Context
- func WithStrict(ctx context.Context) context.Context
- type AssertExpr
- type Associativity
- type Atom
- type AtomAdviseFunc
- type AtomSpec
- type BoundarySpec
- type BuildContext
- type Bundle
- type BundleFactory
- type CapabilityContract
- type CapabilityResolver
- type Catalog
- type CompileAndRunReq
- type CompileOption
- func BundleConfig(bundles ...Bundle) []CompileOption
- func WithAtomAdvisors(fns ...AtomAdviseFunc) CompileOption
- func WithConfigMap(cfg map[string]string, cliArgs []string) CompileOption
- func WithOnPreprocess(fns ...OnPreprocessFunc) CompileOption
- func WithPipelineWrappers(fns ...PipelineWrapFunc) CompileOption
- type CompileReq
- type CompileRes
- type ConditionalExpr
- type ContractProvider
- type Directive
- type DirectiveReq
- type DirectiveRes
- type DirectiveSpec
- type DirectiveTable
- type DynamicResolver
- func (r *DynamicResolver) Action(name string) (action.AnyAction, bool)
- func (r *DynamicResolver) ActionNames() []string
- func (r *DynamicResolver) Actions() []action.AnyAction
- func (r *DynamicResolver) Contract(name string) (CapabilityContract, bool)
- func (r *DynamicResolver) Mount(lib action.Library) error
- func (r *DynamicResolver) MountWithAlias(lib action.Library, alias string) error
- func (r *DynamicResolver) Operator(name string) (action.NamedOperator, bool)
- func (r *DynamicResolver) Operators() []action.NamedOperator
- func (r *DynamicResolver) Stream(name string) (action.AnyStreamAction, bool)
- func (r *DynamicResolver) Streams() []action.AnyStreamAction
- type Expr
- type FallbackExpr
- type FieldSpec
- type KeywordPrimary
- type Lexer
- type LoopExpr
- type MapEntry
- type MaterializeReq
- type Materializer
- type Modifier
- func Duration(name string, ...) Modifier
- func Flag(name string, apply func(*action.Builder[any, any]) *action.Builder[any, any]) Modifier
- func Float64(name string, ...) Modifier
- func Int(name string, ...) Modifier
- func Int32(name string, ...) Modifier
- func Int64(name string, ...) Modifier
- func String(name string, ...) Modifier
- func StringList(name string, ...) Modifier
- type ModifierSpec
- type ModifierTable
- type OnPreprocessFunc
- type Operator
- type OperatorMeta
- type OperatorReq
- type OperatorRes
- type OperatorSpec
- type OperatorTable
- func (t *OperatorTable) Actions() []action.AnyAction
- func (t *OperatorTable) All() []OperatorMeta
- func (t *OperatorTable) ByName(name string) (OperatorMeta, *action.BuiltAction[OperatorReq, OperatorRes], bool)
- func (t *OperatorTable) ByToken(tok TokenType) (OperatorMeta, *action.BuiltAction[OperatorReq, OperatorRes], bool)
- type ParallelExpr
- type Parser
- func NewParser(ctx context.Context, ops *OperatorTable, src string) *Parser
- func NewParserWithFile(ctx context.Context, ops *OperatorTable, primaries *PrimaryExtensionTable, ...) *Parser
- func NewParserWithFileOffset(ctx context.Context, ops *OperatorTable, primaries *PrimaryExtensionTable, ...) *Parser
- func NewParserWithPrimaries(ctx context.Context, ops *OperatorTable, primaries *PrimaryExtensionTable, ...) *Parser
- func (p *Parser) Advance()
- func (p *Parser) Cur() Token
- func (p *Parser) Current() Token
- func (p *Parser) Fail(line int, format string, args ...any) error
- func (p *Parser) File() string
- func (p *Parser) Next()
- func (p *Parser) Parse() (Expr, error)
- func (p *Parser) ParseExpr(minPrec int) (Expr, error)
- func (p *Parser) Src() string
- func (p *Parser) SubParse(src string) (Expr, error)
- type PipeExpr
- type PipelineWrapFunc
- type Position
- type PreprocessContributions
- type PrimaryExtension
- type PrimaryExtensionTable
- type ProjectionExpr
- type RunReq
- type RunRes
- type SelfTestFeature
- type SelfTestSection
- type SourceSpec
- type Token
- type TokenPrimary
- type TokenType
- type TypeDescriptor
- type Value
- type ValueKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Analyze ¶
func Analyze(resolver CapabilityResolver, expr Expr) error
Analyze runs polymorphic contract validation on the AST. It is a compile-time gate: any edge whose producer output cannot be coerced into the consumer input fails here, before Execute is ever reached.
The rule mirrors runtime Coerce exactly — nominal assignability first, then a JSON round-trip for the same struct-to-struct cases the runtime decoder handles. If a pipeline compiles here, it will not fail at runtime with "cannot coerce input into target".
func Build ¶
func Build( ctx context.Context, resolver CapabilityResolver, modifiers *ModifierTable, e Expr, advisers ...AtomAdviseFunc, ) (action.AnyAction, error)
Build lowers an AST into a runnable action tree, resolving every capability through the supplied resolver.
The function is a thin dispatcher: every node implements its own Build method. Core never switches on concrete AST types.
func CompileAction ¶
func CompileAction( resolver CapabilityResolver, dt *DirectiveTable, mt *ModifierTable, ot *OperatorTable, pt *PrimaryExtensionTable, opts ...CompileOption, ) *action.BuiltAction[CompileReq, CompileRes]
func CompileAndRun ¶
func CompileAndRun( resolver CapabilityResolver, dt *DirectiveTable, mt *ModifierTable, ot *OperatorTable, pt *PrimaryExtensionTable, _ ...CompileOption, ) *action.BuiltAction[CompileAndRunReq, RunRes]
func ComposedPipe ¶
ComposedPipe is the Flow adapter for Kernel's dynamic pipe composition. Flow owns the DSL/lowering decision; Kernel owns invocation, cancellation, error propagation, and lifecycle behavior.
func Decode ¶
Decode mapuje string map na typowany struct opcji. To jest kontrakt, którego każdy zewnętrzny Bundle używa do odczytu swojego bloku @require.
Tagi:
flow:"key" nazwa klucza w bloku @require default:"..." wartość gdy klucz nieobecny
Nieznane klucze są odrzucane — literówka w .nflow ma się wywalić głośno przy ładowaniu, nie cicho zdefaultować.
Obsługiwane typy pól: string, bool, int, int64, time.Duration, float64. Każdy inny to błąd projektowy Bundle.
func IndexTopLevel ¶
IndexTopLevel returns the index of the first occurrence of target in s at bracket depth zero, outside quoted strings. Returns -1 when absent. Companion to SplitTopLevel.
func Library ¶
func Library( resolver CapabilityResolver, dt *DirectiveTable, mt *ModifierTable, ot *OperatorTable, pt *PrimaryExtensionTable, opts ...CompileOption, ) action.Library
func ModifiersToMap ¶
ModifiersToMap parses a slice of raw modifier strings (e.g. "ext=txt", "by=rel_path", "tests") into a map of parameters for stream sources and operators.
func ParseBlockOptions ¶
ParseBlockOptions reads a `{ key: value, ... }` block via ReadBlock and parses each entry as a `key: value` pair. Returns nil for an empty block.
func ParseList ¶
ParseList extracts the first bracketed list `[a, b, c]` from a line. Returns nil for `[]` or when no brackets are present.
func Preprocess ¶
func Preprocess(ctx context.Context, dt *DirectiveTable, source, file string) (clean string, meta map[string]any, err error)
Preprocess executes directives from the dt table.
Cycle detection uses a call-stack, not a global set. This allows diamond dependencies (A → B → common, A → C → common) while still catching true cycles (A → B → A). The error message carries the exact include chain so the user sees which edge closes the loop.
func PreprocessDots ¶
func ReadBlock ¶
ReadBlock extracts the raw body of a `{ ... }` block starting at lines[start]. Handles all three shapes uniformly:
inline: @x NAME { a: 1, b: 2 }
multi-line: @x NAME {
a: 1
b: 2
}
tail-brace: @x NAME {
a: 1
b: 2 }
Returns one entry per top-level comma-separated element. Callers interpret entries: `key: value` for @config/@llm/@sandbox/@pool, `Field Type` for @schema.
Comments (`#`, `//`) and blank lines inside the block are dropped.
func Register ¶
func Register(id string, factory BundleFactory)
Register rejestruje fabrykę bundla pod podanym ID.
func RegisterBoundary ¶
func RegisterBoundary(spec BoundarySpec)
func RegisterBundle ¶
func RegisterBundle(id string, factory BundleFactory)
RegisterBundle to alias do Register dla pełnej kompatybilności.
func SplitTopLevel ¶
SplitTopLevel splits s on sep, respecting quoted strings (" ' `), balanced brackets, and backslash escapes. Returns the raw segments, not trimmed. Callers trim themselves.
func SuggestModifierFix ¶
SuggestModifierFix returns a human-readable explanation for why a modifier name cannot be applied to a given action, or empty when no better fix than "unknown modifier" is available.
The dominant real-world mistake: the author writes :file=... where the action takes @{ file: ... }. The check against the action's Req struct catches that before the runtime sees a modifier-table miss.
func TrimQuotes ¶
TrimQuotes removes one matched pair of surrounding quotes (" ' `), or returns s unchanged.
func ValidateBundle ¶
func WithCompileConfig ¶
Types ¶
type AssertExpr ¶
AssertExpr: assert(condition, message).
func (*AssertExpr) Analyze ¶
func (*AssertExpr) Analyze(CapabilityResolver) error
func (*AssertExpr) Build ¶
func (a *AssertExpr) Build(_ context.Context, _ *BuildContext) (action.AnyAction, error)
func (*AssertExpr) Children ¶
func (a *AssertExpr) Children() []Expr
func (*AssertExpr) Node ¶
func (*AssertExpr) Node()
type Atom ¶
type Atom struct {
Name string
Params map[string]string
Modifiers []string
Args map[string]*Value
Prompt string
Targets []string
Excludes []string
}
Atom is a single runtime action call.
func (*Atom) Analyze ¶
func (*Atom) Analyze(CapabilityResolver) error
type AtomSpec ¶
type AtomSpec struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Tags []string `json:"tags,omitempty"`
Scope string `json:"scope,omitempty"`
ReqFields []FieldSpec `json:"req_fields,omitempty"`
ResFields []FieldSpec `json:"res_fields,omitempty"`
Example json.RawMessage `json:"example,omitempty"`
}
type BoundarySpec ¶
type BoundarySpec struct {
Name string
Description string
Consume func(stream action.AnyStreamAction) *action.Builder[any, any]
}
BoundarySpec is a stream-to-unary adapter. It is the only place in a pipeline where iter.Seq2[T, error] becomes a single value.
func BoundaryByName ¶
func BoundaryByName(name string) (BoundarySpec, bool)
func NamedBoundaries ¶
func NamedBoundaries() []BoundarySpec
type BuildContext ¶
type BuildContext struct {
Resolver CapabilityResolver
Modifiers *ModifierTable
Advisers []AtomAdviseFunc
}
BuildContext carries every dependency a node needs to lower itself into a runnable action. It is deliberately a small value struct: the AST knows how to Build itself, core just provides the pieces.
type Bundle ¶
type Bundle struct {
ID string
Alias string // Local @require qualifier replacing library namespaces for this compilation.
Libraries []action.Library
Directives []Directive
Modifiers []Modifier
Operators []Operator
Primaries []PrimaryExtension
Materialize Materializer
OnPreprocess func(meta map[string]any) PreprocessContributions
AtomAdvise func(atom *Atom, builder *action.Builder[any, any]) error
WrapPipeline func(meta map[string]any, inner action.AnyAction) (action.AnyAction, error)
SelfTest func() []SelfTestSection
Fixtures fs.FS
}
Bundle is one extension distribution.
func RegisteredBundles ¶
func RegisteredBundles() []Bundle
RegisteredBundles zwraca wszystkie zarejestrowane bundly posortowane alfabetycznie.
func (Bundle) AllSelfTests ¶
func (b Bundle) AllSelfTests() []SelfTestSection
type BundleFactory ¶
func Lookup ¶
func Lookup(id string) (BundleFactory, bool)
Lookup znajduje zarejestrowany bundle po dokładnym ID.
func LookupBundleForModule ¶
func LookupBundleForModule(target string) (BundleFactory, bool)
LookupBundleForModule zapewnia wsteczną kompatybilność dla testów jednostkowych.
type CapabilityContract ¶
type CapabilityContract struct {
Name string
Input TypeDescriptor
Output TypeDescriptor
}
type CapabilityResolver ¶
type CapabilityResolver interface {
Action(name string) (action.AnyAction, bool)
Stream(name string) (action.AnyStreamAction, bool)
Operator(name string) (action.NamedOperator, bool)
Mount(lib action.Library) error
MountWithAlias(lib action.Library, alias string) error
}
CapabilityResolver odcina rdzeń kompilatora od twardej bazy akcji.
type Catalog ¶
type Catalog struct {
Atoms []AtomSpec `json:"atoms"`
Sources []SourceSpec `json:"sources"`
Operators []OperatorSpec `json:"operators"`
Modifiers []ModifierSpec `json:"modifiers"`
Directives []DirectiveSpec `json:"directives"`
}
Catalog is a machine-readable dump of the compiler surface: every atom, stream source, operator, modifier, and directive known to the resolver and tables. Consumed by `nflow catalog`, `nflow list`, `nflow show`, and the linter. Regenerated on every build — no manual maintenance.
func BuildCatalog ¶
func BuildCatalog( resolver CapabilityResolver, mt *ModifierTable, dt *DirectiveTable, ot *OperatorTable, ) Catalog
BuildCatalog extracts the full compiler surface from the live resolver and tables. Atom fields come from TypedPayload when the atom is a *BuiltAction[Req, Res]; free-form actions show no fields.
type CompileAndRunReq ¶
type CompileOption ¶
type CompileOption func(*compileConfig)
func BundleConfig ¶
func BundleConfig(bundles ...Bundle) []CompileOption
BundleConfig collects every extension point from a set of bundles into a single set of CompileOptions. Called once at startup.
func WithAtomAdvisors ¶
func WithAtomAdvisors(fns ...AtomAdviseFunc) CompileOption
func WithConfigMap ¶
func WithConfigMap(cfg map[string]string, cliArgs []string) CompileOption
WithConfigMap carries @config resolution context: the merged key→value map plus the raw CLI args for @flag. lookups.
func WithOnPreprocess ¶
func WithOnPreprocess(fns ...OnPreprocessFunc) CompileOption
func WithPipelineWrappers ¶
func WithPipelineWrappers(fns ...PipelineWrapFunc) CompileOption
type CompileReq ¶
type CompileReq struct {
Source string
Name string
Line int
InheritedPrimaries []PrimaryExtension
}
type ConditionalExpr ¶
ConditionalExpr: cond ? then : else.
func (*ConditionalExpr) Analyze ¶
func (c *ConditionalExpr) Analyze(r CapabilityResolver) error
func (*ConditionalExpr) Build ¶
func (c *ConditionalExpr) Build(ctx context.Context, bCtx *BuildContext) (action.AnyAction, error)
func (*ConditionalExpr) Children ¶
func (c *ConditionalExpr) Children() []Expr
func (*ConditionalExpr) Node ¶
func (*ConditionalExpr) Node()
type ContractProvider ¶
type ContractProvider interface {
Contract(name string) (CapabilityContract, bool)
}
type Directive ¶
type Directive struct {
Name string
Example string
Handler func(context.Context, DirectiveReq) (DirectiveRes, error)
}
func (Directive) Action ¶
func (d Directive) Action() *action.BuiltAction[DirectiveReq, DirectiveRes]
type DirectiveReq ¶
type DirectiveReq struct {
Lines []string
Body []string
I int
Out map[string]any
File string
BaseDir string
// Recurse runs the full preprocess on another .nflow file and
// returns its cleaned body plus merged metadata. Used by @include
// so directives in included files produce declarations in the
// parent's Out map.
Recurse func(absPath string) (clean string, meta map[string]any, err error)
}
type DirectiveRes ¶
type DirectiveRes struct {
Next int
}
type DirectiveSpec ¶
type DirectiveTable ¶
type DirectiveTable struct {
// contains filtered or unexported fields
}
func NewDirectiveTable ¶
func NewDirectiveTable(ds ...Directive) *DirectiveTable
func (*DirectiveTable) Actions ¶
func (t *DirectiveTable) Actions() []action.AnyAction
func (*DirectiveTable) All ¶
func (t *DirectiveTable) All() []Directive
func (*DirectiveTable) ByName ¶
func (t *DirectiveTable) ByName(name string) (*action.BuiltAction[DirectiveReq, DirectiveRes], bool)
type DynamicResolver ¶
type DynamicResolver struct {
// contains filtered or unexported fields
}
func NewDynamicResolver ¶
func NewDynamicResolver(baseLibs ...action.Library) (*DynamicResolver, error)
func (*DynamicResolver) Action ¶
func (r *DynamicResolver) Action(name string) (action.AnyAction, bool)
func (*DynamicResolver) ActionNames ¶ added in v0.11.0
func (r *DynamicResolver) ActionNames() []string
ActionNames returns every canonical action name in stable order.
func (*DynamicResolver) Actions ¶ added in v0.11.0
func (r *DynamicResolver) Actions() []action.AnyAction
Actions returns each mounted action once, keyed by its canonical metadata name.
func (*DynamicResolver) Contract ¶
func (r *DynamicResolver) Contract(name string) (CapabilityContract, bool)
func (*DynamicResolver) MountWithAlias ¶
func (r *DynamicResolver) MountWithAlias(lib action.Library, alias string) error
func (*DynamicResolver) Operator ¶
func (r *DynamicResolver) Operator(name string) (action.NamedOperator, bool)
func (*DynamicResolver) Operators ¶ added in v0.11.0
func (r *DynamicResolver) Operators() []action.NamedOperator
Operators returns mounted stream operators in stable order.
func (*DynamicResolver) Stream ¶
func (r *DynamicResolver) Stream(name string) (action.AnyStreamAction, bool)
func (*DynamicResolver) Streams ¶ added in v0.11.0
func (r *DynamicResolver) Streams() []action.AnyStreamAction
Streams returns mounted stream sources in stable order.
type Expr ¶
type Expr interface {
Node()
Children() []Expr
Analyze(resolver CapabilityResolver) error
Build(ctx context.Context, bCtx *BuildContext) (action.AnyAction, error)
}
Expr is the root of the AST. Every node knows how to report its children, how to validate its contract (Analyze), and how to lower itself into a runnable action (Build). Core never switches on concrete AST types.
type FallbackExpr ¶
type FallbackExpr struct{ L, R Expr }
FallbackExpr: left || right.
func (*FallbackExpr) Analyze ¶
func (f *FallbackExpr) Analyze(r CapabilityResolver) error
func (*FallbackExpr) Build ¶
func (f *FallbackExpr) Build(ctx context.Context, bCtx *BuildContext) (action.AnyAction, error)
func (*FallbackExpr) Children ¶
func (f *FallbackExpr) Children() []Expr
func (*FallbackExpr) Node ¶
func (*FallbackExpr) Node()
type KeywordPrimary ¶
type KeywordPrimary interface {
PrimaryExtension
Keyword() string
}
KeywordPrimary is the keyword-dispatch contract.
type LoopExpr ¶
LoopExpr: loop(body) until(condition).
func (*LoopExpr) Analyze ¶
func (l *LoopExpr) Analyze(r CapabilityResolver) error
type MaterializeReq ¶
type MaterializeReq struct {
Ctx context.Context
Meta map[string]any
Resolver CapabilityResolver
Compile func(name, source string) (action.AnyAction, error)
Alias string
}
MaterializeReq przekazuje kontekst, metadane i kompilator do fazy materializacji.
type Materializer ¶
type Materializer func(req MaterializeReq) error
Materializer zamienia deklaracje z meta na działające akcje w resolverze.
type Modifier ¶
type Modifier struct {
Name string
Example string
Apply func(b *action.Builder[any, any], raw string) error
}
Modifier is one `:name` or `:name=value` annotation on an atom.
Name is the identifier without the leading colon. Apply runs once per occurrence, in source order, on the atom's builder. The raw string is the DSL text after `=`, or "" for a flag. The parser has already stripped surrounding quotes and expanded adjacent tokens, so no modifier needs to worry about either.
func Flag ¶
Flag handles modifiers that take no value (`:coalesce`, `:dedup`). Passing a value is rejected loudly — `:dedup=yes` in the DSL is a mistake the author should see, not silently accept.
type ModifierSpec ¶
type ModifierTable ¶
type ModifierTable struct {
// contains filtered or unexported fields
}
ModifierTable indexes modifiers by name. Construction is eager: a duplicate name panics, so a bundle cannot silently shadow another.
func NewModifierTable ¶
func NewModifierTable(modifiers ...Modifier) *ModifierTable
func (*ModifierTable) Actions ¶
func (t *ModifierTable) Actions() []action.AnyAction
func (*ModifierTable) All ¶
func (t *ModifierTable) All() []Modifier
func (*ModifierTable) ApplyAll ¶
ApplyAll wraps target once, applies every modifier in source order, and builds once. Two allocations total: the Builder and the BuiltAction.
When a modifier name is unknown, the hint path checks whether the name matches a field of the action's request struct. That is the common DSL-author mistake — writing :file=... where the action takes @{ file: ... } — and it produces a fix-the-typo message instead of a bare "unknown modifier".
type OnPreprocessFunc ¶
type OnPreprocessFunc func(meta map[string]any) PreprocessContributions
OnPreprocessFunc is the compile-time hook fired between Preprocess and Parse. BundleConfig wires it from Bundle.OnPreprocess.
type Operator ¶
type Operator struct {
Meta OperatorMeta
Handler func(context.Context, OperatorReq) (OperatorRes, error)
}
func (Operator) Action ¶
func (o Operator) Action() *action.BuiltAction[OperatorReq, OperatorRes]
type OperatorMeta ¶
type OperatorReq ¶
type OperatorReq struct {
Left Expr
Right Expr
Meta *OperatorMeta
}
type OperatorRes ¶
type OperatorRes struct {
Node Expr
}
type OperatorSpec ¶
type OperatorTable ¶
type OperatorTable struct {
// contains filtered or unexported fields
}
func NewOperatorTable ¶
func NewOperatorTable(ops ...Operator) *OperatorTable
func (*OperatorTable) Actions ¶
func (t *OperatorTable) Actions() []action.AnyAction
func (*OperatorTable) All ¶
func (t *OperatorTable) All() []OperatorMeta
func (*OperatorTable) ByName ¶
func (t *OperatorTable) ByName(name string) (OperatorMeta, *action.BuiltAction[OperatorReq, OperatorRes], bool)
func (*OperatorTable) ByToken ¶
func (t *OperatorTable) ByToken(tok TokenType) (OperatorMeta, *action.BuiltAction[OperatorReq, OperatorRes], bool)
type ParallelExpr ¶
type ParallelExpr struct{ Branches []Expr }
ParallelExpr: N branches executed concurrently.
func (*ParallelExpr) Analyze ¶
func (p *ParallelExpr) Analyze(r CapabilityResolver) error
func (*ParallelExpr) Build ¶
func (p *ParallelExpr) Build(ctx context.Context, bCtx *BuildContext) (action.AnyAction, error)
func (*ParallelExpr) Children ¶
func (p *ParallelExpr) Children() []Expr
func (*ParallelExpr) Node ¶
func (*ParallelExpr) Node()
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func NewParser ¶
func NewParser(ctx context.Context, ops *OperatorTable, src string) *Parser
NewParser is the no-file convenience used in tests. Parse errors report only the line number.
func NewParserWithFile ¶
func NewParserWithFile( ctx context.Context, ops *OperatorTable, primaries *PrimaryExtensionTable, src, file string, ) *Parser
NewParserWithFile carries the source path so parse errors are formatted as `file:line`, which terminals make clickable.
func NewParserWithFileOffset ¶
func NewParserWithFileOffset( ctx context.Context, ops *OperatorTable, primaries *PrimaryExtensionTable, src, file string, lineBase int, ) *Parser
NewParserWithFileOffset additionally shifts reported line numbers by lineBase. Used when a fragment (e.g. a @pipeline body) is parsed in isolation but its errors must point at the parent file's lines.
func NewParserWithPrimaries ¶
func NewParserWithPrimaries( ctx context.Context, ops *OperatorTable, primaries *PrimaryExtensionTable, src string, ) *Parser
NewParserWithPrimaries is kept for compatibility with callers that pass a primaries table explicitly.
func (*Parser) Advance ¶
func (p *Parser) Advance()
Advance is an alias for Next, exported for external primary extensions.
func (*Parser) Fail ¶
Fail reports a parse error at the given line offset by lineBase. Exported so external primary extensions can format errors the same way the built-in parser does.
func (*Parser) ParseExpr ¶
ParseExpr parses a sub-expression with the given minimum precedence. Exported so primary extensions can recurse without reimplementing the precedence-climbing loop.
type PipeExpr ¶
type PipeExpr struct{ L, R Expr }
PipeExpr: left -> right.
func (*PipeExpr) Analyze ¶
func (p *PipeExpr) Analyze(r CapabilityResolver) error
type PipelineWrapFunc ¶
type PreprocessContributions ¶
type PreprocessContributions struct {
Primaries []PrimaryExtension
CompileOpts []CompileOption
}
func PreprocessContributionsFromMeta ¶
func PreprocessContributionsFromMeta(meta map[string]any, opts ...CompileOption) PreprocessContributions
type PrimaryExtension ¶
PrimaryExtension przechwytuje jeden token-form i zamienia go w węzeł AST. W parsePrimary extensions mają pierwszeństwo przed built-inami.
Kontrakt jest celowo minimalny: rozszerzenie implementuje Name i Parse, oraz — w zależności od tego, czym rozszerza parser — jedno z:
TokenType() TokenType — dispatch po tokenie (np. TokAtPrompt) Keyword() string — dispatch po nazwie identu (np. "loop")
Rozszerzenie może implementować jedno, drugie, albo oba.
type PrimaryExtensionTable ¶
type PrimaryExtensionTable struct {
// contains filtered or unexported fields
}
func DefaultPrimaryExtensions ¶
func DefaultPrimaryExtensions() *PrimaryExtensionTable
DefaultPrimaryExtensions zwraca PUSTĄ tabelę. Core nie zna żadnego konkretnego rozszerzenia.
func NewPrimaryExtensionTable ¶
func NewPrimaryExtensionTable(exts ...PrimaryExtension) *PrimaryExtensionTable
func (*PrimaryExtensionTable) All ¶
func (t *PrimaryExtensionTable) All() []PrimaryExtension
func (*PrimaryExtensionTable) ByKeyword ¶
func (t *PrimaryExtensionTable) ByKeyword(kw string) (PrimaryExtension, bool)
func (*PrimaryExtensionTable) ByToken ¶
func (t *PrimaryExtensionTable) ByToken(tt TokenType) (PrimaryExtension, bool)
type ProjectionExpr ¶
type ProjectionExpr struct{ Raw string }
ProjectionExpr: raw content `{ ... }`.
func (*ProjectionExpr) Analyze ¶
func (*ProjectionExpr) Analyze(CapabilityResolver) error
func (*ProjectionExpr) Build ¶
func (p *ProjectionExpr) Build(ctx context.Context, bCtx *BuildContext) (action.AnyAction, error)
func (*ProjectionExpr) Children ¶
func (p *ProjectionExpr) Children() []Expr
func (*ProjectionExpr) Node ¶
func (*ProjectionExpr) Node()
type SelfTestFeature ¶
type SelfTestSection ¶
type SelfTestSection struct {
Name string
Features []SelfTestFeature
}
type SourceSpec ¶
type SourceSpec struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Tags []string `json:"tags,omitempty"`
ReqFields []FieldSpec `json:"req_fields,omitempty"`
}
SourceSpec describes a stream source (fs.walk, cov.items, ...). A source has a typed request but no typed item — the item type is a per-item element, not a whole response.
type TokenPrimary ¶
type TokenPrimary interface {
PrimaryExtension
TokenType() TokenType
}
TokenPrimary is the token-dispatch contract.