at method

*[<Null safety>](*

NodeMatcher at (List<String> path)

Get a NodeMatcher for the node at the given path below this one.

If any step of the path could not be found or is not a node, an error is recorded and an invalid NodeMatcher is returned.


NodeMatcher at(List<String> path) {
  if (!_valid) {
    // No error, it was already recorded by the creation of this.
    return NodeMatcher._invalid(_parent);

  int curIndex = _index;
  for (var p in path) {
    int next = _parent._findNamedValue(p, curIndex);
    if (next == 0) {
      _parent._addError('Cannot find node $p in $path');
      return NodeMatcher._invalid(_parent);
    } else if (, next).type !=
        BlockType.nodeValue) {
      _parent._addError('Value $p in $path found, but it is not a node');
      return NodeMatcher._invalid(_parent);

    curIndex = next;
  return NodeMatcher._valid(_parent, curIndex);