From e44bdc6a2a0cf624b08046ecc7e5c5d5d9d2d66c Mon Sep 17 00:00:00 2001 From: _ov4 Date: Fri, 16 Oct 2026 13:21:05 +0000 Subject: fix(compiler): correct CIE semantics and diagnostic locations Use standard WHILE headers and default-public class fields, resolve pseudocode identifiers without case sensitivity, and check signed i64 literal boundaries before conversion. Preserve source locations across recursive emission and function diagnostics. Add 22 regression cases and update compiler examples and documentation. Validated all 69 CTest entries with the original Linux Actions seed and verified the release package's embedded, native and IR output paths. --- include/cps/Identifier.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 include/cps/Identifier.h (limited to 'include/cps/Identifier.h') diff --git a/include/cps/Identifier.h b/include/cps/Identifier.h new file mode 100644 index 0000000..c35f636 --- /dev/null +++ b/include/cps/Identifier.h @@ -0,0 +1,27 @@ +#pragma once +#include +#include +#include +#include + +namespace cps { + +inline unsigned char foldIdentifier(unsigned char C) { + return C >= 'A' && C <= 'Z' ? C + ('a' - 'A') : C; +} + +struct IdentifierLess { + bool operator()(const std::string &A, const std::string &B) const { + return std::lexicographical_compare(A.begin(), A.end(), B.begin(), B.end(), + [](unsigned char L, unsigned char R) { return foldIdentifier(L) < foldIdentifier(R); }); + } +}; + +inline bool sameIdentifier(const std::string &A, const std::string &B) { + return !IdentifierLess{}(A, B) && !IdentifierLess{}(B, A); +} + +template using IdentifierMap = std::map; +using IdentifierSet = std::set; + +} // namespace cps -- cgit v1.3.1-4-g156e