mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-18 15:34:38 +01:00
- add block syntax parser/scanner with nested @blocks and elif/else support - restructure rule execution into explicit pre/post phases with phase flags - classify commands by phase and termination behavior - enforce flow semantics (default rule handling, dead-rule detection) - expand HTTP flow coverage with block + YAML parity tests and benches - refresh rules README/spec and update playground/docs integration
30 lines
488 B
Go
30 lines
488 B
Go
package rules
|
|
|
|
import "strings"
|
|
|
|
type PhaseFlag uint8
|
|
|
|
const (
|
|
PhaseNone PhaseFlag = 0
|
|
PhasePre PhaseFlag = 1 << (iota - 1)
|
|
PhasePost
|
|
)
|
|
|
|
func (phase PhaseFlag) IsPostRule() bool {
|
|
return phase&PhasePost != 0
|
|
}
|
|
|
|
func (phase PhaseFlag) String() string {
|
|
if phase == PhaseNone {
|
|
return "none"
|
|
}
|
|
var flags []string
|
|
if phase&PhasePre != 0 {
|
|
flags = append(flags, "PhasePre")
|
|
}
|
|
if phase&PhasePost != 0 {
|
|
flags = append(flags, "PhasePost")
|
|
}
|
|
return strings.Join(flags, ",")
|
|
}
|