diff options
author | mRnea <akannemre@gmail.com> | 2024-08-16 10:09:45 +0300 |
---|---|---|
committer | mRnea <akannemre@gmail.com> | 2024-08-16 10:09:45 +0300 |
commit | e90d1248920b50e5f8c25ab406a9095e3f6a2358 (patch) | |
tree | 298141c8cfabc515c37d2dd7996d8590b711698b /errors.lisp | |
parent | 68947d00aa6666d6e4daed6a0f75009c9bf3048d (diff) |
changed project name from cl-forth to kurt
Diffstat (limited to 'errors.lisp')
-rw-r--r-- | errors.lisp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/errors.lisp b/errors.lisp new file mode 100644 index 0000000..2f955ca --- /dev/null +++ b/errors.lisp @@ -0,0 +1,26 @@ +(in-package :kurt) + +(defun report-line (line-num line col? &optional (stream t)) + (format stream "~5a:~a~%" line-num line) + (iter (for i from 0 below (+ 6 (if (consp col?) + (getf (cdr col?) :col) ;; if token get col + col?))) + (write-char #\Space stream)) + (format stream "^~%")) + +(define-condition char-not-closed () + ((line :initarg :line :reader line) + (col :initarg :col :reader col) + (line-num :initarg :line-num :reader line-num)) + (:report (lambda (condition stream) + (format stream "Karakterin kapanış sembolü ' eksik.~%") + (report-line (line-num condition) (line condition) (col condition) stream)))) + +(defun handle-char-not-closed (line-num line token-or-col) + (make-condition 'char-not-closed :line-num line-num :line line :col token-or-col)) + +;; (define-condition op-not-implemented (style-warning) +;; ((undef-ops :initarg :ops :reader undef-ops)) +;; (:report (lambda (condition stream) +;; (format stream "These ops are not defined in op-case: ~s" +;; (undef-ops condition))))) |