chiark
/
gitweb
/
~mdw
/
sod
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
src/class-output.lisp: Insert the correct class pointers.
[sod]
/
src
/
parser
/
scanner-charbuf-impl.lisp
diff --git
a/src/parser/scanner-charbuf-impl.lisp
b/src/parser/scanner-charbuf-impl.lisp
index 9cafc3d4bd9c3e5c2ffe974ab56d7edb80ce951e..272c7ed18e97516e6034f0bbe7b59b1eecad43fd 100644
(file)
--- a/
src/parser/scanner-charbuf-impl.lisp
+++ b/
src/parser/scanner-charbuf-impl.lisp
@@
-28,8
+28,9
@@
(cl:in-package #:sod-parser)
;;;--------------------------------------------------------------------------
;;; Infrastructure types.
;;;--------------------------------------------------------------------------
;;; Infrastructure types.
-(defconstant charbuf-size 4096
- "Number of characters in a character buffer.")
+(eval-when (:compile-toplevel :load-toplevel :execute)
+ (defconstant charbuf-size 4096
+ "Number of characters in a character buffer."))
(deftype charbuf ()
"Type of character buffers."
(deftype charbuf ()
"Type of character buffers."
@@
-66,11
+67,18
@@
(defstruct charbuf-scanner-place
We remember the buffer-chain link, so that we can retrace our steps up to
the present. We also need the index at which we continue reading
characters; and the line and column numbers to resume from."
We remember the buffer-chain link, so that we can retrace our steps up to
the present. We also need the index at which we continue reading
characters; and the line and column numbers to resume from."
+ (scanner nil :type charbuf-scanner :read-only t)
(link nil :type charbuf-chain-link :read-only t)
(index 0 :type charbuf-index :read-only t)
(line 0 :type fixnum :read-only t)
(column 0 :type fixnum :read-only t))
(link nil :type charbuf-chain-link :read-only t)
(index 0 :type charbuf-index :read-only t)
(line 0 :type fixnum :read-only t)
(column 0 :type fixnum :read-only t))
+(defmethod file-location ((place charbuf-scanner-place))
+ (make-file-location (scanner-filename
+ (charbuf-scanner-place-scanner place))
+ (charbuf-scanner-place-line place)
+ (charbuf-scanner-place-column place)))
+
;;;--------------------------------------------------------------------------
;;; Main class.
;;;--------------------------------------------------------------------------
;;; Main class.
@@
-316,7
+324,7
@@
(defmethod scanner-capture-place ((scanner charbuf-scanner))
(incf captures)
(unless tail
(setf tail (make-charbuf-chain-link :buf buf :size size)))
(incf captures)
(unless tail
(setf tail (make-charbuf-chain-link :buf buf :size size)))
- (make-charbuf-scanner-place :link tail :index index
+ (make-charbuf-scanner-place :
scanner scanner :
link tail :index index
:line line :column column)))
(defmethod scanner-restore-place ((scanner charbuf-scanner) place)
:line line :column column)))
(defmethod scanner-restore-place ((scanner charbuf-scanner) place)
@@
-330,6
+338,7
@@
(defmethod scanner-restore-place ((scanner charbuf-scanner) place)
tail link))))
(defmethod scanner-release-place ((scanner charbuf-scanner) place)
tail link))))
(defmethod scanner-release-place ((scanner charbuf-scanner) place)
+ (declare (ignore place))
(with-slots (captures) scanner
(decf captures)))
(with-slots (captures) scanner
(decf captures)))
@@
-365,7
+374,8
@@
(defmethod scanner-interval
(let* ((slices nil)
(place-b (or place-b
(with-slots (index tail) scanner
(let* ((slices nil)
(place-b (or place-b
(with-slots (index tail) scanner
- (make-charbuf-scanner-place :link tail
+ (make-charbuf-scanner-place :scanner scanner
+ :link tail
:index index))))
(last-link (charbuf-scanner-place-link place-b)))
(flet ((bad ()
:index index))))
(last-link (charbuf-scanner-place-link place-b)))
(flet ((bad ()
@@
-399,7
+409,8
@@
(defmethod make-scanner-stream ((scanner charbuf-scanner))
(make-instance 'charbuf-scanner-stream :scanner scanner))
(defmethod stream-read-sequence
(make-instance 'charbuf-scanner-stream :scanner scanner))
(defmethod stream-read-sequence
- ((stream charbuf-scanner-stream) (seq string) &optional (start 0) end)
+ ((stream charbuf-scanner-stream) (seq string)
+ #+clisp &key #-clisp &optional (start 0) end)
(with-slots (scanner) stream
(unless end (setf end (length seq)))
(let ((i start) (n (- end start)))
(with-slots (scanner) stream
(unless end (setf end (length seq)))
(let ((i start) (n (- end start)))