Check for internal symbols
[wolf] / src / main / checker.lisp
index 2c42714d771c6a3affa1774944e333d70f7dbf22..dcbe9ec6fd1ad77b0dd8ea1001f48c8e4122c5f4 100644 (file)
@@ -5,13 +5,14 @@
 ; * No form longer than 50 lines
 ; - Top level multiline forms must be separated by exactly one space
 ; * No line longer than 120 characters
-; - No use of unexported symbols in other packages
+; * No use of unexported symbols in other packages
 ; * No tabs
 ; - Only one space between elements in a form on a single line
 ; * in-package must be first line in file unless file is package.lisp
 ; * No whitespace at end of line
 ; * No lines that are only whitespace
-; - No empty lines at end of file
+; * No empty lines at end of file
+; * Never have two empty lines in a row
 ; * Only one in-package per file
 ;
 ; Some thoughts
@@ -34,6 +35,7 @@
   '(:begin ; start of file
     :normal ; normal processing
     :beginning-of-line
+    :beginning-of-separators-with-space ; empty space in there
     :beginning-of-symbols
     :all ; matches everything
    )))
  (defevaluator :begin "\\(in-package[^\\)]*\\)"
   (lambda ()
    (set-state :normal) nil))
+ (defevaluator :beginning-of-separators-with-space :eof
+  (constantly "Must not end with empty line"))
+ (defevaluator :beginning-of-separators-with-space "\\n"
+  (constantly "Must not have two empty lines in a row"))
  (defevaluator :begin ".*"
   (constantly "Must begin with in-package form"))
  (defevaluator :normal "\\( *in-package "
   (lambda ()
    (set-state :beginning-of-symbols)
    nil))
+ (defevaluator :beginning-of-separators-with-space " *"
+  (lambda ()
+   (set-state :beginning-of-symbols)
+   nil))
  (defevaluator :beginning-of-symbols "\\n"
-  (lambda () (when (< 0 *col-no*) "No whitespace only lines")))
+  (lambda ()
+   (if
+    (< 0 *col-no*)
+    "No whitespace only lines"
+    (set-state :beginning-of-separators-with-space))))
  (defevaluator :beginning-of-symbols ""
   (lambda ()
    (set-state :normal)
     (cond
      ((not form) "Unmatched ending paren")
      ((< 50 (- *line-no* (car form))) "Forms can't be over 50 lines long")))))
-
-(cl-ppcre:scan (cl-ppcre:create-scanner " *") "
-asdf asdf")
+ (defevaluator :normal "::"
+  (constantly "No internal symbols from other packages"))
 
  (defevaluator :normal "." (constantly nil))
  )