RFR 8192974: overhaul descriptor string parsing
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Tue Dec 5 13:23:42 UTC 2017
Hi,
this patch is a rewriting on the layout descriptor parser code - the
previous code was working correctly, but was a bit too convoluted and
lacked documentation. The new code is simpler and adds the grammar
productions in the javadoc of the various parsing methods. This work
should make it easier to add new features to the layout descriptor DSL
(such as symbolic references).
The new parser has a single entry point - namely 'parseLayout', which
gives back a Stream<Type>.
I've written a big test case that generates the set of sentences that
can be expressed in the descriptor grammar - of course since this set is
infinite, we need to do some tricks in order to prevent infinite
expansions of productions - and we also need to do some tricks not to
generate too many combinations.
Currently, the test checks approx 7 millions different combinations -
and it does so in 10 seconds and with 1G of heap, which I think it's
acceptable.
I also had to tweak the existing DescriptorTest as that was relying on
the structure of the old parser.
Cheers
Maurizio
More information about the panama-dev
mailing list