Skip to content

Added support for '\x{...}#57

Open
cage2 wants to merge 1 commit intoedicl:masterfrom
cage2:add-extended-hex-escape
Open

Added support for '\x{...}#57
cage2 wants to merge 1 commit intoedicl:masterfrom
cage2:add-extended-hex-escape

Conversation

@cage2
Copy link
Copy Markdown

@cage2 cage2 commented Oct 31, 2024

added support for specify a character using unrestricted hexadecimal number representation, for example:

"\\x{1F4E3}" → #\📣

also spaces between braces is supported:

"\\x{   1F4E3   }" → #\📣

This patch is a just a bit more than a POC, as I never touched cl-ppcre code before; but seems to works and I think it is a good start. Of course review or critics, suggestions are welcome!

Bye!
C.

…l number representation, for example:

"\\x{1F4E3}" → #\📣
(number (get-number lexer :radix 16 :max-length 2 :no-whitespace-p t)))
;; note that it is OK if \x is followed by zero digits
(make-char-from-code number error-pos)))
(if (looking-at-p lexer #\{) ; parsing \x{####...}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

maybe would be a good idea to refactor out this code in a new function?

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.

1 participant