-- Copyright © 2026 Lingenic LLC. All rights reserved.
-- Licensed under the Lingenic Source-Available License v2.3.
-- Production use requires a separate license from Licensor.
-- See LICENSE.md and COPYRIGHT in the project root.
--
-------------------------------------------------------------------------------
-- Lingenic-Text
-- Formally Verified Unicode Text Processing Library
--
-- Unicode identifier properties (UAX #31).
--
-- Provides O(1) lookup for XID_Start and XID_Continue properties.
-- These properties define which codepoints can appear as the first
-- character or as continuation characters in Unicode identifiers.
--
-- The XID_Start and XID_Continue properties incorporate NFKC
-- modifications for identifier closure under all normalization forms.
-- The values are precomputed in DerivedCoreProperties.txt —
-- no runtime normalization is needed.
-------------------------------------------------------------------------------
with Lingenic_Text.Properties;
package Lingenic_Text.Identifiers
with SPARK_Mode
is
---------------------------------------------------------------------------
-- Is_Identifier_Start
--
-- Returns True if the codepoint has the XID_Start property.
-- These characters can appear as the first character of a Unicode
-- identifier (letters, letter numbers, plus a few specific characters).
---------------------------------------------------------------------------
function Is_Identifier_Start (CP : Codepoint) return Boolean
with Pre => Properties.Initialized,
Post => Is_Identifier_Start'Result = Properties.Get_XID_Start (CP);
---------------------------------------------------------------------------
-- Is_Identifier_Part
--
-- Returns True if the codepoint has the XID_Continue property.
-- These characters can appear as continuation characters in a Unicode
-- identifier (XID_Start plus digits, combining marks, connector
-- punctuation, etc.).
---------------------------------------------------------------------------
function Is_Identifier_Part (CP : Codepoint) return Boolean
with Pre => Properties.Initialized,
Post => Is_Identifier_Part'Result = Properties.Get_XID_Continue (CP);
end Lingenic_Text.Identifiers;