lang

package
v0.0.0-...-83ab7ba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExprRefs

func ExprRefs(expr *Expr) []string

func ExprString

func ExprString(expr *Expr) string

Types

type ActivityDecl

type ActivityDecl struct {
	Name           string
	Require        []*Expr
	Input          []Binding
	Output         []FieldDecl
	Effect         string
	IdempotencyKey *Expr
	Policy         string
	Line           int
}

type Binding

type Binding struct {
	Name string
	Expr *Expr
	Line int
}

type ClaimDecl

type ClaimDecl struct {
	Name   string
	Always []*Expr
	Line   int
}

type ComputedDecl

type ComputedDecl struct {
	Name string
	Type string
	Expr *Expr
	Line int
}

type ContextDecl

type ContextDecl struct {
	Name   string
	Fields []FieldDecl
	Line   int
}

type DurationLiteral

type DurationLiteral string

type Expr

type Expr struct {
	Kind  ExprKind
	Op    string
	Name  string
	Value any
	Args  []*Expr
	Left  *Expr
	Right *Expr
}

func ParseExpr

func ParseExpr(src string) (*Expr, error)

type ExprKind

type ExprKind string
const (
	ExprLiteral ExprKind = "literal"
	ExprRef     ExprKind = "ref"
	ExprUnary   ExprKind = "unary"
	ExprBinary  ExprKind = "binary"
	ExprCall    ExprKind = "call"
)

type FactDecl

type FactDecl struct {
	Name   string
	When   []*Expr
	Expose []Binding
	Line   int
}

type FieldDecl

type FieldDecl struct {
	Name       string
	Type       string
	Default    *Expr
	HasDefault bool
	Line       int
}

type ImportDecl

type ImportDecl struct {
	Name  string
	Alias string
}

type Module

type Module struct {
	Domain     string
	Imports    []ImportDecl
	Signals    []SignalDecl
	Contexts   []ContextDecl
	Computeds  []ComputedDecl
	Facts      []FactDecl
	Policies   []PolicyDecl
	Activities []ActivityDecl
	Rules      []RuleDecl
	Claims     []ClaimDecl
	Queries    []QueryDecl
}

func Parse

func Parse(source []byte) (*Module, error)

type ParseError

type ParseError struct {
	Line int
	Msg  string
}

func (*ParseError) Error

func (e *ParseError) Error() string

type PolicyDecl

type PolicyDecl struct {
	Name    string
	Entries map[string]*Expr
	Catches map[string]string
	Line    int
}

type QueryDecl

type QueryDecl struct {
	Name   string
	Return []Binding
	Line   int
}

type RuleDecl

type RuleDecl struct {
	Name     string
	Triggers []Trigger
	When     []*Expr
	Require  []*Expr
	Run      string
	Writes   []Binding
	Line     int
}

type SignalDecl

type SignalDecl struct {
	Name   string
	Fields []FieldDecl
	Line   int
}

type Trigger

type Trigger struct {
	Kind   TriggerKind
	Name   string
	Target string
	Raw    string
}

type TriggerKind

type TriggerKind string
const (
	TriggerSignal  TriggerKind = "signal"
	TriggerChanged TriggerKind = "changed"
	TriggerTimer   TriggerKind = "timer"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL