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

Method GetPosition

common/source.cc:489–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487}
488
489absl::optional<SourcePosition> Source::GetPosition(
490 const SourceLocation& location) const {
491 if (ABSL_PREDICT_FALSE(location.line < 1 || location.column < 0)) {
492 return absl::nullopt;
493 }
494 if (auto position = FindLinePosition(location.line);
495 ABSL_PREDICT_TRUE(position.has_value())) {
496 return *position + location.column;
497 }
498 return absl::nullopt;
499}
500
501absl::optional<std::string> Source::Snippet(int32_t line) const {
502 auto content = this->content();

Callers 3

syntaxErrorMethod · 0.80
TESTFunction · 0.80
source_test.ccFile · 0.80

Calls 1

has_valueMethod · 0.45

Tested by 1

TESTFunction · 0.64