about summary refs log tree commit diff
path: root/boot/lex.c
diff options
context:
space:
mode:
authorMel <mel@rnrd.eu>2025-05-31 03:29:51 +0200
committerMel <mel@rnrd.eu>2025-05-31 03:29:51 +0200
commita422f9aead499a526179ba2df2aff1aa44fe48d6 (patch)
treef597bed2231e3ee05ce1d4f6c9901ed5b6a3882b /boot/lex.c
parent41e0e31b8586c1f93b5e65cd62ef910227a6677d (diff)
downloadcatskill-a422f9aead499a526179ba2df2aff1aa44fe48d6.tar.zst
catskill-a422f9aead499a526179ba2df2aff1aa44fe48d6.zip
Keyword-less variable declaration parsing
Signed-off-by: Mel <mel@rnrd.eu>
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
 {