commit 95960e0a1c88238e4202f22518fc231ff8333318 (patch)
parent 4913379bc7c3cb7b84b8ae62c0415e35df4876f4
Author: Alex Karle <alex@alexkarle.com>
Date: Wed, 9 Nov 2022 00:43:29 -0500
docs: Fix some TODO's and comment indentation
Emacs likes to put single-; comments way to the right :(
Mostly back in Vim now, if anyone is curious.
Diffstat:
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/interpreter.scm b/interpreter.scm
@@ -21,16 +21,13 @@
(else (equal? a b))))
(define (assert-num op x)
- ;; TODO: use call/cc to not abort the process
(or (number? x) (runtime-err! (format "Operand must be a number ~A ~A" op x))))
(define (assert-nums op x y)
- ;; TODO: use call/cc to not abort the process
(or (and (number? x) (number? y))
(runtime-err! (format "Operands must be numbers ~A ~A ~A" x op y))))
(define (evaluate expr)
- ;; TODO: put these on the types themselves? like methods
(cond
((literal? expr) (literal-value expr))
((grouping? expr)
diff --git a/scanner.scm b/scanner.scm
@@ -42,15 +42,15 @@
(define (scan src)
(define (peek i)
- ; safe string-ref
+ ;; safe string-ref
(if (< i (string-length src))
(string-ref src i)
#f))
(define (get-tokens s i line in)
- ; Gets all tokens after 'start', tracks state in i (current char), line, in
+ ;; Gets all tokens after 'start', tracks state in i (current char), line, in
(define (tok-range type s2 i2)
- ; Helper to make a token, cons it to our list, and recurse with fresh state
+ ;; Helper to make a token, cons it to our list, and recurse with fresh state
(let ((text (substring src s2 (add1 i2))))
(let ((tok (cond
((eq? type 'STRING) (make-token type text (substring src (add1 s2) i2) line))
@@ -64,15 +64,15 @@
(cons tok (get-tokens (add1 i2) (add1 i2) line #f)))))
(define (tok type)
- ; helper to tokenize current span
+ ;; helper to tokenize current span
(tok-range type s i))
(define (skip . line2)
- ; Helper to skip this character range
+ ;; Helper to skip this character range
(get-tokens (add1 i) (add1 i) (optional line2 line) in))
(define (advance . line2)
- ; Helper to iterate; keeps start but increments range
+ ;; Helper to iterate; keeps start but increments range
(get-tokens s (add1 i) (optional line2 line) in))
(let ((c (peek i)) (n (peek (add1 i))))