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

Better spec compliancy for rhemyn #198

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Rob23oba
Copy link

Reworks the rhemyn parser and extends it to additionally support the following:

Regular expressions Parsed object
^ { type: 'Begin' }
$ { type: 'End' }
\b, \B { type: 'WordBoundary', negated: boolean }
(?=...), (?!...) { type: 'LookAhead', body: [ ... ], negated: boolean }
(?<=...), (?<!...) { type: 'LookBehind', body: [ ... ], negated: boolean }
(?<name>...) { type: 'Group', body: [ ... ], capture: 'name' }
(?:...) { type: 'Group', body: [ ... ] }
(...) { type: 'Group', body: [ ... ], capture: true }
...|... { type: 'Disjunction', options: [ ..., ... ] }
\1, \2 etc. { type: 'Backreference', number: number }
\k<...> etc. { type: 'NamedBackreference', name: string }
...{min,max} { ..., quantifier: [ min, max ] }
\p{...}, \P{...} { type: 'CharacterClassEscape', classType: 'UnicodeProperty', property: string, value: string | null, negated: boolean }
\d, \s, \w { type: 'CharacterClassEscape', classType: 'Digit' | 'Whitespace' | 'WordCharacter', negated: boolean }
. { type: 'Dot' }

The last two changes have been done to move these options to the compiler and expose these class escapes to the user.

Additionally, there are now better error messages and unicode mode is supported. In fact, everything except for unicode sets mode should be supported now except for a few validation checks.

However: these features have not been implemented in the compiler! The compiler does not account for the new expressions and will throw errors, even for a few things that worked before! This is expected to change in the future.

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