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

Class SourceInfo

common/ast/metadata.h:156–276  ·  view source on GitHub ↗

Source information collected at parse time.

Source from the content-addressed store, hash-verified

154
155// Source information collected at parse time.
156class SourceInfo {
157 public:
158 SourceInfo() = default;
159 SourceInfo(std::string syntax_version, std::string location,
160 std::vector<int32_t> line_offsets,
161 absl::flat_hash_map<int64_t, int32_t> positions,
162 absl::flat_hash_map<int64_t, Expr> macro_calls,
163 std::vector<ExtensionSpec> extensions)
164 : syntax_version_(std::move(syntax_version)),
165 location_(std::move(location)),
166 line_offsets_(std::move(line_offsets)),
167 positions_(std::move(positions)),
168 macro_calls_(std::move(macro_calls)),
169 extensions_(std::move(extensions)) {}
170
171 SourceInfo(const SourceInfo& other) = default;
172 SourceInfo(SourceInfo&& other) = default;
173 SourceInfo& operator=(const SourceInfo& other) = default;
174 SourceInfo& operator=(SourceInfo&& other) = default;
175
176 void set_syntax_version(std::string syntax_version) {
177 syntax_version_ = std::move(syntax_version);
178 }
179
180 void set_location(std::string location) { location_ = std::move(location); }
181
182 void set_line_offsets(std::vector<int32_t> line_offsets) {
183 line_offsets_ = std::move(line_offsets);
184 }
185
186 void set_positions(absl::flat_hash_map<int64_t, int32_t> positions) {
187 positions_ = std::move(positions);
188 }
189
190 void set_macro_calls(absl::flat_hash_map<int64_t, Expr> macro_calls) {
191 macro_calls_ = std::move(macro_calls);
192 }
193
194 const std::string& syntax_version() const { return syntax_version_; }
195
196 const std::string& location() const { return location_; }
197
198 const std::vector<int32_t>& line_offsets() const { return line_offsets_; }
199
200 std::vector<int32_t>& mutable_line_offsets() { return line_offsets_; }
201
202 const absl::flat_hash_map<int64_t, int32_t>& positions() const {
203 return positions_;
204 }
205
206 absl::flat_hash_map<int64_t, int32_t>& mutable_positions() {
207 return positions_;
208 }
209
210 const absl::flat_hash_map<int64_t, Expr>& macro_calls() const {
211 return macro_calls_;
212 }
213

Callers 2

TEST_FFunction · 0.85

Calls

no outgoing calls

Tested by 1

TEST_FFunction · 0.68