Skip to content

Complete JSON text support with core Unicode module (no literal-registered methods)#100

Merged
DanexCodr merged 13 commits into
mainfrom
copilot/add-full-json-library
Apr 13, 2026
Merged

Complete JSON text support with core Unicode module (no literal-registered methods)#100
DanexCodr merged 13 commits into
mainfrom
copilot/add-full-json-library

Conversation

Copilot AI commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

This PR completes the JSON library in Coderive and resolves the Unicode gap by moving Unicode escape logic into reusable stdlib code, not literal-registered runtime methods. It also aligns newly introduced API/labels with text terminology.

  • Problem addressed

    • JSON \uXXXX handling was incomplete/inconsistent and coupled to JSON internals.
    • Unicode behavior needed to be reusable across Coderive, not implemented as literal-registered methods.
  • JSON module: Unicode-correct parsing + serialization

    • Updated std/json/Json.cod to canonicalize and validate Unicode escapes in JSON text values.
    • Enforces surrogate-pair correctness (high must be followed by valid low; rejects invalid lone surrogates).
    • Preserves canonical escaped form (\uXXXX, including surrogate pairs) through parse/serialize flows.
  • New core Unicode standard library

    • Added std/unicode/Unicode.cod with reusable helpers:
      • normalizeEscaped(text) :: text
      • isValidEscaped(text) :: bool
      • hex/surrogate utility functions used by JSON
    • This makes Unicode escape handling a general Coderive capability rather than JSON-only behavior.
  • Removed runtime literal-method dependency

    • Removed newly added literal-registered Unicode methods from LiteralRegistry.
    • JSON and Unicode behavior now rely on Coderive stdlib code paths.
  • API/terminology alignment (text over string)

    • JSON API surface updated to text-first naming:
      • isText, asText, makeText, text(...)
      • serialize(...), serializePretty(...), serializeValue(...)
      • parseText(...), escapeText(...)
    • Updated JSON tests accordingly.
  • Test coverage additions/updates

    • Added test/unicode/UnicodeStandardLibraryComprehensive.cod.
    • Updated test/json/JsonStandardLibraryComprehensive.cod for text naming and Unicode canonicalization expectations.
use {json, unicode}

escaped := Unicode.normalizeEscaped("\\ud83d\\ude00")
ok := Unicode.isValidEscaped(escaped)

v := Json.parse("\"\\uD83D\\uDE00\"")
out(v.asText())            // \uD83D\uDE00
out(Json.serialize(v))     // "\uD83D\uDE00"

Copilot AI and others added 13 commits April 13, 2026 07:52
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/cb7897ea-b917-44e8-8556-89a3464a8ee6

Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/cb7897ea-b917-44e8-8556-89a3464a8ee6

Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/ced3ce89-2800-4b68-afa7-0f473380d065

Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/ced3ce89-2800-4b68-afa7-0f473380d065

Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/ced3ce89-2800-4b68-afa7-0f473380d065

Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
Agent-Logs-Url: https://github.com/DanexCodr/Coderive/sessions/ced3ce89-2800-4b68-afa7-0f473380d065

Co-authored-by: DanexCodr <216312766+DanexCodr@users.noreply.github.com>
@DanexCodr DanexCodr marked this pull request as ready for review April 13, 2026 09:34
@DanexCodr DanexCodr merged commit a2d37b7 into main Apr 13, 2026
@DanexCodr DanexCodr deleted the copilot/add-full-json-library branch April 13, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants