From 7524b4b2da30055e98de7f86507bec081b419f83 Mon Sep 17 00:00:00 2001 Message-Id: <7524b4b2da30055e98de7f86507bec081b419f83.1716619152.git.mdw@distorted.org.uk> From: Mark Wooding Date: Thu, 26 May 2016 09:26:09 +0100 Subject: [PATCH] src/lexer-proto.lisp (lexer-error): Improve error reporting. Organization: Straylight/Edgeware From: Mark Wooding Now EXPECTED can be `nil' to produce a simple `unexpected THING' message. --- src/lexer-proto.lisp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lexer-proto.lisp b/src/lexer-proto.lisp index 349e2a0..8f19401 100644 --- a/src/lexer-proto.lisp +++ b/src/lexer-proto.lisp @@ -84,8 +84,10 @@ (defun lexer-error (char-scanner expected &key location) "Signal a continuable lexical error." (cerror*-with-location (or location char-scanner) "Lexical error: ~ - expected ~{~#[~;~A~;~A or ~A~:;~A, ~]~} ~ - but found ~/sod::show-char/" + ~:[unexpected~;~ + expected ~:*~{~#[~;~A~;~A or ~A~:;~A, ~]~} ~ + but found~] ~ + ~/sod::show-char/" (mapcar (lambda (exp) (typecase exp (character (format nil "~/sod::show-char/" exp)) -- [mdw]