code: func (p *Parser) ParseVarRef() (*VarRef, error) {
  	// Parse the segments of the variable ref.
  	segments, err := p.parseSegmentedIdents()
  	if err != nil {
  		return nil, err
  	}
  
  	var dtype DataType
  	if tok, _, _ := p.Scan(); tok == DOUBLECOLON {
  		tok, pos, lit := p.Scan()
  		switch tok {
  		case IDENT:
  			switch strings.ToLower(lit) {
  			case "float":
  				dtype = Float
  			case "integer":
  				dtype = Integer
  			case "unsigned":
  				dtype = Unsigned
  			case "string":
  				dtype = String
  			case "boolean":
  				dtype = Boolean
  			default:
  				return nil, newParseError(tokstr(tok, lit), []string{"float", "integer", "unsigned", "string", "boolean", "field", "tag"}, pos)
  			}
  		case FIELD:
  			dtype = AnyField
  		case TAG:
  			dtype = Tag
  		default:
  			return nil, newParseError(tokstr(tok, lit), []string{"float", "integer", "string", "boolean", "field", "tag"}, pos)
  		}
  	} else {
  		p.Unscan()
  	}
  
  	vr := &VarRef{Val: strings.Join(segments, "."), Type: dtype}
  
  	return vr, nil
  }
docs: // ParseVarRef parses a reference to a measurement or field.