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
Token patterns with flags are broken #7
Comments
The aim of that commit was supporting custom tokenizers that do not depend on Java regex implementation. I'll take a look into options how regex flags can be returned to work with the default tokenizers. |
I understand that the goal of that change was not to break patterns, but if the Pattern/RegEx parameters are internally passed as Strings, there's not too much use for the overloaded Token constructors anymore, especially if they lose information in the process. I think in this case I personally would have preferred if the overloaded versions taking a Pattern or a RegEx would have been removed completely. |
Fixed in |
Thanks! Works great ;) |
Since 0e6eb41, Tokens defined by a Pattern or RegEx object are converted to a Token defined by a pattern String.
This breaks use-cases where the pattern object was created with flags set
(e.g.
token("^--".toRegex(RegexOption.MULTILINE))
)Currently, this can only be worked around by specifying the flags inside the pattern string
(e.g.
token("(?m)^--")
)The text was updated successfully, but these errors were encountered: