-
Notifications
You must be signed in to change notification settings - Fork 38
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
Using a regex parsed bytes value in &requires #1846
Comments
My initial take would be that this is a similar issue as #1842 (some parsing parsing state is available inside the hook, but not yet inside the field's attributes). However, it surprises me that it works with the literal, as that wouldn't make a difference then. Needs more investigation. |
So turns out two things coming together: the main one is a bug with how we extract the data for capture groups. The second is that after regexp matching we aren't immediately trimming the data, whereas for bytes we do. The latter explains the difference for the two cases: the bug only manifests if the data isn't at the beginning of the stream. |
* origin/topic/robin/gh-1846-regex-in-attr: Fix bug with captures groups. Add missing trim after matching a regular expression.
When extracting the data matching capture groups we'd take it from the beginning of the stream, not the beginning of the current view, even though the latter is what we are matching against. Closes #1846. (cherry picked from commit 5f14c36) # Conflicts: # spicy/toolchain/src/compiler/codegen/parsers/literals.cc
When extracting the data matching capture groups we'd take it from the beginning of the stream, not the beginning of the current view, even though the latter is what we are matching against. Closes #1846. (cherry picked from commit 5f14c36) # Conflicts: # spicy/toolchain/src/compiler/codegen/parsers/literals.cc
I'm not sure if the title accurately represents what is going on here or not, but I have some examples of what works and what doesn't...
Using a regex parsed unit value to compare against regex group bytes in a &requires doesn't work...
But if the value we parse is parsed with a literal, that works fine...
If we do the comparison in a field hook, it also works fine (it just seems to be broken in the &requires comparison)...
The text was updated successfully, but these errors were encountered: