Documentation
¶
Index ¶
- Variables
- func LooksLikeFileTopArgs(source string) bool
- func LooksLikeLegacyAutomation(source string) bool
- func LooksLikeNonProcedural(source string) bool
- func LooksLikeStructAutomation(source string) bool
- func LooksLikeStructLogic(source string) bool
- func LooksLikeStructMutation(source string) bool
- func LooksLikeStructQuery(source string) bool
- func NormaliseAll(source string) (string, error)
- func NormaliseAutomationSource(source string) (string, error)
- func NormaliseFileTopArgs(source string) (string, error)
- func NormaliseLogicSource(source string) (string, error)
- func NormaliseMutationSource(source string) (string, error)
- func NormaliseQuerySource(source string) (string, error)
- func ParsePolicyDecl(source string) (*ast.PolicyDecl, error)
- func ParseProviderDecl(source string) (*ast.ProviderDecl, error)
- func ParseSeedDecl(source string) (*ast.SeedDecl, error)
- func ParseSpecDecl(source string) (*ast.SpecDecl, error)
- func ParseToolDecl(source string) (*ast.ToolDecl, error)
- func RejectLegacyProceduralAuthorForm(source string) error
- func StripNonProceduralBlocks(source string) string
- type AddDurationExpr
- type AndExpr
- type ArgRefExpr
- type ArgsField
- type ArgsSchema
- type AssignStmt
- type Attribute
- type AttributeMap
- type AutomationDef
- type BreakStmt
- type BuiltinDecl
- type BuiltinField
- type BuiltinFunctionExpr
- type CallerRefExpr
- type CanonicalIdExpr
- type CaseClause
- type CoalesceExpr
- type ComparisonExpr
- type ComparisonOperator
- type ConcatExpr
- type ConceptDecl
- type CondExpr
- type ConditionalFilterExpr
- type ContainsExpr
- type ContinueStmt
- type DayOfMonthExpr
- type DaysBetweenExpr
- type DepthExpr
- type DotAccessExpr
- type EqExpr
- type ErrorExpr
- type ErrorRefExpr
- type EventRefExpr
- type ExpressionNode
- type FieldRefExpr
- type FieldReference
- type File
- type FirstExpr
- type ForEachStepConfig
- type ForRangeStmt
- type FunctionArg
- type FunctionCallExpr
- type FunctionDef
- type FunctionReceiver
- type FunctionStepConfig
- type FunctionType
- type GtExpr
- type GteExpr
- type HashExpr
- type IfStmt
- type ImportDecl
- type IndexRefExpr
- type InputRefExpr
- type IsAnniversaryExpr
- type IsFirstDayOfQuarterExpr
- type ItemRefExpr
- type LastExpr
- type Lexer
- type LiteralExpr
- type LogicalExpr
- type LogicalOp
- type LowerExpr
- type LtExpr
- type LteExpr
- type MonthExpr
- type MutationKind
- type MutationStepConfig
- type MutationStmt
- type NilExpr
- type Node
- type NotExpr
- type OrExpr
- type PaginateExpr
- type ParallelStepConfig
- type ParseError
- type Parser
- type PolicyDecl
- type PromptDecl
- type PromptField
- type PropertyDecl
- type PropertyVariant
- type ProviderDecl
- type QuarterExpr
- type QueryStepConfig
- type QueryStmt
- type RateLimitConfig
- type ReceiverType
- type RelationshipDecl
- type RelationshipExpr
- type RelationshipFunction
- type RetryExpr
- type ReturnStmt
- type SIExpr
- type SeedBlock
- type SeedDecl
- type SeedValue
- type SeedValueKind
- type SelectExpr
- type ShapeDecl
- type ShapeExpr
- type SortDirection
- type SortExpr
- type SortField
- type SpecDecl
- type SpecReferenceExpr
- type StatementNode
- type StepDef
- type StepRefExpr
- type StepType
- type SubtractTimestampsExpr
- type SwitchCase
- type SwitchStepConfig
- type SwitchStmt
- type TernaryExpr
- type TimestampExpr
- type TimestampExprFunc
- type ToStringExpr
- type Token
- type TokenType
- type ToolDecl
- type ToolFieldDecl
- type TriggerDef
- type TrimExpr
- type TypeRef
- type UpperExpr
- type UseDeclaration
- type VarRefExpr
- type YearExpr
Constants ¶
This section is empty.
Variables ¶
var ( AttrAsync = ast.AttrAsync AttrAudit = ast.AttrAudit AttrCache = ast.AttrCache AttrDeprecated = ast.AttrDeprecated AttrDescription = ast.AttrDescription AttrDestructive = ast.AttrDestructive AttrDisabled = ast.AttrDisabled AttrEnabled = ast.AttrEnabled AttrExecutionTime = ast.AttrExecutionTime AttrExecutor = ast.AttrExecutor AttrFilter = ast.AttrFilter AttrHandler = ast.AttrHandler AttrIdempotent = ast.AttrIdempotent AttrInternal = ast.AttrInternal AttrPermission = ast.AttrPermission AttrPublic = ast.AttrPublic AttrRateLimit = ast.AttrRateLimit AttrRequiresConfirmation = ast.AttrRequiresConfirmation AttrRetry = ast.AttrRetry AttrRole = ast.AttrRole AttrSchedule = ast.AttrSchedule AttrUse = ast.AttrUse AttrUseSpec = ast.AttrUseSpec AttrUseTrait = ast.AttrUseTrait AttrUseQuery = ast.AttrUseQuery AttrUseMutation = ast.AttrUseMutation AttrUseAutomation = ast.AttrUseAutomation AttrUseLogic = ast.AttrUseLogic AttrUseTool = ast.AttrUseTool AttrUsePrompt = ast.AttrUsePrompt AttrUseProvider = ast.AttrUseProvider AttrUseBuiltin = ast.AttrUseBuiltin AttrTimeout = ast.AttrTimeout AttrTrigger = ast.AttrTrigger AttrVersion = ast.AttrVersion FunctionTypeAutomation = ast.FunctionTypeAutomation FunctionTypeBuiltin = ast.FunctionTypeBuiltin FunctionTypeLogic = ast.FunctionTypeLogic FunctionTypeMutation = ast.FunctionTypeMutation FunctionTypePolicy = ast.FunctionTypePolicy FunctionTypePrompt = ast.FunctionTypePrompt FunctionTypeProvider = ast.FunctionTypeProvider FunctionTypeQuery = ast.FunctionTypeQuery FunctionTypeShape = ast.FunctionTypeShape FunctionTypeSpec = ast.FunctionTypeSpec FunctionTypeTool = ast.FunctionTypeTool LogicalAnd = ast.LogicalAnd LogicalOr = ast.LogicalOr OpEq = ast.OpEq OpGe = ast.OpGe OpGt = ast.OpGt OpHas = ast.OpHas OpIn = ast.OpIn OpLe = ast.OpLe OpLt = ast.OpLt OpMissing = ast.OpMissing OpNe = ast.OpNe OpNotMissing = ast.OpNotMissing OpOut = ast.OpOut ReceiverAutomation = ast.ReceiverAutomation ReceiverBuiltin = ast.ReceiverBuiltin ReceiverLogic = ast.ReceiverLogic ReceiverMutation = ast.ReceiverMutation ReceiverPolicy = ast.ReceiverPolicy ReceiverPrompt = ast.ReceiverPrompt ReceiverProvider = ast.ReceiverProvider ReceiverQuery = ast.ReceiverQuery ReceiverShape = ast.ReceiverShape ReceiverSpec = ast.ReceiverSpec ReceiverTool = ast.ReceiverTool RelAliasOf = ast.RelAliasOf RelChildOf = ast.RelChildOf RelContains = ast.RelContains RelCreatedBy = ast.RelCreatedBy RelEquals = ast.RelEquals RelIds = ast.RelIds RelInteractsWith = ast.RelInteractsWith RelOwns = ast.RelOwns RelParentOf = ast.RelParentOf SortAsc = ast.SortAsc SortDesc = ast.SortDesc StepTypeAutomation = ast.StepTypeAutomation StepTypeForEach = ast.StepTypeForEach StepTypeFunction = ast.StepTypeFunction StepTypeMutation = ast.StepTypeMutation StepTypeParallel = ast.StepTypeParallel StepTypeQuery = ast.StepTypeQuery StepTypeSwitch = ast.StepTypeSwitch MutationKindInsert = ast.MutationKindInsert MutationKindUpdate = ast.MutationKindUpdate )
Enum / typed-string constants re-exported as vars (Go const aliases do not carry through simple `=` redeclaration; using var is idiomatic for this compatibility shim and the values are immutable in practice).
var ( ErrEmptyInput = errors.New("empty input") ErrInvalidSyntax = errors.New("invalid syntax") ErrUnexpectedToken = errors.New("unexpected token") ErrUnexpectedEOF = errors.New("unexpected end of input") ErrUnterminatedString = errors.New("unterminated string") ErrInvalidNumber = errors.New("invalid number") ErrInvalidOperator = errors.New("invalid operator") ErrMissingArgument = errors.New("missing argument") ErrInvalidArgument = errors.New("invalid argument") ErrDuplicateDefinition = errors.New("duplicate definition") )
Parsing errors
Functions ¶
func LooksLikeFileTopArgs ¶
LooksLikeFileTopArgs reports whether the source declares a file-level `args { ... }` block (outside any struct construct).
func LooksLikeLegacyAutomation ¶
LooksLikeLegacyAutomation reports whether the source declares the retired procedural `func (Automation) NAME(...)` form. Author files containing this form are rejected at parse time -- the struct form is canonical.
func LooksLikeNonProcedural ¶
LooksLikeNonProcedural reports whether the source contains any stripable non-procedural struct-form construct.
func LooksLikeStructAutomation ¶
LooksLikeStructAutomation reports whether the source declares a struct-form automation.
func LooksLikeStructLogic ¶
LooksLikeStructLogic reports whether the source declares a struct-form logic block.
func LooksLikeStructMutation ¶
LooksLikeStructMutation reports whether the source declares a struct-form mutation.
func LooksLikeStructQuery ¶
LooksLikeStructQuery reports whether the source declares a struct-form query.
func NormaliseAll ¶
NormaliseAll runs every struct-form rewriter in sequence: query, mutation, logic, automation, file-top args. Each stage is a no-op when the source doesn't match its detector. Errors from any stage are wrapped with the stage name and returned immediately.
func NormaliseAutomationSource ¶
NormaliseAutomationSource rewrites every `automation NAME { step <name> { ... } }` block to a procedural function whose body assigns each step's call to a named variable.
func NormaliseFileTopArgs ¶
NormaliseFileTopArgs is a no-op. It once translated `args.X` references to `ctx.X` inside the function body that followed each file-top `args { ... }` block; the engine parser learned `args.X` natively in F.3 of the ctx-envelope purge. The function stays in the NormaliseAll chain only to preserve the structural-detection callsite shape (LooksLikeFileTopArgs gates whether the chain runs) without churning callers.
func NormaliseLogicSource ¶
NormaliseLogicSource rewrites every `logic NAME { ... }` block to the procedural `func (Logic) NAME(_ any) (any, error) { ... }` form. The body keeps its own trailing `return <expr>`; the rewriter no longer appends `return ctx, nil`.
func NormaliseMutationSource ¶
NormaliseMutationSource rewrites every `mutation NAME { ... }` block to the procedural form.
func NormaliseQuerySource ¶
NormaliseQuerySource rewrites every `query NAME { ... }` block in the source to the procedural `func (Query) NAME(_ any) (any, error) { return <expr>, nil }` form.
func ParsePolicyDecl ¶
func ParsePolicyDecl(source string) (*ast.PolicyDecl, error)
ParsePolicyDecl tokenises a single `policy NAME { }` slice (with its leading attribute set) and returns the typed *ast.PolicyDecl. The caller -- typically the unified policy loader -- has already sliced one policy out of a multi-construct `.memql` file via ExtractKeywordSlices, so the input here is expected to contain exactly one policy declaration.
Returns an error when the slice's syntax is malformed or doesn't produce a policy node.
func ParseProviderDecl ¶
func ParseProviderDecl(source string) (*ast.ProviderDecl, error)
ParseProviderDecl tokenises a single `provider NAME { ... }` slice (with its leading attribute set) and returns the typed *ast.ProviderDecl. The caller -- typically the unified provider loader -- already sliced one provider out of a multi-construct `.memql` file via ExtractKeywordSlices, so the input here is expected to contain exactly one provider declaration.
Returns an error when the slice's syntax is malformed or doesn't produce a provider node.
func ParseSeedDecl ¶
ParseSeedDecl tokenises a single `seed NAME { ... }` slice (with its leading attribute set + any preserved file-top `use ...` preamble) and returns the typed *ast.SeedDecl. The caller -- typically the unified seed loader -- pre-pends the file-top preamble onto each slice so signature-bound concept names resolve against the same Form B imports the file declares once at the top.
Returns an error when the slice's syntax is malformed or doesn't produce a seed node. memql#335 (sub-epic #329 / Stage 1C of #310).
func ParseSpecDecl ¶
ParseSpecDecl tokenises a single `spec NAME { ... }` or `trait NAME { ... }` slice (with its leading attribute set) and returns the typed *ast.SpecDecl. The caller -- typically the unified spec loader -- already sliced one declaration out of a multi-construct `.memql` file via ExtractKeywordSlices, so the input here is expected to contain exactly one spec or trait.
Returns an error when the slice's syntax is malformed or doesn't produce a spec/trait node.
memql#334 (sub-epic #329 / #310 Stage 1C).
func ParseToolDecl ¶
ParseToolDecl tokenises a single `tool NAME { ... }` slice (with its leading attribute set) and returns the typed *ast.ToolDecl. The caller -- typically the unified tool loader -- has already sliced one tool out of a multi-construct `.memql` file via ExtractKeywordSlices, so the input here is expected to contain exactly one tool declaration.
Returns an error when the slice's syntax is malformed or doesn't produce a tool node.
func RejectLegacyProceduralAuthorForm ¶
RejectLegacyProceduralAuthorForm returns an error when the source contains author-written procedural form (`func (Receiver) name(ctx any) ...`) for any of the 12 retired receiver names. Called by the DSL load-time entry point (memql#303); see the comment on legacyProceduralAuthorForm for why this isn't wired into NormaliseAll directly.
func StripNonProceduralBlocks ¶
StripNonProceduralBlocks finds every struct-form construct declaration that's not procedural (`func (X) name`) and removes the block from the source, replacing it with a single-line comment of the form `// <stripped: kind name>`. The comment is placed at the original block header position so downstream error messages with line numbers still point at a reasonable location.
Preamble attribute lines (@-prefixed) immediately above the stripped block are also removed -- they're decorators on the stripped declaration. This avoids leaving orphan @-attributes hanging over the next surviving declaration.
Pass-through if the source contains none of the targeted constructs.
Types ¶
type AddDurationExpr ¶
type AddDurationExpr = ast.AddDurationExpr
Struct / named-type aliases for every AST type.
type AttributeMap ¶
type AttributeMap = ast.AttributeMap
Struct / named-type aliases for every AST type.
type AutomationDef ¶
type AutomationDef = ast.AutomationDef
Struct / named-type aliases for every AST type.
type BuiltinDecl ¶
type BuiltinDecl = ast.BuiltinDecl
Struct / named-type aliases for every AST type.
func ParseBuiltinDecl ¶
func ParseBuiltinDecl(source string) (*BuiltinDecl, error)
ParseBuiltinDecl tokenises the given source and parses it as a single struct-form builtin declaration. Convenience wrapper around ParseFile for the unified-kinds loader's LoadUnifiedBuiltins flow. Mirrors ParseShapeDecl on the error surface.
memql#318 (sub-epic #309 / #306 child C).
type BuiltinField ¶
type BuiltinField = ast.BuiltinField
Struct / named-type aliases for every AST type.
type BuiltinFunctionExpr ¶
type BuiltinFunctionExpr = ast.BuiltinFunctionExpr
Struct / named-type aliases for every AST type.
type CallerRefExpr ¶
type CallerRefExpr = ast.CallerRefExpr
Struct / named-type aliases for every AST type.
type CanonicalIdExpr ¶
type CanonicalIdExpr = ast.CanonicalIdExpr
Struct / named-type aliases for every AST type.
type CoalesceExpr ¶
type CoalesceExpr = ast.CoalesceExpr
Struct / named-type aliases for every AST type.
type ComparisonExpr ¶
type ComparisonExpr = ast.ComparisonExpr
Struct / named-type aliases for every AST type.
type ComparisonOperator ¶
type ComparisonOperator = ast.ComparisonOperator
Struct / named-type aliases for every AST type.
type ConceptDecl ¶
type ConceptDecl = ast.ConceptDecl
Struct / named-type aliases for every AST type.
type ConditionalFilterExpr ¶
type ConditionalFilterExpr = ast.ConditionalFilterExpr
Struct / named-type aliases for every AST type.
type ContainsExpr ¶
type ContainsExpr = ast.ContainsExpr
Struct / named-type aliases for every AST type.
type ContinueStmt ¶
type ContinueStmt = ast.ContinueStmt
Struct / named-type aliases for every AST type.
type DayOfMonthExpr ¶
type DayOfMonthExpr = ast.DayOfMonthExpr
Struct / named-type aliases for every AST type.
type DaysBetweenExpr ¶
type DaysBetweenExpr = ast.DaysBetweenExpr
Struct / named-type aliases for every AST type.
type DotAccessExpr ¶
type DotAccessExpr = ast.DotAccessExpr
Struct / named-type aliases for every AST type.
type ErrorRefExpr ¶
type ErrorRefExpr = ast.ErrorRefExpr
Struct / named-type aliases for every AST type.
type EventRefExpr ¶
type EventRefExpr = ast.EventRefExpr
Struct / named-type aliases for every AST type.
type ExpressionNode ¶
type ExpressionNode = ast.ExpressionNode
Interface aliases (require Go 1.24+; we are on 1.26.1).
func ParseExpression ¶
func ParseExpression(source string) (ExpressionNode, error)
ParseExpression parses a single MemQL expression from source text and returns the parsed AST node. Public entry point exposed for dedicated per-construct parsers (e.g. component/memql/spec_parser.go) that build their own grammar around the canonical expression parser without going through a synthetic function wrapper.
The source must contain exactly one expression. Trailing tokens after the expression (other than EOF / ; / a closing brace that the caller consumed prior to invocation) produce a parse error.
type FieldRefExpr ¶
type FieldRefExpr = ast.FieldRefExpr
Struct / named-type aliases for every AST type.
type FieldReference ¶
type FieldReference = ast.FieldReference
Struct / named-type aliases for every AST type.
type File ¶
Struct / named-type aliases for every AST type.
func ExtractImports ¶
ExtractImports tokenises the source and returns a *File carrying just the parsed `import (...)` block(s). Returns an empty File (no Imports, no Definitions) when the file has no imports. Returns an error only for lexer failures or malformed import blocks; everything outside the import block is silently tolerated.
func ParseFile ¶
ParseFile tokenises the given source and parses it as a full .memql file (use-declarations + one or more top-level definitions). It is the shared entry point that future Phase 2 consumers (concept loader, query parser, automation compiler) will call instead of maintaining their own lexer/parser pairs.
For single-expression parses (e.g. a raw query string evaluated via engine.Execute) keep using NewParser(tokens).Parse() -- that path returns an ExpressionNode when the input lacks a top-level definition.
type ForEachStepConfig ¶
type ForEachStepConfig = ast.ForEachStepConfig
Struct / named-type aliases for every AST type.
type ForRangeStmt ¶
type ForRangeStmt = ast.ForRangeStmt
Struct / named-type aliases for every AST type.
type FunctionArg ¶
type FunctionArg = ast.FunctionArg
Struct / named-type aliases for every AST type.
type FunctionCallExpr ¶
type FunctionCallExpr = ast.FunctionCallExpr
Struct / named-type aliases for every AST type.
type FunctionDef ¶
type FunctionDef = ast.FunctionDef
Struct / named-type aliases for every AST type.
type FunctionReceiver ¶
type FunctionReceiver = ast.FunctionReceiver
Struct / named-type aliases for every AST type.
type FunctionStepConfig ¶
type FunctionStepConfig = ast.FunctionStepConfig
Struct / named-type aliases for every AST type.
type FunctionType ¶
type FunctionType = ast.FunctionType
Struct / named-type aliases for every AST type.
type IndexRefExpr ¶
type IndexRefExpr = ast.IndexRefExpr
Struct / named-type aliases for every AST type.
type InputRefExpr ¶
type InputRefExpr = ast.InputRefExpr
Struct / named-type aliases for every AST type.
type IsAnniversaryExpr ¶
type IsAnniversaryExpr = ast.IsAnniversaryExpr
Struct / named-type aliases for every AST type.
type IsFirstDayOfQuarterExpr ¶
type IsFirstDayOfQuarterExpr = ast.IsFirstDayOfQuarterExpr
Struct / named-type aliases for every AST type.
type ItemRefExpr ¶
type ItemRefExpr = ast.ItemRefExpr
Struct / named-type aliases for every AST type.
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer converts a MemQL string into tokens.
func (*Lexer) Tokenize ¶
Tokenize converts the entire input into a slice of tokens. Each token's End* fields are stamped from the lexer's post-scan position so consumers can read the source span without re-implementing per-token length math. Specifically: `len(Literal)` doesn't match the source length for string tokens (quotes are stripped, escape sequences are decoded), so a span derived from `Column + len(Literal)` would be too short by at least 2 (the quotes) -- which surfaced as a trailing-cell color bleed in the cockpit's viewer (memql-cockpit#114).
type LiteralExpr ¶
type LiteralExpr = ast.LiteralExpr
Struct / named-type aliases for every AST type.
type LogicalExpr ¶
type LogicalExpr = ast.LogicalExpr
Struct / named-type aliases for every AST type.
type MutationKind ¶
type MutationKind = ast.MutationKind
Struct / named-type aliases for every AST type.
type MutationStepConfig ¶
type MutationStepConfig = ast.MutationStepConfig
Struct / named-type aliases for every AST type.
type MutationStmt ¶
type MutationStmt = ast.MutationStmt
Struct / named-type aliases for every AST type.
type PaginateExpr ¶
type PaginateExpr = ast.PaginateExpr
Struct / named-type aliases for every AST type.
type ParallelStepConfig ¶
type ParallelStepConfig = ast.ParallelStepConfig
Struct / named-type aliases for every AST type.
type ParseError ¶
ParseError represents a parsing error with position information.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
func (*ParseError) Unwrap ¶
func (e *ParseError) Unwrap() error
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser converts tokens into an AST.
type PromptDecl ¶
type PromptDecl = ast.PromptDecl
Struct / named-type aliases for every AST type.
func ParsePromptDecl ¶
func ParsePromptDecl(source string) (*PromptDecl, error)
ParsePromptDecl tokenises the given source and parses it as a single struct-form prompt declaration. Convenience wrapper around ParseFile for the unified-kinds loader's LoadUnifiedPrompts flow. Mirrors ParseBuiltinDecl on the error surface.
memql#319 (sub-epic #309 / #306 child C).
type PromptField ¶
type PromptField = ast.PromptField
Struct / named-type aliases for every AST type.
type PropertyDecl ¶
type PropertyDecl = ast.PropertyDecl
Struct / named-type aliases for every AST type.
type PropertyVariant ¶
type PropertyVariant = ast.PropertyVariant
Struct / named-type aliases for every AST type.
type ProviderDecl ¶
type ProviderDecl = ast.ProviderDecl
Struct / named-type aliases for every AST type.
type QuarterExpr ¶
type QuarterExpr = ast.QuarterExpr
Struct / named-type aliases for every AST type.
type QueryStepConfig ¶
type QueryStepConfig = ast.QueryStepConfig
Struct / named-type aliases for every AST type.
type RateLimitConfig ¶
type RateLimitConfig = ast.RateLimitConfig
Struct / named-type aliases for every AST type.
type ReceiverType ¶
type ReceiverType = ast.ReceiverType
Struct / named-type aliases for every AST type.
type RelationshipDecl ¶
type RelationshipDecl = ast.RelationshipDecl
Struct / named-type aliases for every AST type.
type RelationshipExpr ¶
type RelationshipExpr = ast.RelationshipExpr
Struct / named-type aliases for every AST type.
type RelationshipFunction ¶
type RelationshipFunction = ast.RelationshipFunction
Struct / named-type aliases for every AST type.
type SeedValueKind ¶
type SeedValueKind = ast.SeedValueKind
Struct / named-type aliases for every AST type.
type ShapeDecl ¶
Struct / named-type aliases for every AST type.
func ParseShapeDecl ¶
ParseShapeDecl tokenises the given source and parses it as a single struct-form shape declaration. Convenience wrapper around ParseFile for callers that handle one shape per slice (the unified-kinds loader's LoadUnifiedShapes flow). Returns an error when the source contains zero or more than one definition, or when the single definition isn't a shape.
memql#315 (sub-epic #309 / #306 child C).
type SortDirection ¶
type SortDirection = ast.SortDirection
Struct / named-type aliases for every AST type.
type SpecReferenceExpr ¶
type SpecReferenceExpr = ast.SpecReferenceExpr
Struct / named-type aliases for every AST type.
type StatementNode ¶
type StatementNode = ast.StatementNode
Interface aliases (require Go 1.24+; we are on 1.26.1).
type StepRefExpr ¶
type StepRefExpr = ast.StepRefExpr
Struct / named-type aliases for every AST type.
type SubtractTimestampsExpr ¶
type SubtractTimestampsExpr = ast.SubtractTimestampsExpr
Struct / named-type aliases for every AST type.
type SwitchStepConfig ¶
type SwitchStepConfig = ast.SwitchStepConfig
Struct / named-type aliases for every AST type.
type TernaryExpr ¶
type TernaryExpr = ast.TernaryExpr
Struct / named-type aliases for every AST type.
type TimestampExpr ¶
type TimestampExpr = ast.TimestampExpr
Struct / named-type aliases for every AST type.
type TimestampExprFunc ¶
type TimestampExprFunc = ast.TimestampExprFunc
Struct / named-type aliases for every AST type.
type ToStringExpr ¶
type ToStringExpr = ast.ToStringExpr
Struct / named-type aliases for every AST type.
type Token ¶
type Token struct {
Type TokenType
Literal string
Pos int
Line int
Column int
EndPos int
EndLine int
EndCol int
}
Token represents a lexical token.
Position fields are 1-indexed (Line, Column) plus a byte offset (Pos). EndLine / EndCol / EndPos point to the FIRST position after the token -- i.e. half-open [Column, EndCol). For single-character tokens, EndCol == Column + 1. For string tokens, the end positions span the closing quote AND the content (Literal strips quotes + decodes escapes, so its length no longer matches the source span -- the EndCol field is the authoritative source-length record).
Tokenize() populates the End* fields after each scan; the individual scan functions don't have to stamp them themselves.
type TokenType ¶
type TokenType int
TokenType enumerates lexical token categories.
const ( TokenEOF TokenType = iota TokenIdentifier TokenNumber TokenString TokenOperator TokenParenOpen TokenParenClose TokenBraceOpen TokenBraceClose TokenBracketOpen TokenBracketClose TokenColon TokenSemicolon TokenComma TokenDefine // := TokenQuestion // ? for ternary operator TokenQuestionDot // ?. for optional/conditional filters TokenQuestionQuestion // ?? for null coalescing TokenAt // @ for Python-style attributes/decorators TokenAmpAmp // && for logical AND TokenBang // ! for boolean negation TokenDot // . between path and `{` in `use path.{ names }` // Keywords - Type receivers (used in func receiver syntax) TokenKeywordQuery // Query TokenKeywordMutation // Mutation TokenKeywordAutomation // Automation TokenKeywordSpec // Spec TokenKeywordTool // Tool TokenKeywordBuiltin // Builtin // Keywords - Go-like control flow TokenKeywordFunc // func TokenKeywordFor // for TokenKeywordRange // range TokenKeywordIf // if TokenKeywordElse // else TokenKeywordSwitch // switch TokenKeywordCase // case TokenKeywordDefault // default TokenKeywordContinue // continue TokenKeywordBreak // break TokenKeywordReturn // return TokenKeywordNil // nil TokenKeywordRetry // retry TokenKeywordWhen // when (conditional step execution) TokenKeywordAs // as (forEach iteration variable, use alias) TokenKeywordWhere // where (forEach filter) TokenKeywordUse // use (concept import declaration) TokenKeywordImport // import (file-import block; new model) TokenKeywordConcept // concept (concept definition) TokenKeywordIn // in (membership operator) TokenKeywordHas // has (containment operator) TokenKeywordNot // not (negation, used in "not in") )
type ToolFieldDecl ¶
type ToolFieldDecl = ast.ToolFieldDecl
Struct / named-type aliases for every AST type.
type UseDeclaration ¶
type UseDeclaration = ast.UseDeclaration
Struct / named-type aliases for every AST type.