chiark
/
gitweb
/
~mdw
/
sod
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
An actual running implementation, which makes code that compiles.
[sod]
/
src
/
parser
/
scanner-token-impl.lisp
diff --git
a/src/parser/scanner-token-impl.lisp
b/src/parser/scanner-token-impl.lisp
index 9535d3d22891c7b4381ae860b61813d0b37acc5b..8ab427a03219f72083e5d326086855cd2c63c6ac 100644
(file)
--- a/
src/parser/scanner-token-impl.lisp
+++ b/
src/parser/scanner-token-impl.lisp
@@
-28,6
+28,11
@@
(cl:in-package #:sod-parser)
;;;--------------------------------------------------------------------------
;;; Token scanner implementation.
;;;--------------------------------------------------------------------------
;;; 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))
(defmethod shared-initialize :after
((scanner token-scanner) slot-names &key)
(declare (ignore slot-names))
@@
-50,9
+55,10
@@
(defmethod scanner-step ((scanner token-scanner))
(setf type ty
value val)
(if (plusp captures)
(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)))))))
(setf (token-scanner-place-next tail) next
tail next))
(setf tail nil)))))))
@@
-61,8
+67,9
@@
(defmethod scanner-capture-place ((scanner token-scanner))
(with-slots (type value captures tail line column) scanner
(incf captures)
(or tail
(with-slots (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
(defmethod scanner-restore-place ((scanner token-scanner) place)
(with-slots (type value tail line column) scanner