Skip to main content

codehelion_core/
semantic.rs

1//! Restricted Semantic Operation Graphs.
2//!
3//! This is deliberately a closed vocabulary. The graph is a target for
4//! compiler-independent normalization, not a generic program representation:
5//! code that cannot be expressed by one of these operations is left outside
6//! semantic matching. That restriction keeps later findings explainable as a
7//! sequence of registered transformations instead of turning this mode into a
8//! claim of general semantic equivalence.
9
10use std::collections::{BTreeMap, BTreeSet};
11
12use serde::{Deserialize, Serialize};
13use thiserror::Error;
14
15use crate::clone_class::CloneClass;
16use crate::discovery::Language;
17use crate::grouping::{self, GroupingConfig, GroupingUnit, SimilarityEdge};
18use crate::types::TypeTag;
19use crate::verify::Confidence;
20
21mod candidates;
22mod cross_language;
23mod graph;
24mod normalization;
25mod rules;
26
27use cross_language::{
28    CROSS_LANGUAGE_OPTIONAL_VALIDATION_RULE, CROSS_LANGUAGE_RESULT_DIRECT_PROPAGATION_RULE,
29    CROSS_LANGUAGE_RESULT_VALIDATION_RULE, CROSS_LANGUAGE_SEQUENCE_PIPELINE_RULE,
30};
31use rules::{
32    OPTIONAL_VALIDATION_RULE, RESULT_VALIDATION_RULE, compatible_fallible_kinds,
33    compatible_type_tags, direct_construct_matches, match_same_variant_rule, only_api_name,
34};
35
36#[cfg(test)]
37use cross_language::DIRECT_LOOP_SEQUENCE_CORRESPONDENCE_ID;
38
39pub use candidates::*;
40pub use cross_language::*;
41pub use graph::*;
42pub use normalization::*;
43pub use rules::*;
44
45#[cfg(test)]
46#[allow(clippy::expect_used)]
47mod tests;