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: Use newer syntax notation in the commentary.
[sod]
/
src
/
module-parse.lisp
diff --git
a/src/module-parse.lisp
b/src/module-parse.lisp
index da1c47f15773c42a9e9e836cf7b8e891046feb6f..4d4d818a4e1bc29a7262cb0eb174681852ec2f44 100644
(file)
--- a/
src/module-parse.lisp
+++ b/
src/module-parse.lisp
@@
-31,7
+31,7
@@
(in-package #:sod)
;;; Type names.
(define-pluggable-parser module typename (scanner pset)
;;; Type names.
(define-pluggable-parser module typename (scanner pset)
- ;; `typename'
id ( `,' id )*
`;'
+ ;; `typename'
list[id]
`;'
(declare (ignore pset))
(with-parser-context (token-scanner-context :scanner scanner)
(parse (and "typename"
(declare (ignore pset))
(with-parser-context (token-scanner-context :scanner scanner)
(parse (and "typename"
@@
-50,7
+50,7
@@
(define-pluggable-parser module typename (scanner pset)
(define-pluggable-parser module code (scanner pset)
;; `code' id `:' item-name [constraints] `{' c-fragment `}'
;;
(define-pluggable-parser module code (scanner pset)
;; `code' id `:' item-name [constraints] `{' c-fragment `}'
;;
- ;; constrain
s ::= `[' constraint-list
`]'
+ ;; constrain
ts ::= `[' list[constraint]
`]'
;; constraint ::= item-name+
;; item-name ::= id | `(' id+ `)'
(declare (ignore pset))
;; constraint ::= item-name+
;; item-name ::= id | `(' id+ `)'
(declare (ignore pset))
@@
-162,22
+162,22
@@
(define-pluggable-parser module file (scanner pset)
;;; Setting properties.
(define-pluggable-parser module set (scanner pset)
;;; Setting properties.
(define-pluggable-parser module set (scanner pset)
- ;; `set'
property-list
`;'
+ ;; `set'
list[property]
`;'
(with-parser-context (token-scanner-context :scanner scanner)
(parse (and "set"
(lisp (let ((module-pset (module-pset *module*)))
(when pset
(pset-map (lambda (prop)
(with-parser-context (token-scanner-context :scanner scanner)
(parse (and "set"
(lisp (let ((module-pset (module-pset *module*)))
(when pset
(pset-map (lambda (prop)
- (add-property
module-pset
- (p-name prop)
-
(p-value prop)
-
:type (p-type prop)
-
:location (p-location prop))
+ (add-property
+ module-pset
+
(p-name prop)
(p-value prop)
+ :type (p-type prop)
+ :location (p-location prop))
(setf (p-seenp prop) t))
pset))
(parse (skip-many (:min 0)
(error (:ignore-unconsumed t)
(setf (p-seenp prop) t))
pset))
(parse (skip-many (:min 0)
(error (:ignore-unconsumed t)
- (parse-property scanner module-pset)
+
(parse-property scanner module-pset)
(skip-until (:keep-end t) #\, #\;))
#\,))))
#\;))))
(skip-until (:keep-end t) #\, #\;))
#\,))))
#\;))))
@@
-213,7
+213,7
@@
(define-pluggable-parser class-item initfrags (scanner class pset)
(funcall make class frag pset scanner)))))
(define-pluggable-parser class-item initargs (scanner class pset)
(funcall make class frag pset scanner)))))
(define-pluggable-parser class-item initargs (scanner class pset)
- ;; initarg-item ::= `initarg' declspec+
init-declarator-list
+ ;; initarg-item ::= `initarg' declspec+
list[init-declarator]
;; init-declarator ::= declarator [`=' initializer]
(with-parser-context (token-scanner-context :scanner scanner)
(parse (seq ("initarg"
;; init-declarator ::= declarator [`=' initializer]
(with-parser-context (token-scanner-context :scanner scanner)
(parse (seq ("initarg"
@@
-237,7
+237,13
@@
(defun parse-class-body (scanner pset name supers)
;; class-item ::= property-set raw-class-item
(with-parser-context (token-scanner-context :scanner scanner)
(make-class-type name)
;; class-item ::= property-set raw-class-item
(with-parser-context (token-scanner-context :scanner scanner)
(make-class-type name)
- (let* ((class (make-sod-class name (mapcar #'find-sod-class supers)
+ (let* ((duff nil)
+ (class (make-sod-class name
+ (restart-case
+ (mapcar #'find-sod-class supers)
+ (continue ()
+ (setf duff t)
+ (list (find-sod-class "SodObject"))))
pset scanner))
(nick (sod-class-nickname class)))
pset scanner))
(nick (sod-class-nickname class)))
@@
-295,10
+301,9
@@
(defun parse-class-body (scanner pset name supers)
(parse-slot-item (sub-pset base-type type name)
;; slot-item ::=
;; declspec+ declarator -!- [initializer]
(parse-slot-item (sub-pset base-type type name)
;; slot-item ::=
;; declspec+ declarator -!- [initializer]
- ;; [`,'
init-declarator-list
] `;'
+ ;; [`,'
list[init-declarator]
] `;'
;;
;;
- ;; init-declarator-list ::=
- ;; declarator [initializer] [`,' init-declarator-list]
+ ;; init-declarator ::= declarator [initializer]
(parse (and (seq ((init (? (parse-initializer))))
(make-sod-slot class name type
sub-pset scanner)
(parse (and (seq ((init (? (parse-initializer))))
(make-sod-slot class name type
sub-pset scanner)
@@
-320,11
+325,10
@@
(defun parse-class-body (scanner pset name supers)
(parse-initializer-item (sub-pset must-init-p constructor)
;; initializer-item ::=
(parse-initializer-item (sub-pset must-init-p constructor)
;; initializer-item ::=
- ;; [`class'] -!-
slot-initializer-list
`;'
+ ;; [`class'] -!-
list[slot-initializer]
`;'
;;
;; slot-initializer ::= id `.' id [initializer]
;;
;; slot-initializer ::= id `.' id [initializer]
- (let ((parse-init (if must-init-p
- #'parse-initializer
+ (let ((parse-init (if must-init-p #'parse-initializer
(parser () (? (parse-initializer))))))
(parse (and (skip-many ()
(seq ((name-a :id) #\. (name-b :id)
(parser () (? (parse-initializer))))))
(parse (and (skip-many ()
(seq ((name-a :id) #\. (name-b :id)
@@
-349,7
+353,7
@@
(defun parse-class-body (scanner pset name supers)
(when (consp name)
(cerror*-with-location
scanner
(when (consp name)
(cerror*-with-location
scanner
- "Method declarations must have function type
.
")
+ "Method declarations must have function type")
(setf name (cdr name)))
(parse-slot-item sub-pset base-type type name))
((consp name)
(setf name (cdr name)))
(parse-slot-item sub-pset base-type type name))
((consp name)
@@
-379,11
+383,9
@@
(defun parse-class-body (scanner pset name supers)
(car dc)
(cdr dc))))))
(and "class"
(car dc)
(cdr dc))))))
(and "class"
- (parse-initializer-item
- sub-pset t
+ (parse-initializer-item sub-pset t
#'make-sod-class-initializer))
#'make-sod-class-initializer))
- (parse-initializer-item
- sub-pset nil
+ (parse-initializer-item sub-pset nil
#'make-sod-instance-initializer)))))
(parse (seq (#\{
#'make-sod-instance-initializer)))))
(parse (seq (#\{
@@
-392,11
+394,13
@@
(defun parse-class-body (scanner pset name supers)
(nil (parse-raw-class-item sub-pset)))
(check-unused-properties sub-pset))))
(nil (error () #\})))
(nil (parse-raw-class-item sub-pset)))
(check-unused-properties sub-pset))))
(nil (error () #\})))
- (finalize-sod-class class)
- (add-to-module *module* class)))))))
+ (unless (finalize-sod-class class)
+ (setf duff t))
+ (unless duff
+ (add-to-module *module* class))))))))
(define-pluggable-parser module class (scanner pset)
(define-pluggable-parser module class (scanner pset)
- ;; `class' id `:'
id-list
class-body
+ ;; `class' id `:'
list[id]
class-body
;; `class' id `;'
(with-parser-context (token-scanner-context :scanner scanner)
(parse (seq ("class"
;; `class' id `;'
(with-parser-context (token-scanner-context :scanner scanner)
(parse (seq ("class"