pgevolve_core/parse/builder/
mod.rs1pub mod aggregate_stmt;
8pub mod alter_table_attach_partition;
9pub mod alter_table_stmt;
10pub mod cast_stmt;
11pub mod choose_name;
12pub mod comment_stmt;
13pub mod create_collation_stmt;
14pub mod create_composite_type_stmt;
15pub mod create_domain_stmt;
16pub mod create_enum_stmt;
17pub mod create_extension_stmt;
18pub mod create_function_stmt;
19pub mod create_materialized_view_stmt;
20pub mod create_range_stmt;
21pub mod create_schema_stmt;
22pub mod create_seq_stmt;
23pub mod create_stmt;
24pub mod create_trigger_stmt;
25pub mod create_view_stmt;
26pub mod default_privileges;
27pub mod desugar_serial;
28pub mod event_trigger_stmt;
29pub mod grants;
30pub mod index_stmt;
31pub mod owner_stmt;
32pub mod plpgsql;
33pub mod policy_stmt;
34pub mod publication_stmt;
35pub mod reloptions;
36pub mod shared;
37pub mod statistic_stmt;
38pub mod subscription_stmt;
39pub mod table_like;
40pub mod text_search_stmt;
41
42use std::collections::HashMap;
43
44use crate::identifier::QualifiedName;
45use crate::ir::catalog::Catalog;
46use crate::parse::error::SourceLocation;
47
48#[derive(Debug, Default)]
51pub struct Builder {
52 pub catalog: Catalog,
54 pub locations: HashMap<String, SourceLocation>,
56}
57
58impl Builder {
59 pub fn new() -> Self {
61 Self::default()
62 }
63
64 pub fn record_location(
67 &mut self,
68 qname: &QualifiedName,
69 location: SourceLocation,
70 ) -> Option<SourceLocation> {
71 let key = qname.to_string();
72 if let Some(prior) = self.locations.get(&key) {
73 return Some(prior.clone());
74 }
75 self.locations.insert(key, location);
76 None
77 }
78}