From 26c5ecfef79e0158c3ea38e9c32ad1fe3e85be3e Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 26 May 2016 09:26:09 +0100 Subject: [PATCH] src/lexer-proto.lisp, ...: Kill `lexer-error' pointless CONSUMEDP flag. 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 | 2 +- src/fragment-parse.lisp | 4 ++-- src/lexer-impl.lisp | 4 ++-- src/lexer-proto.lisp | 8 +++----- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/doc/parsing.tex b/doc/parsing.tex index 20ade82..a83f26b 100644 --- a/doc/parsing.tex +++ b/doc/parsing.tex @@ -768,7 +768,7 @@ file-location protocols. \end{describe} \begin{describe}{fun} - {lexer-error @ @ @} + {lexer-error @ @} \end{describe} \begin{describe}{parseform} diff --git a/src/fragment-parse.lisp b/src/fragment-parse.lisp index 15a7d14..8e32b07 100644 --- a/src/fragment-parse.lisp +++ b/src/fragment-parse.lisp @@ -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 @@ -112,7 +112,7 @@ ;; 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) diff --git a/src/lexer-impl.lisp b/src/lexer-impl.lisp index b579278..821849b 100644 --- a/src/lexer-impl.lisp +++ b/src/lexer-impl.lisp @@ -109,7 +109,7 @@ (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) @@ -168,7 +168,7 @@ ;; 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 -------------------------------------------------- diff --git a/src/lexer-proto.lisp b/src/lexer-proto.lisp index 1850326..a70addc 100644 --- a/src/lexer-proto.lisp +++ b/src/lexer-proto.lisp @@ -79,12 +79,11 @@ (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 ~{~#[~;~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 "" 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) -- 2.11.0