state. So the scanner context is a compile-time context which expands to
calls to use the run-time scanner. See?
- This class provides common compile-time behaviour for PARSER-AT-EOF-P and
- friends by invoking corresponding methods on the scanner object at
+ This class provides common compile-time behaviour for `parser-at-eof-p'
+ and friends by invoking corresponding methods on the scanner object at
run-time."))
;;;--------------------------------------------------------------------------
(next nil :type (or token-scanner-place null))
(type nil :read-only t)
(value nil :read-only t)
- (line 1 :type fixnum :read-only t)
- (column 0 :type fixnum :read-only t))
+ (line 1 :type (or fixnum null) :read-only t)
+ (column 0 :type (or fixnum null) :read-only t))
;; The token scanner base class and parser context.
(value :reader token-value)
(captures :initform 0 :type fixnum)
(tail :initform nil :type (or token-scanner-place null))
- (filename :initarg filename :type string :reader scanner-filename)
+ (filename :initarg :filename :type string :reader scanner-filename)
(line :initarg :line :initform 1 :type fixnum :accessor scanner-line)
(column :initarg :column :initform 0
:type fixnum :accessor scanner-column))
`stream-read-sequence' and `stream-read-line' in a scanner-specific
manner."))
+(export 'make-scanner-stream)
+(defgeneric make-scanner-stream (scanner)
+ (:documentation
+ "Return a stream which reads from the SCANNER.
+
+ The default method simply constructs a `character-scanner-stream'
+ instance. Subclasses of `character-scanner' can override this method in
+ order to return instances of more efficient stream subclasses.")
+ (:method ((scanner character-scanner))
+ (make-instance 'character-scanner-stream :scanner scanner)))
+
;;;----- That's all, folks --------------------------------------------------