code: func decodeDir(data []byte, isRoot bool) (*dir, error) {
  	data = bytes.TrimSpace(data)
  	if len(data) == 0 {
  		return nil, io.EOF
  	}
  
  	// get the name of the dir and remove it from the data.  In case the
  	// there is no name and isRoot is true, just use "" as the name.
  	var name string
  	switch end := bytes.IndexRune(data, dirStartMark); end {
  	case -1:
  		return nil, fmt.Errorf("%c not found", dirStartMark)
  	case 0:
  		if isRoot {
  			name = ""
  		} else {
  			return nil, fmt.Errorf("inner unnamed dirs not allowed: %s", data)
  		}
  	default:
  		name = string(data[0:end])
  		data = data[end:]
  	}
  
  	// check data ends with the dirEndMark
  	if data[len(data)-1] != dirEndMark {
  		return nil, fmt.Errorf("malformed data: last %q not found",
  			dirEndMark)
  	}
  	data = data[1 : len(data)-1] // remove initial '(' and last ')'
  
  	children, err := decodeChildren(data)
  	if err != nil {
  		return nil, err
  	}
  
  	return newDir(name, children)
  }
docs: // Expected data: a fsnoder description, for example: A(foo bar qux ...).
  // When isRoot is true, unnamed dirs are supported, for example: (foo
  // bar qux ...)