code: func (expr *Expr) Compare(other *Expr) int {
  
  	if expr == nil {
  		if other == nil {
  			return 0
  		}
  		return -1
  	} else if other == nil {
  		return 1
  	}
  
  	switch {
  	case expr.Index < other.Index:
  		return -1
  	case expr.Index > other.Index:
  		return 1
  	}
  
  	switch {
  	case expr.Negated && !other.Negated:
  		return 1
  	case !expr.Negated && other.Negated:
  		return -1
  	}
  
  	switch t := expr.Terms.(type) {
  	case *Term:
  		u, ok := other.Terms.(*Term)
  		if !ok {
  			return -1
  		}
  		if cmp := Compare(t.Value, u.Value); cmp != 0 {
  			return cmp
  		}
  	case []*Term:
  		u, ok := other.Terms.([]*Term)
  		if !ok {
  			return 1
  		}
  		if cmp := termSliceCompare(t, u); cmp != 0 {
  			return cmp
  		}
  	}
  
  	return withSliceCompare(expr.With, other.With)
  }
docs: // Compare returns an integer indicating whether expr is less than, equal to,
  // or greater than other.
  //
  // Expressions are compared as follows:
  //
  // 1. Preceding expression (by Index) is always less than the other expression.
  // 2. Non-negated expressions are always less than than negated expressions.
  // 3. Single term expressions are always less than built-in expressions.
  //
  // Otherwise, the expression terms are compared normally. If both expressions
  // have the same terms, the modifiers are compared.