Implement collection parse caching

Uses the ctx table to cache the results of _parse_collection. The
cache key is a concatenation of the rule var type, and the var opts
table values. If the var has no opts, the var type is used
exclusively.

Because _parse_collection can return nil, separate keys are created
in the ctx table to track cache status and parse results.