Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

feat: adds a `t_ws()` shorthand for `then_whitespace()` in the spirit of `t_aco()`

hippietrail6f5da14ca5c3
diff --git a/harper-core/src/patterns/sequence_pattern.rs b/harper-core/src/patterns/sequence_pattern.rs
index 9802147b4..c703bbf0c 100644
--- a/harper-core/src/patterns/sequence_pattern.rs
+++ b/harper-core/src/patterns/sequence_pattern.rs
@@ -150,6 +150,11 @@ impl SequencePattern {
self
}
+ /// Shorthand for [`Self::then_whitespace`].
+ pub fn t_ws(self) -> Self {
+ self.then_whitespace()
+ }
+
/// Match against one or more whitespace tokens.
pub fn then_whitespace(mut self) -> Self {
self.token_patterns.push(Box::new(WhitespacePattern));