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

Add ASCII mode #34

Closed
SicroAtGit opened this issue Feb 25, 2023 · 0 comments
Closed

Add ASCII mode #34

SicroAtGit opened this issue Feb 25, 2023 · 0 comments
Assignees
Labels
feature New feature
Milestone

Comments

@SicroAtGit
Copy link
Owner

SicroAtGit commented Feb 25, 2023

This feature implements ASCII mode. When activated, the predefined character classes will only match the corresponding ASCII characters. For example, (?a)\w will then match only [a-zA-Z0-9_]. The character encoding remains UCS-2 in this mode, i.e. (?a)\W matches all UCS-2 characters, but not [a-zA-Z0-9_].

New Syntax

  • (?a) — activates ASCII mode.
  • (?-a) — deactivates ASCII mode (default).

New Parameter

  • AddNfa(..., "\w", #RegExMode_Ascii) is the same as AddNfa(..., "(?a)\w")

This mode is also useful in combination with #RegExMode_NoCase when you want to lex keywords in a code, case-insensitive, but no case-folding should be applied. Example:

  • (?i)set corresponds to [Ss\u017F][Ee][Tt]
  • (?ia)set corresponds to [Ss][Ee][Tt]
@SicroAtGit SicroAtGit added the feature New feature label Feb 25, 2023
@SicroAtGit SicroAtGit added this to the v1.0.0 milestone Feb 25, 2023
@SicroAtGit SicroAtGit self-assigned this Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

No branches or pull requests

1 participant