A Groovy shallow parser following the language specifications found at:
http://www.
groovy-lang.org/documentation.html.
The groovy repository can be found at:
https://github.com/apache/groovy/
.
A few notes:
- This parser recognizes all types (classes, enums, interfaces,
annotations, traits), methods, attributes, local variables and control
structures (if, try, switch, loops).
- The nodes for import, package, annotations, case, default and labels are
reported as meta entities.
- Closures are reported as anonymous functions.
- Closures are parsed as well, as they are very versatile on Groovy.
- Anonymous inner classes and closures are also detected within expressions
and arrays.
Known Issues:
- Groovy allows optional parenthesis for method calls. This means that
constructs like 'println a' (which normally stands for 'println(a)') cannot
be distinguished from local variables. This parser creates local variables in
these cases.
- Constructors and methods can not be reliably distinguished. E.g.
ACCESS_MODIFIER IDENTIFIER () {...} is only a constructor if the identifier
has the same name as the type. Therefore we prefer matching methods in
ambiguous cases.