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 HIR printer #458

Merged
merged 3 commits into from
Mar 14, 2018
Merged

add HIR printer #458

merged 3 commits into from
Mar 14, 2018

Conversation

BurntSushi
Copy link
Member

This PR adds a printer for HIR expressions. The motivation for this is to permit users to modify an HIR, and turn the results of that modification into a regex.

Also, small formatting fix and removal of debugging test.
Previously, we had some inconsistencies in how we were handling ASCII
word boundaries. In particular, the translator was accepting a negated
ASCII word boundary even if the caller didn't disable the UTF-8 invariant.
This is wrong, since a negated ASCII word boundary can match between any
two arbitrary bytes. However, fixing this is a breaking change, so for
now we document the bug. We plan to fix it with regex 1.0. See rust-lang#457.

Additionally, we were incorrectly declaring that an ASCII word boundary
matched invalid UTF-8 via the Hir::is_always_utf8 property. An ASCII word
boundary must always match an ASCII byte on one side, which implies a
valid UTF-8 position.
This adds a printer for the high-level intermediate representation. The
regex it prints is valid, and can be used as a way to turn it into a
regex::Regex.
@BurntSushi BurntSushi merged commit 97651fb into rust-lang:master Mar 14, 2018
@BurntSushi BurntSushi deleted the ag/hir-printer branch March 14, 2018 01:44
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.

None yet

1 participant