A Utility class for parsing Java expression snippets, and converting them
to proper Javac AST nodes.
This is useful for parsing
AssertNonNullIfTrue,
AssertNonNull*, and
KeyFor values.
Currently, it handles four tree types only:
- Identifier tree (e.g.
id)
- Literal tree (e.g. 2, 3)
- Method invocation tree (e.g.
method(2, 3))
- Member select tree (e.g.
Class.field, instance.method())
- Array access tree (e.g.
array[id])
Notable limitation: Doesn't handle spaces, or non-method-argument
parenthesis.
It's implemented via a Recursive-Descend parser.