From: Mark Wooding Date: Wed, 19 Aug 2015 16:37:17 +0000 (+0100) Subject: src/parser/scanner-charbuf-impl.lisp: Delay `charbuf-scanner-place'. X-Git-Tag: 0.2.0~68 X-Git-Url: https://git.distorted.org.uk/~mdw/sod/commitdiff_plain/502df9a219a1a8b94eca0038b1e7203b91f11a30 src/parser/scanner-charbuf-impl.lisp: Delay `charbuf-scanner-place'. Similar to 1d087117..., we have mutually recursive references between a class and structure, which we resolve by delaying the structure definition. --- diff --git a/src/parser/scanner-charbuf-impl.lisp b/src/parser/scanner-charbuf-impl.lisp index 272c7ed..65f6e1e 100644 --- a/src/parser/scanner-charbuf-impl.lisp +++ b/src/parser/scanner-charbuf-impl.lisp @@ -60,25 +60,6 @@ (buf nil :type (or charbuf (member nil :eof)) :read-only t) (size 0 :type charbuf-index :read-only t)) -(export 'charbuf-scanner-place-p) -(defstruct charbuf-scanner-place - "A captured place we can return to later. - - 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)) - -(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. @@ -129,6 +110,25 @@ captured places properly when he's finished. In practice, this is usually done using the `peek' parser macro so there isn't a problem.")) +(export 'charbuf-scanner-place-p) +(defstruct charbuf-scanner-place + "A captured place we can return to later. + + 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)) + +(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))) + ;;;-------------------------------------------------------------------------- ;;; Utilities.