about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/scanner.rs
diff options
context:
space:
mode:
Diffstat (limited to 'users/tazjin/rlox/src/scanner.rs')
-rw-r--r--users/tazjin/rlox/src/scanner.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/users/tazjin/rlox/src/scanner.rs b/users/tazjin/rlox/src/scanner.rs
index 659f280de72b..edd85496a73e 100644
--- a/users/tazjin/rlox/src/scanner.rs
+++ b/users/tazjin/rlox/src/scanner.rs
@@ -133,3 +133,16 @@ impl<'a> Scanner<'a> {
         return self.tokens;
     }
 }
+
+pub fn scan<'a>(input: &'a [char]) -> Vec<Token<'a>> {
+    let scanner = Scanner {
+        source: &input,
+        tokens: vec![],
+        errors: vec![],
+        start: 0,
+        current: 0,
+        line: 0,
+    };
+
+    return scanner.scan_tokens();
+}