MCPcopy Create free account
hub / github.com/cel-expr/cel-go / NewParser

Function NewParser

policy/parser.go:556–566  ·  view source on GitHub ↗

NewParser creates a new Parser object with a set of functional options.

(opts ...ParserOption)

Source from the content-addressed store, hash-verified

554
555// NewParser creates a new Parser object with a set of functional options.
556func 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

Callers 9

CreatePolicyParserMethod · 0.92
TestParseFunction · 0.70
TestParseErrorFunction · 0.70
TestCustomTagVisitorFunction · 0.70
TestSimpleVariablesFunction · 0.70
parseAndComposeRuleFunction · 0.70
parsePolicySourceFunction · 0.70
parsePolicyFunction · 0.70

Calls

no outgoing calls

Tested by 8

TestParseFunction · 0.56
TestParseErrorFunction · 0.56
TestCustomTagVisitorFunction · 0.56
TestSimpleVariablesFunction · 0.56
parseAndComposeRuleFunction · 0.56
parsePolicySourceFunction · 0.56
parsePolicyFunction · 0.56