Hi Erik,
Moose already comes with a full Java parser written in SmaCC. In your case
you could use it to get the AST of the method:
JavaParser parse: 'public class Test {
void startPoint(String x, int y) {
// Here is first ''simple'' parameter usage
this.doSomething(x, y);
// Here parameter is part of an expression
this.that.doAnother("[" + x + "]");
// Parameter is part of expression again (twice)
this.doLast(x.substring(0, y) + x.substring(y + 8));
}
}'
Then finding all the places where parameters are used within a method
should be doable using a visitor:
[image: ast.png]
Cheers,
Andrei
On Fri, Dec 14, 2018 at 11:30 AM Erik Stel <erik.stel(a)gmail.com> wrote:
Hi Nicolas,
Thanks for the quick response. Too bad it is not possible (directly).
The link you provided is behind a login, so I cannot reach it. I might go
for a quick solution, similar to your suggestion. I do not fancy writing a
parser and maintaining it through the (in this case Java) language
evolution.
(Maybe Anquetil is a very common name in France, but as a cyclist I
immediately thought of the famous Jacques Anquetil. Is there a family
relation?)
Kind regards,
Erik (aka ErikOnBike)
--
Sent from:
http://forum.world.st/Moose-f1310756.html
_______________________________________________
Moose-dev mailing list
Moose-dev(a)list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev