summaryrefslogtreecommitdiff
path: root/input.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'input.lisp')
-rw-r--r--input.lisp17
1 files changed, 12 insertions, 5 deletions
diff --git a/input.lisp b/input.lisp
index 55a72cb..5d6a162 100644
--- a/input.lisp
+++ b/input.lisp
@@ -28,10 +28,17 @@
(values line column)))
(defmethod print-object ((obj parser-input) stream)
- (let ((context-length 10))
+ (let ((context-length 20))
(let ((begin (max (- (input-cursor obj) context-length) 0))
(end (min (+ (input-cursor obj) context-length) (length (input-data obj)))))
- (format stream "...~a~a~a..."
- (substitute #\¶ #\Newline (subseq (input-data obj) begin (input-cursor obj)))
- (substitute #\¶ #\Newline (subseq (input-data obj) (input-cursor obj) (1+ (input-cursor obj))))
- (substitute #\¶ #\Newline (subseq (input-data obj) (1+ (input-cursor obj)) end))))))
+ (when (< 0 begin)
+ (format stream "..."))
+ (format stream "~a"
+ (substitute #\↲ #\Newline (subseq (input-data obj) begin (input-cursor obj))))
+ (if (< (input-cursor obj) (length (input-data obj)))
+ (format stream "~a~a"
+ (substitute #\↲ #\Newline (subseq (input-data obj) (input-cursor obj) (1+ (input-cursor obj))))
+ (substitute #\↲ #\Newline (subseq (input-data obj) (1+ (input-cursor obj)) end)))
+ (format stream "¬"))
+ (when (< end (length (input-data obj)))
+ (format stream "...")))))