X-Git-Url: https://code.consxy.com/gitweb/gitweb.cgi?p=wolf;a=blobdiff_plain;f=src%2Fmain%2Fsyntax-checker.lisp;fp=src%2Fmain%2Fsyntax-checker.lisp;h=79cf0f53ca41a6bcb9e37fb2f57a0105bc1ab962;hp=1190818bd2bea72a1a1e4cf09e639a01f743ed95;hb=88cc07a6e633f2e8921f47f935bf2428154369d6;hpb=fb2b62902f65524fab0e86a3555b0071a0983e02 diff --git a/src/main/syntax-checker.lisp b/src/main/syntax-checker.lisp index 1190818..79cf0f5 100644 --- a/src/main/syntax-checker.lisp +++ b/src/main/syntax-checker.lisp @@ -87,6 +87,30 @@ (let ((seq (make-sequence sequence-type (file-length str)))) (read-sequence seq str) seq))) (defun check-file (file) + "CHECK-FILE FILE => RESULT + + RESULT: SUCCESS-RESULT | FAILURE-RESULT + SUCCESS-RESULT: (:success FILENAME) + FAILURE-RESULT: (:success FILENAME MSG LINE-NO COL-NO) + +ARGUMENTS AND VALUES + + FILE: a pathname + FILENAME: the file this check was run on + MSG: a string containing the failure message + LINE-NO: an integer, the line number on which the failure appeared + COL-NO: an integer, the column number on which the failure appeared + +DESCRIPTION: + + CHECK-FILE runs all the checks against a file and returns + as soon as the first style error is found. + +EXAMPLES: + + (check-file #P\"path/to/file.lisp\") => (:success \"path/to/file.lisp\") + (check-file #P\"path/to/error.lisp\") => (:failure \"path/to/error.lisp\" \"File cannot end with empty line\" 20 0)" + (if (string= "package" (pathname-name file)) (set-state :normal) (set-state :begin))