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

[Parser.pattern] Improvements #34

Open
floriancargoet opened this issue Dec 1, 2022 · 0 comments
Open

[Parser.pattern] Improvements #34

floriancargoet opened this issue Dec 1, 2022 · 0 comments

Comments

@floriancargoet
Copy link
Contributor

Two points that could be improved in Parser.pattern:

  1. For choices, patterns are always processed but for lines, patterns are only processed if the line has a tag. I don't see why this should be a requirement.
  2. RegExp patterns are only processed if one wraps a regexp in the RegExp function (without new)
    • Parser.pattern(/foo/, () => {}) will not be processed
    • Parser.pattern(new RegExp("foo"), () => {}) will not be processed
    • Parser.pattern(RegExp("foo"), () => {}) will be processed
    • Parser.pattern(RegExp(/foo/), () => {}) will be processed
    • I don't see a reason for this restriction. It's fixable by replacing pattern.matcher == RegExp(pattern.matcher) with `pattern.match instanceof RegExp, which will work for all 4 cases.
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

No branches or pull requests

1 participant