[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug in function {metavariable}:name
- Subject: Re: bug in function {metavariable}:name
- From: prunet@oaxaca.inria.fr (Vincent Prunet)
- Date: 24 Nov 92 12:39:13 GMT
In article <34574@sophia.inria.fr>, Guido.Bosch@loria.fr (Guido Bosch) writes:
|> In Centaur 1.2, the function {metavariable}:name returns/modifies not
|> the name of a metavariable, but it's operator. This is not only
|> anoying, but also dangerous.
|>
|> Here is a script that shows you what I mean (I also verified with a
|> plain Centaur without VTP++ and object browser - it's the same behavior)
|>
|>
|> ? meta
|> = #<Glider metavariable MODULE_NAME1>
|> ? ;;; Describe object
|> #<Glider metavariable MODULE_NAME1> is a #:tree:Glider:meta
|> name: fragment-Glider-meta
|> operator: #<operator meta>
|> sons: ((MODULE_NAME1 . 0) tree)
|> father: #<Glider module_header>
|> = ()
|> ? ({metavariable}:name meta)
|> = #<operator meta>
|> ? (eq ({metavariable}:name meta) ({tree}:operator meta))
|> = t
|>
|> ;; this is was I really wanted to get or modify
|> ? (caar ({tree}:sons meta))
|> = MODULE_NAME1
|> ?
I already posted some explanations about the structure of metavariables. I
repost the same message (20 august 1992, in answer to a question raised by
Guido Bosch):
------
A metavariable tree is not a metavariable.
A metavariable is not a tree.
A metavariable tree is an atomic tree, its atom_class is metavariable, its
atom value is a metavariable.
The metavariable operator of a given formalism may be obtained by the call :
({formalism}:metavarop <formalism>).
I noticed an error in the documentation of the Virtual Tree Processor, page
24.
Here is the correct definition of the {formalism}:tree function:
(de {formalism}:tree (formalism name class . tagval)
({tree}:make ({formalism}:metavarop formalism)
(apply '{name}:metavariable name class tagval)))
Vincent
-------
Example of correct use:
? (setq form ({name}:formalism 'error))
= #[error 0 ((((comment_s * ((COMMENT ((meta 0 metavariable) (#[error 0 ((((
comment_s * ((COMMENT ((meta 0 metavariable) (#[error 0 ((((comment_s *...
? (setq metavarop ({formalism}:metavarop form))
= ((meta 0 metavariable) (#[error 0 ((((comment_s * ((COMMENT ((meta 0
metavariable) (#[error 0 ((((comment_s * ((COMMENT ((meta 0 metavariable) ...
;; the meta operator is atomic.
? ({operator}:atomic metavarop)
= t
;; the class of atom values is metavariable.
? ({operator}:class metavarop)
= metavariable
;; make a metavariable tree.
? (setq tree ({formalism}:tree form "foo" {tree}))
= ((((meta 0 metavariable) (#[error 0 ((((comment_s * ((COMMENT ((meta 0
metavariable) (#[error 0 ((((comment_s * ((COMMENT ((meta 0 metavariable) ...
;; check the operator.
? (eq ({tree}:operator tree) metavarop)
= t
;; get the value, a metavariable.
? (setq metavar ({tree}:atom_value tree))
= ((foo . 0) tree)
;; check the metavariable name and class.
? ({metavariable}:name metavar)
= foo
? ({metavariable}:class metavar)
= tree
--
Vincent Prunet, Sema Group Sophia Antipolis
INRIA BP 93 06902 SOPHIA ANTIPOLIS Cedex FRANCE
prunet@sophia.inria.fr, (33) 93 65 78 42, Fax:(33) 93 65 77 66