Add test of parsing resource override.

This also adds tree dump and factory for resource overrides.
Add test for parsing virtual and exported resources.
Add collect query parsing precedence tests.

This commit also corrects the grammar to benefit from the existing
operators and their precedence. (It was done the wrong way before this
commit). 
The grammar for the query/predicate expressions also have renamed
rules and simplification.