BUG-7025: make the parser tree immutable
This adds a post-processing phase, which walks the entire tree
and makes sure children are initialized to an ImmutableList.
This is essentially the same operation as running the tree
through org.antlr.v4.runtime.Parser.TrimToSizeListener, except
it also initializes empty lists to immutable collection and
uses a more efficient implementation for singletons.
Change-Id: I2cf484654158ce01bb9f7c2ac51a9866f88ae320
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit
acba6c1723f31a8689812cf0bd6f058f688465d3)