CLIM mail archive

[Prev][Next][Index][Thread]

CLIM handling of parse-errors in accept w/ meta-presentation types



This is a question on how I should handle parse errors in my own presentation-
type accept method, when you inherit the presentation into multiple
classes and those classes are part of a meta presentation type used in a
command.  How can I get a more complete parse error message for the following:

;define a presentation type w/ your own accept method!

(defun get-object-from (strg) t)  ;fake it for illustration!

(define-presentation-type my-type ())

(define-presentation-method accept ((type my-type)) stream (view textual-view)
					&key)
    (let* ((token (read-token stream)) (obj (get-object-from token)))
	(when (null obj) 
	   (simple-parse-error (format nil "Invalid ~a type" type)))
	(return-from accept obj)))

(defclass one (my-type) ())
(defclass two (my-type) ())

;in your application you have a command

(define-my-application-command (com-test :name t) (obj '(or one two) (other t))
	t)

;In the application interactor pane you enter:
Test <space> <space>

;And you get the following!

Invalid two type
Please edit your input.

Test (obj) 

;My question is how can I get this instead?

Invalid one or two type
Please edit your input.

Test (obj) 

;It seems there is no facility for reaching meta-presentations within your
;accept method for indicating an error for input.  Is there something else
;I should use instead of simple-parse-error.  How can one make his own
;accept method recognize the fact that is it being used in a meta-presentation
;context?



Main Index | Thread Index