Update automatically managed build utilities.
[sod] / src / parser / scanner-impl.lisp
index 0849648..2abdff4 100644 (file)
 (defstruct (string-scanner
             (:constructor make-string-scanner
                 (string &key (start 0) end
 (defstruct (string-scanner
             (:constructor make-string-scanner
                 (string &key (start 0) end
-                 &aux (index start)
+                 &aux (%string string)
+                      (index start)
                       (limit (or end (length string))))))
   "Scanner structure for a simple string scanner."
                       (limit (or end (length string))))))
   "Scanner structure for a simple string scanner."
-  (string "" :type string :read-only t)
+  (%string "" :type string :read-only t)
   (index 0 :type (and fixnum unsigned-byte))
   (limit nil :type (and fixnum unsigned-byte) :read-only t))
   (index 0 :type (and fixnum unsigned-byte))
   (limit nil :type (and fixnum unsigned-byte) :read-only t))
+(define-access-wrapper string-scanner-string string-scanner-%string
+                      :read-only t)
 
 (defmethod scanner-at-eof-p ((scanner string-scanner))
   (>= (string-scanner-index scanner) (string-scanner-limit scanner)))
 
 (defmethod scanner-at-eof-p ((scanner string-scanner))
   (>= (string-scanner-index scanner) (string-scanner-limit scanner)))
@@ -86,7 +89,7 @@
 
 (defmethod scanner-interval
     ((scanner string-scanner) place-a &optional place-b)
 
 (defmethod scanner-interval
     ((scanner string-scanner) place-a &optional place-b)
-  (with-slots (string index) scanner
+  (with-slots ((string %string) index) scanner
     (subseq string place-a (or place-b index))))
 
 ;;;--------------------------------------------------------------------------
     (subseq string place-a (or place-b index))))
 
 ;;;--------------------------------------------------------------------------
 
 (export 'list-scanner)
 (defstruct (list-scanner
 
 (export 'list-scanner)
 (defstruct (list-scanner
-            (:constructor make-list-scanner (list)))
+            (:constructor make-list-scanner (list &aux (%list list))))
   "Simple token scanner for lists.
 
    The list elements are the token semantic values; the token types are the
    names of the elements' classes.  This is just about adequate for testing
    purposes, but is far from ideal for real use."
   "Simple token scanner for lists.
 
    The list elements are the token semantic values; the token types are the
    names of the elements' classes.  This is just about adequate for testing
    purposes, but is far from ideal for real use."
-  (list nil :type list))
+  (%list nil :type list))
+(define-access-wrapper list-scanner-list list-scanner-%list)
 
 (defmethod scanner-step ((scanner list-scanner))
   (pop (list-scanner-list scanner)))
 
 (defmethod scanner-step ((scanner list-scanner))
   (pop (list-scanner-list scanner)))