about summary refs log tree commit diff
path: root/boot/lex.c
diff options
context:
space:
mode:
Diffstat (limited to 'boot/lex.c')
-rw-r--r--boot/lex.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/boot/lex.c b/boot/lex.c
index c66d160..37eabcd 100644
--- a/boot/lex.c
+++ b/boot/lex.c
@@ -52,6 +52,20 @@ span_expand(struct Span span, integer by)
     };
 }
 
+// check if two spans are equal.
+bool
+span_equals(struct Span a, struct Span b)
+{
+    return a.start == b.start && a.end == b.end;
+}
+
+// check if span equals = { 0, 0 }.
+bool
+span_is_empty(struct Span span)
+{
+    return span_equals(span, (struct Span){ 0, 0 });
+}
+
 // a cursor position placed within a text file.
 struct Cursor
 {