Avoid null reference when processing element lookup.
Avoid another null reference.
Build null nodes if selections are empty.

Otherwise, this will propagate an exception.
Use function to build AST node.
Use AddRange instead of ForEach.