summaryrefslogtreecommitdiff
path: root/src/scanner.rs
diff options
context:
space:
mode:
authorBotahamec <botahamec@outlook.com>2023-07-29 21:42:55 -0400
committerBotahamec <botahamec@outlook.com>2023-07-29 21:42:55 -0400
commitc6c033c1eff1cbcb97a6d94b9002436d97effdd6 (patch)
treea648e4a4819a201ddbc20e30a498ae5261d4624a /src/scanner.rs
parent5edaa60802378609d45b0c4c1d6b35f9f78db290 (diff)
advance_if_starts_with
Diffstat (limited to 'src/scanner.rs')
-rw-r--r--src/scanner.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/scanner.rs b/src/scanner.rs
index ee7d50b..6b31717 100644
--- a/src/scanner.rs
+++ b/src/scanner.rs
@@ -54,4 +54,9 @@ impl Scanner {
Some(i)
}
+
+ pub fn advance_if_starts_with(&mut self, substring: impl AsRef<str>) -> Option<String> {
+ let position = self.starts_with(substring)?;
+ self.goto(position)
+ }
}