From johan@ccs.neu.edu Wed Oct 8 09:40:52 1997 Received: from carbon.ccs.neu.edu (carbon.ccs.neu.edu [129.10.114.110]) by amber.ccs.neu.edu (8.8.6/8.7.3) with ESMTP id JAA09740; Wed, 8 Oct 1997 09:40:50 -0400 (EDT) Received: (johan@localhost) by carbon.ccs.neu.edu (8.8.6/8.6.4) id JAA31312; Wed, 8 Oct 1997 09:40:48 -0400 (EDT) Date: Wed, 8 Oct 1997 09:40:48 -0400 (EDT) Message-Id: <199710081340.JAA31312@carbon.ccs.neu.edu> From: Johan Ovlinger To: lblando@gte.com CC: dougo@ccs.neu.edu, lieber@ccs.neu.edu, dem@ccs.neu.edu In-reply-to: <199710080804.EAA01353@rigel.ccs.neu.edu> (message from Doug Orleans on Wed, 8 Oct 1997 04:04:59 -0400 (EDT)) Subject: Re: primitive types in demjava Status: R > Field ~ SubFieldName { "." SubFieldName } . > SubFieldName = Ident . I like solutions where you don't have to muck about with supposedly generated things like grammars. In this case, if you want to make an Ident (or perhaps a String) of the all the SubFields after parsing, use a so called derived edge. in the .cd file: SimpleField = Field String. // Field as above. in the .beh file: SimpleField { // this code will be called to return the part. get thestring (@ // We'll print the fields to a stringstream StringWriter p = new StringWriter(); // do the printing get_fields().universal_trv0(new PrintVisitor(new PrintWriter(p))); // extract the printed string return p.toString(); @) } This'll do the trick, I hope. Every time you ask SimpleField for its part, it will be calculated from the subfields. I was a bit worried that PrintVisitor would peint spaces between the "." and the Idents, but the changes file says that it wont. If you get_thestring() a lot, you might conscider caching the printed string in SimpleField, but that is a performance conscideration, and can be added transparently once everything is working. Johan