From: Frank Duncan Date: Sun, 12 Jul 2015 18:45:26 +0000 (-0500) Subject: Add exception for strings X-Git-Tag: 0.1~3 X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?p=wolf;a=commitdiff_plain;h=02e9709;hp=c9508457e34796fd7fcd8029ecd3209582f4c945 Add exception for strings --- diff --git a/resources/good.lisp b/resources/good.lisp index adb5e37..10a6091 100644 --- a/resources/good.lisp +++ b/resources/good.lisp @@ -3,12 +3,19 @@ (defun small-guy (a b) (+ a b)) (defun small-guy-2 (a b) (+ a b)) +; This comment is awesome (defun hello-world (a b c) (progn (let - ((x y) - (z 9)) + ((x y) ; Ok, this comment is also great + (z 9)) ; so is this one! (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!~%"))))) + (format t "This file had some things in int, yay!~%")))))) + +(defvar *x* "hello world + this is a multiline string + with \" some escaped things + and some (_) and whatnot + ") diff --git a/src/main/checker.lisp b/src/main/checker.lisp index 0e3dd7a..3a78d88 100644 --- a/src/main/checker.lisp +++ b/src/main/checker.lisp @@ -19,7 +19,7 @@ ; ; Exceptions ; * comments -; - multiline strings +; * multiline strings ; Some thoughts ; - form starting reader macros will have to be hand added to this code @@ -49,6 +49,7 @@ :beginning-of-line-with-comment-and-separator ; weird edge case part 2 :first-symbol ; first symbol of form/line :all ; matches everything + :in-string ))) (defun set-state (state) @@ -195,6 +196,15 @@ ((< 50 (- *line-no* (car form))) "Forms can't be over 50 lines long") (t (setf *form-ended-on-same-line* (= *line-no* (car form))) nil))))) (defevaluator :normal "::" (constantly "No internal symbols from other packages")) + (defevaluator :in-string "\\\\\"" (constantly nil)) + (defevaluator :normal "\"" (lambda () (set-state :in-string))) + (defevaluator :in-string "\"" (lambda () (set-state :normal))) + (defevaluator :in-string "\\n" + (lambda () + (incf *line-no*) + (setf *col-no* -1) + nil)) + (defevaluator :in-string "." (constantly nil)) (defevaluator :first-symbol "\\n" (constantly "No new line after opening form")) (defevaluator :first-symbol " " (constantly "No space after opening parens")) (defevaluator :first-symbol ""