Compare commits

..

3 commits

3 changed files with 8 additions and 6 deletions

View file

@ -8,7 +8,9 @@
:finally (return start)))) :finally (return start))))
(subseq string (subseq string
start start
(position #\Newline string :start (1+ start))))) (if (< start (length string))
(position #\Newline string :start (1+ start))
nil))))
(defun point-out-source (source) (defun point-out-source (source)
(if (null source) (if (null source)

View file

@ -11,4 +11,4 @@
(:export #:usc-init #:compile-string-to-bytes (:export #:usc-init #:compile-string-to-bytes
;; Errors ;; Errors
#:usc-error #:tokenizer-error #:missing-function-error #:usc-error #:tokenizer-error #:missing-function-error
#:parser-error)) #:parser-error #:source))

View file

@ -164,13 +164,13 @@ reading immediately. Should be a subset of *SPECIAL-TOKEN-CHARS*.")
(next-token)) (next-token))
;; Process and add a newline ;; Process and add a newline
((char= char #\Newline) ((char= char #\Newline)
(setf in-comment-p nil
line (1+ line)
column 0)
(unless (zerop (length token-text-buffer)) (unless (zerop (length token-text-buffer))
(next-token)) (next-token))
(vector-push #\Newline token-text-buffer) (vector-push #\Newline token-text-buffer)
(next-token)) (next-token)
(setf in-comment-p nil
line (1+ line)
column 0))
;; Starting a comment ;; Starting a comment
((and (member char *line-comment-chars* :test #'char=) (not in-comment-p)) ((and (member char *line-comment-chars* :test #'char=) (not in-comment-p))
(unless (zerop (length token-text-buffer)) (unless (zerop (length token-text-buffer))