lua-users home
lua-l archive

Re: A practical code analysis question

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.

AltStyle によって変換されたページ (->オリジナル) /