Documentation
¶
Overview ¶
Package parser turns writ policy source into the AST. The grammar is LL(1) at statement start (SPEC §4); this is a hand-written lexer and recursive-descent parser because the statement terminator is lexical state and the forbidden forms (a negated allow, a headless rule, an allow-only clause on a deny, `!` on a list atom) deserve pointed diagnostics rather than a generic expectation list.
A statement with errors is reported and dropped; parsing resumes at the next statement.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
func Parse(src string) (*ast.File, []diag.Diagnostic)
Parse parses policy source. The returned file holds every statement that parsed cleanly; statements with errors are dropped and reported.
func ParseDuration ¶
ParseDuration parses a writ duration — integer plus s/m/h parts, composable: 2m, 90s, 1h30m — returning whole seconds. Zero is rejected: the IL uses zero as its "no ttl set" sentinel, and a zero-lifetime certificate is never what an author meant.
func ValidateTimestamp ¶
ValidateTimestamp shape-checks an RFC 3339 timestamp with a mandatory offset. Seconds may be omitted (the spec writes "2026-08-31T22:00Z"). Calendar validity beyond cheap range checks is apply-time work.
Types ¶
This section is empty.