Documentation
¶
Overview ¶
Package ast is the parsed form of a writ policy file, a direct port of the retired Rust spike's ast.rs (the porting reference named by SPEC §12.11). It preserves the shape the spec's IL depends on: allow rules carry plain expressions, deny rules carry negatable ones, so a negated allow is unrepresentable rather than validated away.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowRule ¶
AllowRule carries plain expressions: negation on the allow path is unrepresentable, mirroring the IL's MatchSet / NegatableMatchSet split.
type Any ¶
Any is `*` — matches everything; kept distinct from a glob per the spec (a surface `*` compiles to {"any": true}, never {"glob": "*"}).
type Expr ¶
Expr is a union of atoms. Singletons parse to a one-element list; Bracketed records whether the author wrote `[...]` (for the formatter, later).
type File ¶
type File struct {
Items []Item
}
File is a parsed policy file: a sequence of macro definitions and rules.
type Item ¶
type Item interface {
// contains filtered or unexported methods
}
Item is one statement: *MacroDef, *AllowRule, or *DenyRule.
type Kind ¶
type Kind int
Kind is one of the three matcher kinds. A macro declares one; every expression position implies one.
type Name ¶
type Name struct {
Value Value
}
Name is a bare or quoted account/host name; bare names may glob (`*`, `?`).
type NegExpr ¶
NegExpr is an expression plus a bit; `!` applies to the whole expression, never to an atom inside a list.
type Tag ¶
type Tag int
Tag is one of the six user-matcher prefixes.
type TagMatcher ¶
TagMatcher is `tag:value` — user position only.
func (*TagMatcher) Pos ¶
func (a *TagMatcher) Pos() diag.Pos