Skip to content

Unicode RL1.1 support: Add \u{...} Hex Notation for Full Unicode Range - #149

Merged
pandaman64 merged 4 commits into
pandaman64:mainfrom
yuuki14202028:feature/136-unicode-escape
Dec 24, 2025
Merged

Unicode RL1.1 support: Add \u{...} Hex Notation for Full Unicode Range#149
pandaman64 merged 4 commits into
pandaman64:mainfrom
yuuki14202028:feature/136-unicode-escape

Conversation

@yuuki14202028

@yuuki14202028 yuuki14202028 commented Dec 23, 2025

Copy link
Copy Markdown
Contributor

This PR implements the \u{...} escape sequence to support the full Unicode range, addressing #136.

Changes

  • Updated Regex.Syntax.Parser to handle variable-length hex sequences enclosed in braces (e.g., \u{1F600}).
  • Added validation to ensure code points are within the valid Unicode range (0x0 to 0x10FFFF) and are not surrogate pairs.
  • Preserved existing support for fixed-width \uXXXX and \xXX escapes.
  • Added comprehensive test cases in regex/Regex/Syntax/Parser/Test.lean from Issue.

Note

Unicode escape support and validation

  • Add \u{...} parsing in escapedChar via hexEscape/unicodeEscape supporting 1–6 hex digits, falling back to \uHHHH; preserves \xHH and \uHHHH
  • Validate code points with isValidChar; introduce errors invalidCodePoint and tooManyHexDigits with messages in Error.lean
  • Extend tests to cover valid ranges (ASCII, BMP, supplementary planes), lowercase digits, variable lengths, and error cases (empty braces, too many digits, invalid hex, missing } , out-of-range and surrogate code points)

Written by Cursor Bugbot for commit b928866. This will update automatically on new commits. Configure here.

@pandaman64 pandaman64 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PRありがとうございます!全体的には良いのですが、細部についてコメントしたので取り入れてもらえると助かります。

Comment thread regex/Regex/Syntax/Parser/Basic.lean Outdated
Comment thread regex/Regex/Syntax/Parser/Basic.lean Outdated
Comment thread regex/Regex/Syntax/Parser/Basic.lean Outdated

@pandaman64 pandaman64 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMです。コントリビューションありがとうございます!

@pandaman64
pandaman64 enabled auto-merge (squash) December 24, 2025 13:39
@pandaman64
pandaman64 merged commit 3a940f5 into pandaman64:main Dec 24, 2025
3 checks passed
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