summaryrefslogtreecommitdiff
path: root/src/syntax/span.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/syntax/span.rs')
-rw-r--r--src/syntax/span.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/syntax/span.rs b/src/syntax/span.rs
index 47d96589..4d5b8819 100644
--- a/src/syntax/span.rs
+++ b/src/syntax/span.rs
@@ -88,6 +88,11 @@ impl Span {
Self { end, ..self }
}
+ /// Whether the span is a single point.
+ pub fn is_empty(self) -> bool {
+ self.start == self.end
+ }
+
/// The byte length of the spanned region.
pub fn len(self) -> usize {
self.end - self.start