summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2023-07-21 11:40:15 +0800
committerJSDurand <mmemmew@gmail.com>2023-07-21 11:40:15 +0800
commitf257f471f49bf13adf56868d8f8609309c7e100b (patch)
tree90886478989ffce993fadcb4d1cbfaceb87235ef
parentd31961c3ef5341413efb8681302ebd666dbcc4a5 (diff)
grammar/label: `set_end_option`
* grammar/src/label.rs (set_end_option): This function replaces the old function `open_end`, as this new function is more general than the old one, and there is no specific situation where we only need to open the end of a node without the need to close the node in an `if` statement.
-rw-r--r--grammar/src/label.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/grammar/src/label.rs b/grammar/src/label.rs
index e3f3422..fd626cd 100644
--- a/grammar/src/label.rs
+++ b/grammar/src/label.rs
@@ -143,10 +143,10 @@ impl GrammarLabel {
self.end = Some(end);
}
- /// Remove the ending boundary.
+ /// Set the end according to an option directly.
#[inline]
- pub fn open_end(&mut self) {
- self.end = None;
+ pub fn set_end_option(&mut self, end: Option<usize>) {
+ self.end = end;
}
/// Return a string description with the help of the associated