X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/blobdiff_plain/e43bd9558b80d9d92db3f39b5f77a2fa184fb467..40d95de71fca4c3b7b145d5ba73d1420e8854673:/src/lexer-impl.lisp diff --git a/src/lexer-impl.lisp b/src/lexer-impl.lisp index 48109b1..42370c0 100644 --- a/src/lexer-impl.lisp +++ b/src/lexer-impl.lisp @@ -39,15 +39,12 @@ (defmethod make-scanner-stream ((scanner sod-token-scanner)) ;;;-------------------------------------------------------------------------- ;;; Indicators and error messages. -(defun show-char (stream char &optional colonp atsignp) - "Format CHAR to STREAM in a readable way. - - Usable in `format''s ~/.../ command." - (declare (ignore colonp atsignp)) - (cond ((null char) (write-string "" stream)) +(defun show-char (char) + "Format CHAR as a string in a readable way." + (cond ((null char) "") ((and (graphic-char-p char) (char/= char #\space)) - (format stream "`~C'" char)) - (t (format stream "<~(~:C~)>" char)))) + (format nil "`~C'" char)) + (t (format nil "<~(~:C~)>" char)))) (defun skip-until (scanner token-types &key keep-end) "This is the implementation of the `skip-until' parser." @@ -149,13 +146,15 @@ (defmethod scanner-token ((scanner sod-token-scanner)) (#\' (case (length contents) (1 (char contents 0)) (0 (cerror*-with-location (start-floc) - "Lexical error: ~ - empty character literal") + 'simple-lexer-error + :format-control + "Empty character literal") #\?) (t (cerror*-with-location (start-floc) - "Lexical error: ~ - too many characters ~ - in literal") + 'simple-lexer-error + :format-control + "Too many characters ~ + in character literal") (char contents 0)))))) (values (etypecase it (character :char)