MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / Snippet

Method Snippet

common/source.cc:501–512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

499}
500
501absl::optional<std::string> Source::Snippet(int32_t line) const {
502 auto content = this->content();
503 auto start = FindLinePosition(line);
504 if (ABSL_PREDICT_FALSE(!start.has_value() || content.empty())) {
505 return absl::nullopt;
506 }
507 auto end = FindLinePosition(line + 1);
508 if (end.has_value()) {
509 return content.ToString(*start, *end - 1);
510 }
511 return content.ToString(*start);
512}
513
514std::string Source::DisplayErrorLocation(SourceLocation location) const {
515 constexpr char32_t kDot = '.';

Callers 1

source_test.ccFile · 0.80

Calls 4

contentMethod · 0.45
has_valueMethod · 0.45
emptyMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected