code: func ScanDelimited(r io.RuneScanner, start, end rune, escapes map[rune]rune, escapesPassThru bool) ([]byte, error) {
  	// Scan start delimiter.
  	if ch, _, err := r.ReadRune(); err != nil {
  		return nil, err
  	} else if ch != start {
  		return nil, fmt.Errorf("expected %s; found %s", string(start), string(ch))
  	}
  
  	var buf bytes.Buffer
  	for {
  		ch0, _, err := r.ReadRune()
  		if ch0 == end {
  			return buf.Bytes(), nil
  		} else if err != nil {
  			return buf.Bytes(), err
  		} else if ch0 == '\n' {
  			return nil, errors.New("delimited text contains new line")
  		} else if ch0 == '\\' {
  			// If the next character is an escape then write the escaped char.
  			// If it's not a valid escape then return an error.
  			ch1, _, err := r.ReadRune()
  			if err != nil {
  				return nil, err
  			}
  
  			c, ok := escapes[ch1]
  			if !ok {
  				if escapesPassThru {
  					// Unread ch1 (char after the \)
  					_ = r.UnreadRune()
  					// Write ch0 (\) to the output buffer.
  					_, _ = buf.WriteRune(ch0)
  					continue
  				} else {
  					buf.Reset()
  					_, _ = buf.WriteRune(ch0)
  					_, _ = buf.WriteRune(ch1)
  					return buf.Bytes(), errBadEscape
  				}
  			}
  
  			_, _ = buf.WriteRune(c)
  		} else {
  			_, _ = buf.WriteRune(ch0)
  		}
  	}
  }
docs: // ScanDelimited reads a delimited set of runes