Re: "Macro" expansion

Jonathan Hogg <[email protected]> Sun, 27 May 2001 23:41:27 +0100
Newsgroups gmane.comp.sysutils.ark.devel
Message-ID <[email protected]>
On 27/5/01 21:38, Matt Holgate wrote:

>@<object-type|param>:<field-name>[:<index>[:<separator>]]@

OK, I liked what Matt said, so I went ahead and implemented it. To keep 
backwards compatibility though, I put in a hack for "package:indexed". 
I'm not sure where that should fit into your schema Matt.

I extended your schema slightly so that '*:<delim>' can be used for 
tables too (it separates the table values in arbitrary order). I've also 
added a new 'type' called "self", which represents the thing being 
evaluated (not always a 'package').

I think there is some conceptual horror lying in this somewhere that Will 
will hopefully point out for me...

>@{host:run-level-dir:@{param:RUN_LEVEL}@}@

Hah! scarily Matt, you may be interested to know that this actually works 
using the current schema. So you can do this with my code as:

     @host:run-level-dir:@param:RUN_LEVEL@@

The regex I'm using to find the '@...@' stuff is smart enough to see that 
'@host:run-level-dir:@' is a bad spec so it skips it and matches the 
'@param:RUN_LEVEL@' one. Having replaced it, it looks again and finds 
'@host:run-level-dir:3@' (or whatever) and successfully matches it.

The funny thing is, I hadn't actually meant to do this, it just works ;-)

If Will (Ark Benevolant Dictator For Life) is happy with the changes then 
I'll commit them.

:-j (working late again)


-- 
jonathan hogg, one good idea ltd, 131 queen margaret dr., glasgow g20 8pd
http://www.onegoodidea.com/ tel:+44-(0)7976-614338 fax:+44-(0)7970-537451