>>> "=?ISO-8859-1?Q?Per_Nordl=F6w?=" <per.nordlow@...> seems to think that:
>Does anyone have any template example on how to use SRecode to do actual *
>recoding* (refactoring) of code such as adding an argument to a function
>including its declaration, definition and calls.
There are no samples doing what you are looking for. There are
examples on how to use SRecode to add something new into a buffer, and
I think the C++ templates cover a wide range of code declarations.
My plan is that Semantic would parse the definition / declaration
into a Semantic tag. The tag would then be manipulated to add/remove
arguments. The old text at the declaration / definition would be
removed, and SRecode would then write out the new definition /
Semantic & SRecode can already do their part for C/C++, so the
missing piece is the identification and deletion of old code to be
replaced, and then tying all the pieces together.
For callers, Semantic doesn't parse that stuff yet, so that needs to
be written as a parser step. It might be possible to use the
semantic-ctxt calls to find the right argument index, and the analyzer
can find useful local variables to use for it.
The notion is that once the refactoring code is written, it would
work in any language with a Semantic parser, and SRecode standard tag
You can probably get pretty far with what is in CEDET (CVS) now.
There are a few big tasks needed to improve language independence of
any refactoring tools.
Eric Ludlam: eric@...
Siege: http://www.siege-engine.com Emacs: http://cedet.sourceforge.net