NewParser creates a new Parser object with a set of functional options.
(opts ...ParserOption)
| 554 | |
| 555 | // NewParser creates a new Parser object with a set of functional options. |
| 556 | func NewParser(opts ...ParserOption) (*Parser, error) { |
| 557 | p := &Parser{TagVisitor: defaultTagVisitor{}} |
| 558 | var err error |
| 559 | for _, o := range opts { |
| 560 | p, err = o(p) |
| 561 | if err != nil { |
| 562 | return nil, err |
| 563 | } |
| 564 | } |
| 565 | return p, nil |
| 566 | } |
| 567 | |
| 568 | // Parse generates an internal parsed policy representation from a YAML input file. |
| 569 | // The internal representation ensures that CEL expressions are tracked relative to |
no outgoing calls