[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A practical code analysis question
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 15 Feb 2012 09:38:46 +0200
On Tue, Feb 14, 2012 at 3:00 PM, Fabien <fleutot+lua@gmail.com> wrote:
>> T(ast)>>
>> :under ('Forin', 'Fornum')
>> :filter (is_op_concat)
>> :foreach (function (node)
>> local line = node.lineinfo.first.line
>> printf ("Offending node on line %i", line)
>> end)
That is a fantastic notation Fabien.
One could imagine a Lua-specific 'semantic grep' which would work like this:
$ sgrepl "(for (concat *))" *.lua
where 'for' is a shortcut predicate for (or forin fornum)
(S-expressions still have some life in them ;))
steve d.