[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: command line evaluator
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 22 Jan 2010 08:24:38 +0200
On Fri, Jan 22, 2010 at 3:44 AM, David Manura <dm.lua@math2.org> wrote:
> A similar case is Perl's special qw() operator that makes these two equivalent:
>
> @x = ('a', 'b', 'c');
> @x = qw(a b c);
I did files as a macro:
def ('files',{'arg'; handle_parms =
macro.parameter_grabber(false,false,'<start>')},
function(ls,arg)
local subst,put = macro.subst_putter()
put '{'
local n = macro.length_of(arg)
local value_of = macro.value_of
local i = 1
while i <= n do
if i < n-1 and value_of(arg,i+1) == '.' then -- NAME . EXT
put('<string>',value_of(arg,i)..'.'..value_of(arg,i+2))
i = i + 2
else
put('<string>',value_of(arg,i))
end
put ','
i = i + 1
end
put '}'
return subst
end
)
> p (files(one.c two.c three.c))
{ "one.c", "two.c", "three.c" }
It would be an interesting exercise to see how much of CMake's syntax
can be done using a few macros.
steve d.