--- /dev/null
+(in-package #:nothing)
+
+(defun small-guy (a b) (+ a b))
+ ; great comment here
+(defun small-guy-2 (a b) (+ a b))
+
+; this is a function definition
+; comment about things
+; yo
+(defun hello-world (a b c) ; This comment is a test
+ (progn ; of things
+ (let ; ( and how
+ ((x y) ; comments can break
+ (z 9)) ; the evaluator and everything is ok
+ (with-open-file (str "increasinglylongfilenamesfailme.dat" :direction :input :if-does-not-exist :create)
+ (when ; because we don't care
+ (read-line str)
+ (format t "This file had some things in int, yay!~%"))))))
+; what kinds of comments
+; do to a file
+;
+
+; header comments
+(defun multiline-1 (a b c)
+ (+ a b))
+
+; header comments
+(defun multiline-1 (a b c)
+ (+ a b))
+
+; then a comment for
+; informational purpose
+
+(x y z)
+
+; Then a final comment in the file
--- /dev/null
+(in-package #:nothing)
+
+; comment resets line counter
+
+; this one does two
+
+; but we'll get an error soon!
+
+
+(defun hello-world (a b c)
+ (progn
+ (with-open-file (str "increasinglylongfilenamesfailme.dat" :direction :input :if-does-not-exist :create)
+ (when
+ (read-line str)
+ (format t "This file had some things in int, yay!~%")))))
; * No hanging close parens
;
; Exceptions
-; - comments
+; * comments
; - multiline strings
; Some thoughts
:beginning-of-line-with-separator ; empty space in there
:beginning-of-symbols
:beginning-of-symbols-with-separator
+ :comment-with-separator ; weird edge case for pre-function comments
+ :beginning-of-line-with-comment-and-separator ; weird edge case part 2
:first-symbol ; first symbol of form/line
:all ; matches everything
)))
; These are in reverse order
(progn
(setf *evaluators* nil)
+ (defevaluator :beginning-of-symbols " *;[^\\n]*"
+ (lambda () (set-state :normal)))
+ (defevaluator :beginning-of-symbols-with-separator " *;[^\\n]*"
+ (lambda () (set-state :comment-with-separator)))
+ (defevaluator :normal " *;[^\\n]*"
+ (lambda () (set-state :normal)))
(defevaluator :normal "\\("
(lambda ()
(push (list *line-no* *col-no*) *form-stack*)
(incf *line-no*)
(setf *col-no* -1)
(set-state :beginning-of-line)))
+ (defevaluator :comment-with-separator "\\n"
+ (lambda ()
+ (incf *line-no*)
+ (setf *col-no* -1)
+ (set-state :beginning-of-line-with-comment-and-separator)
+ nil))
(defevaluator :normal " +\\n" (constantly "No whitespace at end of line"))
(defevaluator :beginning-of-line " *" (lambda () (set-state :beginning-of-symbols)))
(defevaluator :beginning-of-line-with-separator " *" (lambda () (set-state :beginning-of-symbols-with-separator)))
+ (defevaluator :beginning-of-line-with-comment-and-separator "\\n"
+ (lambda ()
+ (progn
+ (incf *line-no*)
+ (setf *col-no* -1)
+ (set-state :beginning-of-line-with-separator))))
+ (defevaluator :beginning-of-line-with-comment-and-separator " *" (lambda () (set-state :beginning-of-symbols-with-separator)))
(defevaluator :beginning-of-symbols "\\n"
(lambda ()
(if