;; `demo' string `;'
(declare (ignore pset))
(with-parser-context (token-scanner-context :scanner scanner)
- (parse (seq ("demo" (string :string) #\;)
+ (parse (seq ("demo" (string (must :string)) (nil (must #\;)))
(format t ";; DEMO ~S~%" string)))))
(define-pluggable-parser module file (scanner pset)
;; `load' string `;'
(declare (ignore pset))
(flet ((common (name type what thunk)
- (find-file scanner
- (merge-pathnames name
- (make-pathname :type type
- :case :common))
- what
- thunk)))
+ (when name
+ (find-file scanner
+ (merge-pathnames name
+ (make-pathname :type type
+ :case :common))
+ what
+ thunk))))
(with-parser-context (token-scanner-context :scanner scanner)
- (parse (or (seq ("import" (name :string) #\;)
+ (parse (or (seq ("import" (name (must :string)) (nil (must #\;)))
(common name "SOD" "module"
(lambda (path true)
(handler-case
*module*))))
(file-error (error)
(cerror* "Error reading module ~S: ~A"
+ path error))
+ (error (error)
+ (cerror* "Unexpected error reading ~
+ module ~S: ~A"
path error))))))
- (seq ("load" (name :string) #\;)
+ (seq ("load" (name (must :string)) (nil (must #\;)))
(common name "LISP" "Lisp file"
(lambda (path true)
(handler-case
(scanner-step scanner)
(values sexp t t))
(values '((:id "lisp")) nil nil)))
- #\;)
+ (nil (must #\;)))
(eval sexp)))))
;;;--------------------------------------------------------------------------
(car declarator)
pset init scanner))
#\,))
- #\;)))))
+ (nil (must #\;)))))))
(defun parse-class-body (scanner pset name supers)
;; class-body ::= `{' class-item* `}'