From 02e970926c489005f408d69d363d017fb0abfe53 Mon Sep 17 00:00:00 2001 From: Frank Duncan Date: Sun, 12 Jul 2015 13:45:26 -0500 Subject: [PATCH] Add exception for strings --- resources/good.lisp | 13 ++++++++++--- src/main/checker.lisp | 12 +++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) 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 "" -- 2.25.1