code: func (p *Parser) parseRef() (Revisioner, error) {
  	var tok, prevTok token
  	var lit, buf string
  	var endOfRef bool
  	var err error
  
  	for {
  		tok, lit, err = p.scan()
  
  		if err != nil {
  			return nil, err
  		}
  
  		switch tok {
  		case eof, at, colon, tilde, caret:
  			endOfRef = true
  		}
  
  		err := p.checkRefFormat(tok, lit, prevTok, buf, endOfRef)
  
  		if err != nil {
  			return "", err
  		}
  
  		if endOfRef {
  			p.unscan()
  			return Ref(buf), nil
  		}
  
  		buf += lit
  		prevTok = tok
  	}
  }
docs: // parseRef extract reference name