src/lexer-proto.lisp, ...: Kill `lexer-error' pointless CONSUMEDP flag.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 8 Jun 2018 18:58:28 +0000 (19:58 +0100)
Not sure what the idea was.  It seems to control printing the location
as part of the message, but the error printing machinery takes care of
doing that anyway; and even so, it seems to hang off this flag.

Kill it, and the redundant printing of the location.

doc/parsing.tex
src/fragment-parse.lisp
src/lexer-impl.lisp
src/lexer-proto.lisp

index 20ade82..a83f26b 100644 (file)
@@ -768,7 +768,7 @@ file-location protocols.
 \end{describe}
 
 \begin{describe}{fun}
-    {lexer-error @<char-scanner> @<expected> @<consumed-flag>}
+    {lexer-error @<char-scanner> @<expected>}
 \end{describe}
 
 \begin{describe}{parseform}
index 15a7d14..8e32b07 100644 (file)
@@ -87,7 +87,7 @@
                         (values end-chars nil nil)))
               (return (values it t t)))
              (:eof
-              (lexer-error char-scanner '(:any) cp)
+              (lexer-error char-scanner '(:any))
               (return (values (result) t t)))
 
              ;; Opening and closing brackets.  Opening brackets push things
              ;; This really shouldn't be able to happen.
              (t
               (assert cp)
-              (lexer-error char-scanner exp cp)))))))))
+              (lexer-error char-scanner exp)))))))))
 
 (export 'parse-delimited-fragment)
 (defun parse-delimited-fragment (scanner begin end &key keep-end)
index b579278..821849b 100644 (file)
          (cond-parse (:consumedp cp :expected exp)
            ((satisfies whitespace-char-p) (parse :whitespace))
            ((scan-comment char-scanner))
-           (t (if cp (lexer-error char-scanner exp cp) (return)))))
+           (t (if cp (lexer-error char-scanner exp) (return)))))
 
        ;; Now parse something.
        (cond-parse (:consumedp cp :expected exp)
          ;; must make progress on every call.
          (t
           (assert cp)
-          (lexer-error char-scanner exp cp)
+          (lexer-error char-scanner exp)
           (scanner-token scanner)))))))
 
 ;;;----- That's all, folks --------------------------------------------------
index 1850326..a70addc 100644 (file)
             (show-token (token-type scanner) (token-value scanner)))))
 
 (export 'lexer-error)
-(defun lexer-error (char-scanner expected consumedp)
+(defun lexer-error (char-scanner expected)
   "Signal a continuable lexical error."
   (cerror* "Lexical error: ~
            expected ~{~#[<bug>~;~A~;~A or ~A~:;~A, ~]~} ~
-           but found ~/sod::show-char/~
-           ~@[ at ~A~]"
+           but found ~/sod::show-char/"
           (mapcar (lambda (exp)
                     (typecase exp
                       (character (format nil "~/sod::show-char/" exp))
@@ -96,8 +95,7 @@
                       (t (format nil "<? ~S>" exp))))
                   expected)
           (and (not (scanner-at-eof-p char-scanner))
-               (scanner-current-char char-scanner))
-          (and consumedp (file-location char-scanner))))
+               (scanner-current-char char-scanner))))
 
 (export 'skip-until)
 (defparse skip-until (:context (context token-scanner-context)