Files
FESADev/include/fesa/core/source_identity.h
T

38 lines
1.1 KiB
C++

#ifndef FESA_CORE_SOURCE_IDENTITY_H_
#define FESA_CORE_SOURCE_IDENTITY_H_
#include <cstddef>
#include <cstdint>
#include <filesystem>
#include <string>
namespace fesa {
/// @brief Identifies a semantic entity by its stable collection position.
using EntityIndex = std::uint32_t;
/// @brief Identifies the input location that produced an item or diagnostic.
struct SourceLocation {
std::filesystem::path file;
std::size_t line;
};
/// @brief Preserves semantic and raw-text forms of a source entity identity.
struct SourceEntityId {
std::string instance_name;
std::int64_t source_label;
std::string source_label_text;
};
/// @brief Compares all preserved source fields without canonicalizing spelling.
inline bool SourceIdentityEquals(const SourceEntityId& left,
const SourceEntityId& right) noexcept {
return left.instance_name == right.instance_name &&
left.source_label == right.source_label &&
left.source_label_text == right.source_label_text;
}
} // namespace fesa
#endif // FESA_CORE_SOURCE_IDENTITY_H_