code: func (p *parser) parseString() (result string, err error) {
  	i := p.i
  	if len(p.s) < i+2 {
  		return "", errors.New("expected string, found EOF instead")
  	}
  
  	quote := p.s[i]
  	i++
  
  loop:
  	for i < len(p.s) {
  		switch p.s[i] {
  		case '\\':
  			if len(p.s) > i+1 {
  				switch c := p.s[i+1]; c {
  				case '\r':
  					if len(p.s) > i+2 && p.s[i+2] == '\n' {
  						i += 3
  						continue loop
  					}
  					fallthrough
  				case '\n', '\f':
  					i += 2
  					continue loop
  				}
  			}
  			p.i = i
  			val, err := p.parseEscape()
  			if err != nil {
  				return "", err
  			}
  			i = p.i
  			result += val
  		case quote:
  			break loop
  		case '\r', '\n', '\f':
  			return "", errors.New("unexpected end of line in string")
  		default:
  			start := i
  			for i < len(p.s) {
  				if c := p.s[i]; c == quote || c == '\\' || c == '\r' || c == '\n' || c == '\f' {
  					break
  				}
  				i++
  			}
  			result += p.s[start:i]
  		}
  	}
  
  	if i >= len(p.s) {
  		return "", errors.New("EOF in string")
  	}
  
  	// Consume the final quote.
  	i++
  
  	p.i = i
  	return result, nil
  }
docs: // parseString parses a single- or double-quoted string.