Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cage2
Copy link

@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
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