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 a onepass dfa matcher. #467

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ name = "backtrack-bytes"
path = "tests/test_crates_regex.rs"
name = "crates-regex"

# Run the test suite on the onepass engine.
[[test]]
path = "tests/test_onepass.rs"
name = "onepass"

[profile.release]
debug = true

Expand Down
5 changes: 5 additions & 0 deletions regex-syntax/src/hir/interval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,11 @@ impl<I: Interval> IntervalSet<I> {
}
true
}

/// Returns true iff this class is empty.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: if.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a typo. iff is parlance for "if and only if."

pub fn is_empty(&self) -> bool {
self.ranges.is_empty()
}
}

/// An iterator over intervals.
Expand Down
20 changes: 20 additions & 0 deletions regex-syntax/src/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,16 @@ impl ClassUnicode {
pub fn symmetric_difference(&mut self, other: &ClassUnicode) {
self.set.symmetric_difference(&other.set);
}

/// Returns true iff this character class contains no characters.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same typo.

///
/// This should never be true for a character class which was
/// constructed by the regex parser, but a notion of character
/// class emptiness can be useful for code that wants to
/// programmatically generate character classes.
pub fn is_empty(&self) -> bool {
self.set.is_empty()
}
}

/// An iterator over all ranges in a Unicode character class.
Expand Down Expand Up @@ -998,6 +1008,16 @@ impl ClassBytes {
pub fn is_all_ascii(&self) -> bool {
self.set.intervals().last().map_or(true, |r| r.end <= 0x7F)
}

/// Returns true iff this character class contains no characters.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same (probably copy-paste).

///
/// This should never be true for a character class which was
/// constructed by the regex parser, but a notion of character
/// class emptiness can be useful for code that wants to
/// programmatically generate character classes.
pub fn is_empty(&self) -> bool {
self.set.is_empty()
}
}

/// An iterator over all ranges in a byte character class.
Expand Down
Loading