EAST ASIAN WIDTH AND IDENTIFIERS MODULES
=========================================


EAST ASIAN WIDTH (UAX #11)
--------------------------

Standard: UAX #11 (East Asian Width)
Files:    src/lingenic_text-eaw_spec.ads   (ghost specification)
          src/lingenic_text-eaw.ads        (public API)
          src/lingenic_text-eaw.adb        (implementation)

Purpose:

  Provides O(1) display width lookup for any codepoint in fixed-pitch
  terminal or grid-based rendering.

Ghost Specification (EAW_Spec):

  type EAW_Value is
    (Neutral, Ambiguous, Halfwidth, Wide, Fullwidth, Narrow);

  function Cell_Width(V : EAW_Value) return Natural
    Wide or Fullwidth -> 2
    All others        -> 1

Public API:

  function Display_Width(CP : Codepoint) return Natural;

    Pre:  Properties.Initialized

    Post: Result = EAW_Spec.Cell_Width(
            Properties.EAW_To_Abstract(Properties.Get_EAW(CP)))

  The postcondition is exhaustive: the return value IS the Cell_Width
  of the codepoint's East_Asian_Width property, as defined by the ghost
  specification.

  Wide (W) and Fullwidth (F) characters return 2.
  All others (Neutral, Ambiguous, Halfwidth, Narrow) return 1.

  Note: The Ambiguous width category (used for characters that have
  different widths in East Asian and non-East Asian contexts) is
  treated as width 1 here.  Applications that need East Asian context-
  dependent width should check the EAW property directly via
  Properties.Get_EAW and Properties.EAW_To_Abstract.

Dependencies:

  Requires Properties.Initialized.  No Initialize of its own -- uses
  Properties.Get_EAW directly.


IDENTIFIERS (UAX #31)
---------------------

Standard: UAX #31 (Unicode Identifier and Pattern Syntax)
Files:    src/lingenic_text-identifiers.ads   (public API)
          src/lingenic_text-identifiers.adb   (implementation)

Purpose:

  Provides O(1) lookup for Unicode identifier properties.  These
  properties define which codepoints can appear in Unicode identifiers
  (variable names, function names, etc.) across all programming
  languages and protocols that follow UAX #31.

Public API:

  function Is_Identifier_Start(CP : Codepoint) return Boolean;

    Pre:  Properties.Initialized
    Post: Result = Properties.Get_XID_Start(CP)

    Returns True if CP 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_Part(CP : Codepoint) return Boolean;

    Pre:  Properties.Initialized
    Post: Result = Properties.Get_XID_Continue(CP)

    Returns True if CP has the XID_Continue property.
    These characters can appear as continuation characters: XID_Start
    plus digits, combining marks, connector punctuation, etc.

Properties Background:

  XID_Start and XID_Continue are the "NFKC-closed" versions of
  ID_Start and ID_Continue.  They incorporate closure under all
  normalization forms, ensuring that an identifier remains valid
  after normalization.

  The values are precomputed in DerivedCoreProperties.txt -- no
  runtime normalization is needed for these lookups.

  XID_Start includes:
    - Letters (Lu, Ll, Lt, Lm, Lo)
    - Letter numbers (Nl)
    - Specific characters (U+1885, U+1886, U+2118, U+212E, U+309B, U+309C)
    - Stability-guaranteed additions

  XID_Continue adds:
    - Digits (Nd)
    - Nonspacing marks (Mn)
    - Spacing combining marks (Mc)
    - Connector punctuation (Pc)
    - Specific additional characters

Dependencies:

  Requires Properties.Initialized.  No Initialize of its own -- uses
  Properties.Get_XID_Start and Properties.Get_XID_Continue directly.

Usage:

  --  Check if a codepoint can start an identifier
  if Identifiers.Is_Identifier_Start (CP) then
     --  Valid identifier start
  end if;

  --  Check if a codepoint can continue an identifier
  if Identifiers.Is_Identifier_Part (CP) then
     --  Valid identifier continuation
  end if;
