unreadToValid method

SymbolNode unreadToValid(
  1. IScanner scanner
)

Unwind to a valid node; this node is "valid" if its ancestry represents a complete symbol. If this node is not valid, put back the character and ask the parent to unwind.

  • scanner scanner Returns symbol’s node

Implementation

SymbolNode unreadToValid(IScanner scanner) {
  if (!_valid && _parent != null) {
    scanner.unread();
    return _parent!.unreadToValid(scanner);
  }
  return this;
}