| 112 | }; |
| 113 | |
| 114 | std::string DisplayParserError(const cel::Source& source, |
| 115 | const ParserError& error) { |
| 116 | auto location = |
| 117 | source.GetLocation(error.range.begin).value_or(SourceLocation{}); |
| 118 | return absl::StrCat(absl::StrFormat("ERROR: %s:%zu:%zu: %s", |
| 119 | source.description(), location.line, |
| 120 | // add one to the 0-based column |
| 121 | location.column + 1, error.message), |
| 122 | source.DisplayErrorLocation(location)); |
| 123 | } |
| 124 | |
| 125 | int32_t PositiveOrMax(int32_t value) { |
| 126 | return value >= 0 ? value : std::numeric_limits<int32_t>::max(); |
no test coverage detected