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

Function NewStringSource

common/source.go:84–92  ·  view source on GitHub ↗

NewStringSource creates a new Source from the given contents and description.

(contents string, description string)

Source from the content-addressed store, hash-verified

82
83// NewStringSource creates a new Source from the given contents and description.
84func NewStringSource(contents string, description string) Source {
85 // Compute line offsets up front as they are referred to frequently.
86 buf, offs := runes.NewBufferAndLineOffsets(contents)
87 return &sourceImpl{
88 Buffer: buf,
89 description: description,
90 lineOffsets: offs,
91 }
92}
93
94// NewStringSourceWithLimit creates a new Source from the given contents and
95// description while enforcing a maximum code point count when needed.

Callers 15

CreateASTMethod · 0.92
StringSourceFunction · 0.92
RelativeMethod · 0.92
TestPruneFunction · 0.92
TestCostFunction · 0.92
TestExprHelperCopyFunction · 0.92
TestSourceInfoFunction · 0.92
TestHasExtensionFunction · 0.92
conformanceTestFunction · 0.92
TestErrorsFunction · 0.85

Calls 1

NewBufferAndLineOffsetsFunction · 0.92

Tested by 13

TestPruneFunction · 0.74
TestCostFunction · 0.74
TestExprHelperCopyFunction · 0.74
TestSourceInfoFunction · 0.74
TestHasExtensionFunction · 0.74
conformanceTestFunction · 0.74
TestErrorsFunction · 0.68