Skip to content

Commit

Permalink
For WORD-WAD, store misspelled bit in %ERRORS slot
Browse files Browse the repository at this point in the history
  • Loading branch information
scymtym committed Jul 2, 2024
1 parent 2ba83dd commit 80ac320
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
10 changes: 5 additions & 5 deletions code/text.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
line-length))
((and (>= length min-length)
(notany #'digit-char-p text))
(let ((misspelledp (and checkp
(null (spell:english-lookup text)))))
(%basic-wad* 'word-wad line start-column line end-column
line-length
:misspelled misspelledp)))
(let ((wad (%basic-wad* 'word-wad line start-column line end-column
line-length)))
(when (and checkp (null (spell:english-lookup text)))
(setf (%errors wad) t))
wad))
(t
(%basic-wad* 'text-wad line start-column line end-column
line-length))))))
Expand Down
15 changes: 10 additions & 5 deletions code/wad.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@
;; are stored in the "closest surrounding" wad. S-expression syntax
;; errors are stored in the containing top-level wad. Error wads
;; are always relative. A single error is stored without the
;; surrounding list.
(%errors :type (or basic-wad list)
;; surrounding list. A value of `t' is used for misspelled words.
(%errors :type (or (eql t) basic-wad list)
:accessor %errors
:initform '())
;; This slot contains the absolute column that the first character
Expand Down Expand Up @@ -550,9 +550,14 @@
(defclass punctuation-wad (text-wad)
())

(defclass word-wad (text-wad) ; TODO should use errors slot for misspelled information
((%misspelled :initarg :misspelled
:reader misspelled)))
(defclass word-wad (text-wad)
())

(defmethod errors ((wad word-wad))
'())

(defmethod misspelled ((word-wad word-wad))
(not (null (%errors word-wad))))

;;; `error-wad'
;;;
Expand Down

0 comments on commit 80ac320

Please sign in to comment.