code: func ParseRef(traversal hcl.Traversal) (*Reference, tfdiags.Diagnostics) {
  	ref, diags := parseRef(traversal)
  
  	// Normalize a little to make life easier for callers.
  	if ref != nil {
  		if len(ref.Remaining) == 0 {
  			ref.Remaining = nil
  		}
  	}
  
  	return ref, diags
  }
docs: // ParseRef attempts to extract a referencable address from the prefix of the
  // given traversal, which must be an absolute traversal or this function
  // will panic.
  //
  // If no error diagnostics are returned, the returned reference includes the
  // address that was extracted, the source range it was extracted from, and any
  // remaining relative traversal that was not consumed as part of the
  // reference.
  //
  // If error diagnostics are returned then the Reference value is invalid and
  // must not be used.