author | Mikael Berthe <mikael@lilotux.net> |
Sat, 04 Feb 2023 12:58:35 +0100 | |
changeset 265 | 05c40b36d3b2 |
parent 260 | vendor/github.com/pelletier/go-toml/v2/internal/ast/kind.go@445e01aede7e |
child 268 | 4dd196a4ee7c |
permissions | -rw-r--r-- |
265
05c40b36d3b2
Bump to version 3.0.0-dev, using madon v3
Mikael Berthe <mikael@lilotux.net>
parents:
260
diff
changeset
|
1 |
package unstable |
260 | 2 |
|
3 |
import "fmt" |
|
4 |
||
265
05c40b36d3b2
Bump to version 3.0.0-dev, using madon v3
Mikael Berthe <mikael@lilotux.net>
parents:
260
diff
changeset
|
5 |
// Kind represents the type of TOML structure contained in a given Node. |
260 | 6 |
type Kind int |
7 |
||
8 |
const ( |
|
265
05c40b36d3b2
Bump to version 3.0.0-dev, using madon v3
Mikael Berthe <mikael@lilotux.net>
parents:
260
diff
changeset
|
9 |
// Meta |
260 | 10 |
Invalid Kind = iota |
11 |
Comment |
|
12 |
Key |
|
13 |
||
265
05c40b36d3b2
Bump to version 3.0.0-dev, using madon v3
Mikael Berthe <mikael@lilotux.net>
parents:
260
diff
changeset
|
14 |
// Top level structures |
260 | 15 |
Table |
16 |
ArrayTable |
|
17 |
KeyValue |
|
18 |
||
265
05c40b36d3b2
Bump to version 3.0.0-dev, using madon v3
Mikael Berthe <mikael@lilotux.net>
parents:
260
diff
changeset
|
19 |
// Containers values |
260 | 20 |
Array |
21 |
InlineTable |
|
22 |
||
265
05c40b36d3b2
Bump to version 3.0.0-dev, using madon v3
Mikael Berthe <mikael@lilotux.net>
parents:
260
diff
changeset
|
23 |
// Values |
260 | 24 |
String |
25 |
Bool |
|
26 |
Float |
|
27 |
Integer |
|
28 |
LocalDate |
|
29 |
LocalTime |
|
30 |
LocalDateTime |
|
31 |
DateTime |
|
32 |
) |
|
33 |
||
265
05c40b36d3b2
Bump to version 3.0.0-dev, using madon v3
Mikael Berthe <mikael@lilotux.net>
parents:
260
diff
changeset
|
34 |
// String implementation of fmt.Stringer. |
260 | 35 |
func (k Kind) String() string { |
36 |
switch k { |
|
37 |
case Invalid: |
|
38 |
return "Invalid" |
|
39 |
case Comment: |
|
40 |
return "Comment" |
|
41 |
case Key: |
|
42 |
return "Key" |
|
43 |
case Table: |
|
44 |
return "Table" |
|
45 |
case ArrayTable: |
|
46 |
return "ArrayTable" |
|
47 |
case KeyValue: |
|
48 |
return "KeyValue" |
|
49 |
case Array: |
|
50 |
return "Array" |
|
51 |
case InlineTable: |
|
52 |
return "InlineTable" |
|
53 |
case String: |
|
54 |
return "String" |
|
55 |
case Bool: |
|
56 |
return "Bool" |
|
57 |
case Float: |
|
58 |
return "Float" |
|
59 |
case Integer: |
|
60 |
return "Integer" |
|
61 |
case LocalDate: |
|
62 |
return "LocalDate" |
|
63 |
case LocalTime: |
|
64 |
return "LocalTime" |
|
65 |
case LocalDateTime: |
|
66 |
return "LocalDateTime" |
|
67 |
case DateTime: |
|
68 |
return "DateTime" |
|
69 |
} |
|
70 |
panic(fmt.Errorf("Kind.String() not implemented for '%d'", k)) |
|
71 |
} |