Major effort to plug slot-name leaks.
[sod] / src / parser / scanner-token-impl.lisp
index 9535d3d..7629b2d 100644 (file)
 ;;;--------------------------------------------------------------------------
 ;;; Token scanner implementation.
 
+(defmethod file-location ((place token-scanner-place))
+  (make-file-location (scanner-filename (token-scanner-place-scanner place))
+                     (token-scanner-place-line place)
+                     (token-scanner-place-column place)))
+
 (defmethod shared-initialize :after
     ((scanner token-scanner) slot-names &key)
   (declare (ignore slot-names))
   (scanner-step scanner))
 
 (defmethod scanner-at-eof-p ((scanner token-scanner))
-  (with-slots (type) scanner
+  (with-slots ((type %type)) scanner
     (eq type :eof)))
 
 (defmethod scanner-step ((scanner token-scanner))
-  (with-slots (type value tail captures line column) scanner
+  (with-slots ((type %type) value tail captures line column) scanner
     (acond ((and tail (token-scanner-place-next tail))
            (setf type (token-scanner-place-type it)
                  value (token-scanner-place-value it)
              (setf type ty
                    value val)
              (if (plusp captures)
-                 (let ((next (make-token-scanner-place
-                              :type ty :value val
-                              :line line :column column)))
+                 (let ((next (make-token-scanner-place :scanner scanner
+                                                       :type ty :value val
+                                                       :line line
+                                                       :column column)))
                    (setf (token-scanner-place-next tail) next
                          tail next))
                  (setf tail nil)))))))
 
 (defmethod scanner-capture-place ((scanner token-scanner))
-  (with-slots (type value captures tail line column) scanner
+  (with-slots ((type %type) value captures tail line column) scanner
     (incf captures)
     (or tail
-       (setf tail (make-token-scanner-place
-                   :type type :value value :line line :column column)))))
+       (setf tail (make-token-scanner-place :scanner scanner
+                                            :type type :value value
+                                            :line line :column column)))))
 
 (defmethod scanner-restore-place ((scanner token-scanner) place)
-  (with-slots (type value tail line column) scanner
+  (with-slots ((type %type) value tail line column) scanner
     (setf type (token-scanner-place-type place)
          value (token-scanner-place-value place)
          line (token-scanner-place-line place)