aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/BurntSushi/toml
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/BurntSushi/toml')
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/example.go61
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/example.toml35
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/hard.toml22
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/implicit.toml4
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/invalid-apples.toml6
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/invalid.toml35
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/readme1.toml5
-rw-r--r--vendor/github.com/BurntSushi/toml/_examples/readme2.toml1
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING14
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/README.md13
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/main.go90
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING14
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/README.md13
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/main.go131
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/tomlv/COPYING14
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/tomlv/README.md21
-rw-r--r--vendor/github.com/BurntSushi/toml/cmd/tomlv/main.go61
17 files changed, 0 insertions, 540 deletions
diff --git a/vendor/github.com/BurntSushi/toml/_examples/example.go b/vendor/github.com/BurntSushi/toml/_examples/example.go
deleted file mode 100644
index 79f31f2..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/example.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package main
-
-import (
- "fmt"
- "time"
-
- "github.com/BurntSushi/toml"
-)
-
-type tomlConfig struct {
- Title string
- Owner ownerInfo
- DB database `toml:"database"`
- Servers map[string]server
- Clients clients
-}
-
-type ownerInfo struct {
- Name string
- Org string `toml:"organization"`
- Bio string
- DOB time.Time
-}
-
-type database struct {
- Server string
- Ports []int
- ConnMax int `toml:"connection_max"`
- Enabled bool
-}
-
-type server struct {
- IP string
- DC string
-}
-
-type clients struct {
- Data [][]interface{}
- Hosts []string
-}
-
-func main() {
- var config tomlConfig
- if _, err := toml.DecodeFile("example.toml", &config); err != nil {
- fmt.Println(err)
- return
- }
-
- fmt.Printf("Title: %s\n", config.Title)
- fmt.Printf("Owner: %s (%s, %s), Born: %s\n",
- config.Owner.Name, config.Owner.Org, config.Owner.Bio,
- config.Owner.DOB)
- fmt.Printf("Database: %s %v (Max conn. %d), Enabled? %v\n",
- config.DB.Server, config.DB.Ports, config.DB.ConnMax,
- config.DB.Enabled)
- for serverName, server := range config.Servers {
- fmt.Printf("Server: %s (%s, %s)\n", serverName, server.IP, server.DC)
- }
- fmt.Printf("Client data: %v\n", config.Clients.Data)
- fmt.Printf("Client hosts: %v\n", config.Clients.Hosts)
-}
diff --git a/vendor/github.com/BurntSushi/toml/_examples/example.toml b/vendor/github.com/BurntSushi/toml/_examples/example.toml
deleted file mode 100644
index 32c7a4f..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/example.toml
+++ /dev/null
@@ -1,35 +0,0 @@
-# This is a TOML document. Boom.
-
-title = "TOML Example"
-
-[owner]
-name = "Tom Preston-Werner"
-organization = "GitHub"
-bio = "GitHub Cofounder & CEO\nLikes tater tots and beer."
-dob = 1979-05-27T07:32:00Z # First class dates? Why not?
-
-[database]
-server = "192.168.1.1"
-ports = [ 8001, 8001, 8002 ]
-connection_max = 5000
-enabled = true
-
-[servers]
-
- # You can indent as you please. Tabs or spaces. TOML don't care.
- [servers.alpha]
- ip = "10.0.0.1"
- dc = "eqdc10"
-
- [servers.beta]
- ip = "10.0.0.2"
- dc = "eqdc10"
-
-[clients]
-data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it
-
-# Line breaks are OK when inside arrays
-hosts = [
- "alpha",
- "omega"
-]
diff --git a/vendor/github.com/BurntSushi/toml/_examples/hard.toml b/vendor/github.com/BurntSushi/toml/_examples/hard.toml
deleted file mode 100644
index 26145d2..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/hard.toml
+++ /dev/null
@@ -1,22 +0,0 @@
-# Test file for TOML
-# Only this one tries to emulate a TOML file written by a user of the kind of parser writers probably hate
-# This part you'll really hate
-
-[the]
-test_string = "You'll hate me after this - #" # " Annoying, isn't it?
-
- [the.hard]
- test_array = [ "] ", " # "] # ] There you go, parse this!
- test_array2 = [ "Test #11 ]proved that", "Experiment #9 was a success" ]
- # You didn't think it'd as easy as chucking out the last #, did you?
- another_test_string = " Same thing, but with a string #"
- harder_test_string = " And when \"'s are in the string, along with # \"" # "and comments are there too"
- # Things will get harder
-
- [the.hard.bit#]
- what? = "You don't think some user won't do that?"
- multi_line_array = [
- "]",
- # ] Oh yes I did
- ]
-
diff --git a/vendor/github.com/BurntSushi/toml/_examples/implicit.toml b/vendor/github.com/BurntSushi/toml/_examples/implicit.toml
deleted file mode 100644
index 1dea5ce..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/implicit.toml
+++ /dev/null
@@ -1,4 +0,0 @@
-# [x] you
-# [x.y] don't
-# [x.y.z] need these
-[x.y.z.w] # for this to work
diff --git a/vendor/github.com/BurntSushi/toml/_examples/invalid-apples.toml b/vendor/github.com/BurntSushi/toml/_examples/invalid-apples.toml
deleted file mode 100644
index 74e9e33..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/invalid-apples.toml
+++ /dev/null
@@ -1,6 +0,0 @@
-# DO NOT WANT
-[fruit]
-type = "apple"
-
-[fruit.type]
-apple = "yes"
diff --git a/vendor/github.com/BurntSushi/toml/_examples/invalid.toml b/vendor/github.com/BurntSushi/toml/_examples/invalid.toml
deleted file mode 100644
index beb1dba..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/invalid.toml
+++ /dev/null
@@ -1,35 +0,0 @@
-# This is an INVALID TOML document. Boom.
-# Can you spot the error without help?
-
-title = "TOML Example"
-
-[owner]
-name = "Tom Preston-Werner"
-organization = "GitHub"
-bio = "GitHub Cofounder & CEO\nLikes tater tots and beer."
-dob = 1979-05-27T7:32:00Z # First class dates? Why not?
-
-[database]
-server = "192.168.1.1"
-ports = [ 8001, 8001, 8002 ]
-connection_max = 5000
-enabled = true
-
-[servers]
- # You can indent as you please. Tabs or spaces. TOML don't care.
- [servers.alpha]
- ip = "10.0.0.1"
- dc = "eqdc10"
-
- [servers.beta]
- ip = "10.0.0.2"
- dc = "eqdc10"
-
-[clients]
-data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it
-
-# Line breaks are OK when inside arrays
-hosts = [
- "alpha",
- "omega"
-]
diff --git a/vendor/github.com/BurntSushi/toml/_examples/readme1.toml b/vendor/github.com/BurntSushi/toml/_examples/readme1.toml
deleted file mode 100644
index 3e1261d..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/readme1.toml
+++ /dev/null
@@ -1,5 +0,0 @@
-Age = 25
-Cats = [ "Cauchy", "Plato" ]
-Pi = 3.14
-Perfection = [ 6, 28, 496, 8128 ]
-DOB = 1987-07-05T05:45:00Z
diff --git a/vendor/github.com/BurntSushi/toml/_examples/readme2.toml b/vendor/github.com/BurntSushi/toml/_examples/readme2.toml
deleted file mode 100644
index b51cd93..0000000
--- a/vendor/github.com/BurntSushi/toml/_examples/readme2.toml
+++ /dev/null
@@ -1 +0,0 @@
-some_key_NAME = "wat"
diff --git a/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING b/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING
deleted file mode 100644
index 5a8e332..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/COPYING
+++ /dev/null
@@ -1,14 +0,0 @@
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- Version 2, December 2004
-
- Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
-
- Everyone is permitted to copy and distribute verbatim or modified
- copies of this license document, and changing it is allowed as long
- as the name is changed.
-
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. You just DO WHAT THE FUCK YOU WANT TO.
-
diff --git a/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/README.md b/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/README.md
deleted file mode 100644
index 93f4e3a..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Implements the TOML test suite interface
-
-This is an implementation of the interface expected by
-[toml-test](https://github.com/BurntSushi/toml-test) for my
-[toml parser written in Go](https://github.com/BurntSushi/toml).
-In particular, it maps TOML data on `stdin` to a JSON format on `stdout`.
-
-
-Compatible with TOML version
-[v0.4.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md)
-
-Compatible with `toml-test` version
-[v0.2.0](https://github.com/BurntSushi/toml-test/tree/v0.2.0)
diff --git a/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/main.go b/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/main.go
deleted file mode 100644
index 14e7557..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/toml-test-decoder/main.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// Command toml-test-decoder satisfies the toml-test interface for testing
-// TOML decoders. Namely, it accepts TOML on stdin and outputs JSON on stdout.
-package main
-
-import (
- "encoding/json"
- "flag"
- "fmt"
- "log"
- "os"
- "path"
- "time"
-
- "github.com/BurntSushi/toml"
-)
-
-func init() {
- log.SetFlags(0)
-
- flag.Usage = usage
- flag.Parse()
-}
-
-func usage() {
- log.Printf("Usage: %s < toml-file\n", path.Base(os.Args[0]))
- flag.PrintDefaults()
-
- os.Exit(1)
-}
-
-func main() {
- if flag.NArg() != 0 {
- flag.Usage()
- }
-
- var tmp interface{}
- if _, err := toml.DecodeReader(os.Stdin, &tmp); err != nil {
- log.Fatalf("Error decoding TOML: %s", err)
- }
-
- typedTmp := translate(tmp)
- if err := json.NewEncoder(os.Stdout).Encode(typedTmp); err != nil {
- log.Fatalf("Error encoding JSON: %s", err)
- }
-}
-
-func translate(tomlData interface{}) interface{} {
- switch orig := tomlData.(type) {
- case map[string]interface{}:
- typed := make(map[string]interface{}, len(orig))
- for k, v := range orig {
- typed[k] = translate(v)
- }
- return typed
- case []map[string]interface{}:
- typed := make([]map[string]interface{}, len(orig))
- for i, v := range orig {
- typed[i] = translate(v).(map[string]interface{})
- }
- return typed
- case []interface{}:
- typed := make([]interface{}, len(orig))
- for i, v := range orig {
- typed[i] = translate(v)
- }
-
- // We don't really need to tag arrays, but let's be future proof.
- // (If TOML ever supports tuples, we'll need this.)
- return tag("array", typed)
- case time.Time:
- return tag("datetime", orig.Format("2006-01-02T15:04:05Z"))
- case bool:
- return tag("bool", fmt.Sprintf("%v", orig))
- case int64:
- return tag("integer", fmt.Sprintf("%d", orig))
- case float64:
- return tag("float", fmt.Sprintf("%v", orig))
- case string:
- return tag("string", orig)
- }
-
- panic(fmt.Sprintf("Unknown type: %T", tomlData))
-}
-
-func tag(typeName string, data interface{}) map[string]interface{} {
- return map[string]interface{}{
- "type": typeName,
- "value": data,
- }
-}
diff --git a/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING b/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING
deleted file mode 100644
index 5a8e332..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/COPYING
+++ /dev/null
@@ -1,14 +0,0 @@
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- Version 2, December 2004
-
- Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
-
- Everyone is permitted to copy and distribute verbatim or modified
- copies of this license document, and changing it is allowed as long
- as the name is changed.
-
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. You just DO WHAT THE FUCK YOU WANT TO.
-
diff --git a/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/README.md b/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/README.md
deleted file mode 100644
index a45bd4d..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Implements the TOML test suite interface for TOML encoders
-
-This is an implementation of the interface expected by
-[toml-test](https://github.com/BurntSushi/toml-test) for the
-[TOML encoder](https://github.com/BurntSushi/toml).
-In particular, it maps JSON data on `stdin` to a TOML format on `stdout`.
-
-
-Compatible with TOML version
-[v0.4.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md)
-
-Compatible with `toml-test` version
-[v0.2.0](https://github.com/BurntSushi/toml-test/tree/v0.2.0)
diff --git a/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/main.go b/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/main.go
deleted file mode 100644
index 092cc68..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/toml-test-encoder/main.go
+++ /dev/null
@@ -1,131 +0,0 @@
-// Command toml-test-encoder satisfies the toml-test interface for testing
-// TOML encoders. Namely, it accepts JSON on stdin and outputs TOML on stdout.
-package main
-
-import (
- "encoding/json"
- "flag"
- "log"
- "os"
- "path"
- "strconv"
- "time"
-
- "github.com/BurntSushi/toml"
-)
-
-func init() {
- log.SetFlags(0)
-
- flag.Usage = usage
- flag.Parse()
-}
-
-func usage() {
- log.Printf("Usage: %s < json-file\n", path.Base(os.Args[0]))
- flag.PrintDefaults()
-
- os.Exit(1)
-}
-
-func main() {
- if flag.NArg() != 0 {
- flag.Usage()
- }
-
- var tmp interface{}
- if err := json.NewDecoder(os.Stdin).Decode(&tmp); err != nil {
- log.Fatalf("Error decoding JSON: %s", err)
- }
-
- tomlData := translate(tmp)
- if err := toml.NewEncoder(os.Stdout).Encode(tomlData); err != nil {
- log.Fatalf("Error encoding TOML: %s", err)
- }
-}
-
-func translate(typedJson interface{}) interface{} {
- switch v := typedJson.(type) {
- case map[string]interface{}:
- if len(v) == 2 && in("type", v) && in("value", v) {
- return untag(v)
- }
- m := make(map[string]interface{}, len(v))
- for k, v2 := range v {
- m[k] = translate(v2)
- }
- return m
- case []interface{}:
- tabArray := make([]map[string]interface{}, len(v))
- for i := range v {
- if m, ok := translate(v[i]).(map[string]interface{}); ok {
- tabArray[i] = m
- } else {
- log.Fatalf("JSON arrays may only contain objects. This " +
- "corresponds to only tables being allowed in " +
- "TOML table arrays.")
- }
- }
- return tabArray
- }
- log.Fatalf("Unrecognized JSON format '%T'.", typedJson)
- panic("unreachable")
-}
-
-func untag(typed map[string]interface{}) interface{} {
- t := typed["type"].(string)
- v := typed["value"]
- switch t {
- case "string":
- return v.(string)
- case "integer":
- v := v.(string)
- n, err := strconv.Atoi(v)
- if err != nil {
- log.Fatalf("Could not parse '%s' as integer: %s", v, err)
- }
- return n
- case "float":
- v := v.(string)
- f, err := strconv.ParseFloat(v, 64)
- if err != nil {
- log.Fatalf("Could not parse '%s' as float64: %s", v, err)
- }
- return f
- case "datetime":
- v := v.(string)
- t, err := time.Parse("2006-01-02T15:04:05Z", v)
- if err != nil {
- log.Fatalf("Could not parse '%s' as a datetime: %s", v, err)
- }
- return t
- case "bool":
- v := v.(string)
- switch v {
- case "true":
- return true
- case "false":
- return false
- }
- log.Fatalf("Could not parse '%s' as a boolean.", v)
- case "array":
- v := v.([]interface{})
- array := make([]interface{}, len(v))
- for i := range v {
- if m, ok := v[i].(map[string]interface{}); ok {
- array[i] = untag(m)
- } else {
- log.Fatalf("Arrays may only contain other arrays or "+
- "primitive values, but found a '%T'.", m)
- }
- }
- return array
- }
- log.Fatalf("Unrecognized tag type '%s'.", t)
- panic("unreachable")
-}
-
-func in(key string, m map[string]interface{}) bool {
- _, ok := m[key]
- return ok
-}
diff --git a/vendor/github.com/BurntSushi/toml/cmd/tomlv/COPYING b/vendor/github.com/BurntSushi/toml/cmd/tomlv/COPYING
deleted file mode 100644
index 5a8e332..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/tomlv/COPYING
+++ /dev/null
@@ -1,14 +0,0 @@
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- Version 2, December 2004
-
- Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
-
- Everyone is permitted to copy and distribute verbatim or modified
- copies of this license document, and changing it is allowed as long
- as the name is changed.
-
- DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. You just DO WHAT THE FUCK YOU WANT TO.
-
diff --git a/vendor/github.com/BurntSushi/toml/cmd/tomlv/README.md b/vendor/github.com/BurntSushi/toml/cmd/tomlv/README.md
deleted file mode 100644
index 51231e2..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/tomlv/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# TOML Validator
-
-If Go is installed, it's simple to try it out:
-
-```bash
-go get github.com/BurntSushi/toml/cmd/tomlv
-tomlv some-toml-file.toml
-```
-
-You can see the types of every key in a TOML file with:
-
-```bash
-tomlv -types some-toml-file.toml
-```
-
-At the moment, only one error message is reported at a time. Error messages
-include line numbers. No output means that the files given are valid TOML, or
-there is a bug in `tomlv`.
-
-Compatible with TOML version
-[v0.4.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md)
diff --git a/vendor/github.com/BurntSushi/toml/cmd/tomlv/main.go b/vendor/github.com/BurntSushi/toml/cmd/tomlv/main.go
deleted file mode 100644
index c7d689a..0000000
--- a/vendor/github.com/BurntSushi/toml/cmd/tomlv/main.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Command tomlv validates TOML documents and prints each key's type.
-package main
-
-import (
- "flag"
- "fmt"
- "log"
- "os"
- "path"
- "strings"
- "text/tabwriter"
-
- "github.com/BurntSushi/toml"
-)
-
-var (
- flagTypes = false
-)
-
-func init() {
- log.SetFlags(0)
-
- flag.BoolVar(&flagTypes, "types", flagTypes,
- "When set, the types of every defined key will be shown.")
-
- flag.Usage = usage
- flag.Parse()
-}
-
-func usage() {
- log.Printf("Usage: %s toml-file [ toml-file ... ]\n",
- path.Base(os.Args[0]))
- flag.PrintDefaults()
-
- os.Exit(1)
-}
-
-func main() {
- if flag.NArg() < 1 {
- flag.Usage()
- }
- for _, f := range flag.Args() {
- var tmp interface{}
- md, err := toml.DecodeFile(f, &tmp)
- if err != nil {
- log.Fatalf("Error in '%s': %s", f, err)
- }
- if flagTypes {
- printTypes(md)
- }
- }
-}
-
-func printTypes(md toml.MetaData) {
- tabw := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- for _, key := range md.Keys() {
- fmt.Fprintf(tabw, "%s%s\t%s\n",
- strings.Repeat(" ", len(key)-1), key, md.Type(key...))
- }
- tabw.Flush()
-}