Documentation
¶
Overview ¶
Package masking compiles semantic checker types into provider-neutral constraints for token and logit masking.
Index ¶
Constants ¶
const FormatV1 = "howlframe.mask_plan/v1"
FormatV1 identifies the serialized mask plan schema.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BridgePlan ¶
BridgePlan identifies one schema-bound output source and the exact struct constraint a downstream constrained decoder must enforce.
type DelimiterPlan ¶
type DelimiterPlan struct {
Open string `json:"open"`
Close string `json:"close"`
ItemSeparator string `json:"item_separator"`
KeyValueSeparator string `json:"key_value_separator,omitempty"`
}
DelimiterPlan describes the structural tokens surrounding a collection or object value.
type FieldPlan ¶
type FieldPlan struct {
Name string `json:"name"`
Required bool `json:"required"`
Constraint TypePlan `json:"constraint"`
}
FieldPlan constrains one required field in a struct value.
type FunctionPlan ¶
type FunctionPlan struct {
Name string `json:"name"`
Params []ParamPlan `json:"params"`
Return TypePlan `json:"return"`
}
FunctionPlan describes the input and output constraints for a checked function signature.
type NamedTypePlan ¶
NamedTypePlan associates a checker struct name with its constraint.
type ProgramPlan ¶
type ProgramPlan struct {
Format string `json:"format"`
Structs []NamedTypePlan `json:"structs"`
Functions []FunctionPlan `json:"functions"`
Bridges []BridgePlan `json:"bridges"`
}
ProgramPlan contains all named struct and function constraints collected by the semantic checker.
func CompileAnalysis ¶
func CompileAnalysis(analysis *checker.Analysis) ProgramPlan
CompileAnalysis compiles checker structs and function signatures into a deterministic program-level mask plan. A nil analysis produces an empty plan.
type TypePlan ¶
type TypePlan struct {
Kind ast.ValueKind `json:"kind"`
Name string `json:"name,omitempty"`
TokenClasses []string `json:"token_classes"`
Literals []string `json:"literals,omitempty"`
Encoding string `json:"encoding,omitempty"`
Delimiters *DelimiterPlan `json:"delimiters,omitempty"`
Key *TypePlan `json:"key,omitempty"`
Element *TypePlan `json:"element,omitempty"`
Fields []FieldPlan `json:"fields,omitempty"`
}
TypePlan describes the JSON-compatible token classes and structure accepted for one semantic HowlFrame type. Token classes are symbolic so a downstream decoder can map them to provider-specific token IDs.
func CompileType ¶
CompileType compiles one semantic type into a provider-neutral mask plan.