chiark
/
gitweb
/
~mdw
/
sod
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
src/module-parse.lisp: Improve error recovery for `initarg' class-items.
[sod]
/
src
/
module-parse.lisp
diff --git
a/src/module-parse.lisp
b/src/module-parse.lisp
index 014e7e3d0c906a50fb18efa1fb91ab318b9a9833..2d81de17037157e703cf9b8f6a6d7e421e5fca0a 100644
(file)
--- a/
src/module-parse.lisp
+++ b/
src/module-parse.lisp
@@
-140,14
+140,15
@@
(define-pluggable-parser module file (scanner pset)
;; `load' string `;'
(declare (ignore pset))
(flet ((common (name type what thunk)
;; `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)
(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
(common name "SOD" "module"
(lambda (path true)
(handler-case
@@
-160,8
+161,12
@@
(define-pluggable-parser module file (scanner pset)
*module*))))
(file-error (error)
(cerror* "Error reading module ~S: ~A"
*module*))))
(file-error (error)
(cerror* "Error reading module ~S: ~A"
+ path error))
+ (error (error)
+ (cerror* "Unexpected error reading ~
+ module ~S: ~A"
path error))))))
path error))))))
- (seq ("load" (name
:string) #\;
)
+ (seq ("load" (name
(must :string)) (nil (must #\;))
)
(common name "LISP" "Lisp file"
(lambda (path true)
(handler-case
(common name "LISP" "Lisp file"
(lambda (path true)
(handler-case
@@
-206,7
+211,7
@@
(define-pluggable-parser module lisp (scanner pset)
(scanner-step scanner)
(values sexp t t))
(values '((:id "lisp")) nil nil)))
(scanner-step scanner)
(values sexp t t))
(values '((:id "lisp")) nil nil)))
-
#\;
)
+
(nil (must #\;))
)
(eval sexp)))))
;;;--------------------------------------------------------------------------
(eval sexp)))))
;;;--------------------------------------------------------------------------
@@
-240,7
+245,7
@@
(define-pluggable-parser class-item initargs (scanner class pset)
(car declarator)
pset init scanner))
#\,))
(car declarator)
pset init scanner))
#\,))
-
#\;
)))))
+
(nil (must #\;))
)))))
(defun parse-class-body (scanner pset name supers)
;; class-body ::= `{' class-item* `}'
(defun parse-class-body (scanner pset name supers)
;; class-body ::= `{' class-item* `}'