2022-12-27 08:29:42 +00:00
|
|
|
package unstable
|
2022-05-02 13:05:18 +00:00
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
2022-12-27 08:29:42 +00:00
|
|
|
// Kind represents the type of TOML structure contained in a given Node.
|
2022-05-02 13:05:18 +00:00
|
|
|
type Kind int
|
|
|
|
|
|
|
|
const (
|
2022-12-27 08:29:42 +00:00
|
|
|
// Meta
|
2022-05-02 13:05:18 +00:00
|
|
|
Invalid Kind = iota
|
|
|
|
Comment
|
|
|
|
Key
|
|
|
|
|
2022-12-27 08:29:42 +00:00
|
|
|
// Top level structures
|
2022-05-02 13:05:18 +00:00
|
|
|
Table
|
|
|
|
ArrayTable
|
|
|
|
KeyValue
|
|
|
|
|
2022-12-27 08:29:42 +00:00
|
|
|
// Containers values
|
2022-05-02 13:05:18 +00:00
|
|
|
Array
|
|
|
|
InlineTable
|
|
|
|
|
2022-12-27 08:29:42 +00:00
|
|
|
// Values
|
2022-05-02 13:05:18 +00:00
|
|
|
String
|
|
|
|
Bool
|
|
|
|
Float
|
|
|
|
Integer
|
|
|
|
LocalDate
|
|
|
|
LocalTime
|
|
|
|
LocalDateTime
|
|
|
|
DateTime
|
|
|
|
)
|
|
|
|
|
2022-12-27 08:29:42 +00:00
|
|
|
// String implementation of fmt.Stringer.
|
2022-05-02 13:05:18 +00:00
|
|
|
func (k Kind) String() string {
|
|
|
|
switch k {
|
|
|
|
case Invalid:
|
|
|
|
return "Invalid"
|
|
|
|
case Comment:
|
|
|
|
return "Comment"
|
|
|
|
case Key:
|
|
|
|
return "Key"
|
|
|
|
case Table:
|
|
|
|
return "Table"
|
|
|
|
case ArrayTable:
|
|
|
|
return "ArrayTable"
|
|
|
|
case KeyValue:
|
|
|
|
return "KeyValue"
|
|
|
|
case Array:
|
|
|
|
return "Array"
|
|
|
|
case InlineTable:
|
|
|
|
return "InlineTable"
|
|
|
|
case String:
|
|
|
|
return "String"
|
|
|
|
case Bool:
|
|
|
|
return "Bool"
|
|
|
|
case Float:
|
|
|
|
return "Float"
|
|
|
|
case Integer:
|
|
|
|
return "Integer"
|
|
|
|
case LocalDate:
|
|
|
|
return "LocalDate"
|
|
|
|
case LocalTime:
|
|
|
|
return "LocalTime"
|
|
|
|
case LocalDateTime:
|
|
|
|
return "LocalDateTime"
|
|
|
|
case DateTime:
|
|
|
|
return "DateTime"
|
|
|
|
}
|
|
|
|
panic(fmt.Errorf("Kind.String() not implemented for '%d'", k))
|
|
|
|
}
|