| 169 | } |
| 170 | |
| 171 | func (t *thread) PopString() (string, error) { |
| 172 | val := t.Pop() |
| 173 | switch n := val.(type) { |
| 174 | case string: |
| 175 | return n, nil |
| 176 | case float64: |
| 177 | return strconv.FormatFloat(n, 'G', -1, 64), nil |
| 178 | case int: |
| 179 | return strconv.Itoa(n), nil |
| 180 | case int64: |
| 181 | return strconv.FormatInt(n, 10), nil |
| 182 | case datum.Datum: |
| 183 | return datum.GetString(n), nil |
| 184 | } |
| 185 | return "", errors.Errorf("unexpected type for string %T %q", val, val) |
| 186 | } |
| 187 | |
| 188 | func compareInt(a, b int64, opnd int) (bool, error) { |
| 189 | switch opnd { |