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

Method ParseSource

cel/env.go:680–686  ·  view source on GitHub ↗

ParseSource parses the input source to an Ast and/or set of Issues. Parsing has failed if the returned Issues value and its Issues.Err() value is non-nil. Issues should be inspected if they are non-nil, but may not represent a fatal error. It is possible to have both non-nil Ast and Issues values

(src Source)

Source from the content-addressed store, hash-verified

678// It is possible to have both non-nil Ast and Issues values returned from this call; however,
679// the mere presence of an Ast does not imply that it is valid for use.
680func (e *Env) ParseSource(src Source) (*Ast, *Issues) {
681 parsed, errs := e.prsr.Parse(src)
682 if len(errs.GetErrors()) > 0 {
683 return nil, &Issues{errs: errs}
684 }
685 return &Ast{source: src, impl: parsed}, nil
686}
687
688// Program generates an evaluable instance of the Ast within the environment (Env).
689func (e *Env) Program(ast *Ast, opts ...ProgramOption) (Program, error) {

Callers 3

CompileSourceMethod · 0.95
ParseMethod · 0.95
conformanceTestFunction · 0.95

Calls 2

GetErrorsMethod · 0.80
ParseMethod · 0.65

Tested by 1

conformanceTestFunction · 0.76