(scanner-current-char char-scanner))
(and consumedp (file-location char-scanner))))
+(export 'skip-until)
(defparse skip-until (:context (context token-scanner-context)
(&key (keep-end nil keep-end-p))
&rest token-types)
:keep-end ,(if keep-end-p keep-end
(> (length token-types) 1))))
+(export 'error)
(defparse error (:context (context token-scanner-context)
(&key) sub &optional (recover t))
"Try to parse SUB; if it fails then report an error, and parse RECOVER.
;;;--------------------------------------------------------------------------
;;; Lexical analysis utilities.
+(export 'scan-comment)
(defun scan-comment (char-scanner)
"Scan a comment (either `/* ... */' or `// ...') from CHAR-SCANNER.
;;;--------------------------------------------------------------------------
;;; Code fragments.
-(export 'c-fragment)
+(export '(c-fragment c-fragment-text))
(defclass c-fragment ()
- ((location :initarg :location :type file-location
- :accessor c-fragment-location)
- (text :initarg :text :type string :accessor c-fragment-text))
+ ((location :initarg :location :type file-location :reader file-location)
+ (text :initarg :text :type string :reader c-fragment-text))
(:documentation
"Represents a fragment of C code to be written to an output file.
(defmethod print-object ((fragment c-fragment) stream)
(let ((text (c-fragment-text fragment))
- (location (c-fragment-location fragment)))
+ (location (file-location fragment)))
(if *print-escape*
(print-unreadable-object (fragment stream :type t)
(when location
(let ((head (car opstack)))
(cond ((not (typep head 'open-parenthesis))
(apply-operator head state))
- ((not (eq (slot-value head 'tag) tag))
+ ((not (eql (slot-value head 'tag) tag))
(fail))
(t
(return)))
(:documentation
"Push VALUE onto the STATE's value stack.
- The default message just does that without any fuss. It's unlikely that
+ The default method just does that without any fuss. It's unlikely that
this will need changing unless you invent some really weird values."))
(export 'apply-operator)
(defun pset-get (pset key)
"Look KEY up in PSET and return what we find.
- If there's no property by that name, return NIL."
+ If there's no property by that name, return nil."
(values (gethash key (%pset-hash pset))))
(defun pset-store (pset prop)
((endp list) pset)
(add-property pset (funcall name list) (funcall value list))))))
-(export 'check--unused-properties)
+(export 'check-unused-properties)
(defun check-unused-properties (pset)
"Issue errors about unused properties in PSET."
(when pset
;;; Utility macros.
(defmacro default-slot-from-property
- ((instance slot slot-names)
+ ((instance slot &optional (slot-names t))
(pset property type
&optional (pvar (gensym "PROP-"))
&rest convert-forms)