You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/03/15 01:27:17 UTC
[41/50] [abbrv] incubator-mynewt-newt git commit: Add static Godeps
for newt repo.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/scanner/scanner_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/scanner/scanner_test.go b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/scanner/scanner_test.go
new file mode 100644
index 0000000..fe2d755
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/scanner/scanner_test.go
@@ -0,0 +1,363 @@
+package scanner
+
+import (
+ "bytes"
+ "fmt"
+ "testing"
+
+ "github.com/hashicorp/hcl/json/token"
+)
+
+var f100 = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+
+type tokenPair struct {
+ tok token.Type
+ text string
+}
+
+var tokenLists = map[string][]tokenPair{
+ "operator": []tokenPair{
+ {token.LBRACK, "["},
+ {token.LBRACE, "{"},
+ {token.COMMA, ","},
+ {token.PERIOD, "."},
+ {token.RBRACK, "]"},
+ {token.RBRACE, "}"},
+ },
+ "bool": []tokenPair{
+ {token.BOOL, "true"},
+ {token.BOOL, "false"},
+ },
+ "string": []tokenPair{
+ {token.STRING, `" "`},
+ {token.STRING, `"a"`},
+ {token.STRING, `"本"`},
+ {token.STRING, `"${file("foo")}"`},
+ {token.STRING, `"${file(\"foo\")}"`},
+ {token.STRING, `"\a"`},
+ {token.STRING, `"\b"`},
+ {token.STRING, `"\f"`},
+ {token.STRING, `"\n"`},
+ {token.STRING, `"\r"`},
+ {token.STRING, `"\t"`},
+ {token.STRING, `"\v"`},
+ {token.STRING, `"\""`},
+ {token.STRING, `"\000"`},
+ {token.STRING, `"\777"`},
+ {token.STRING, `"\x00"`},
+ {token.STRING, `"\xff"`},
+ {token.STRING, `"\u0000"`},
+ {token.STRING, `"\ufA16"`},
+ {token.STRING, `"\U00000000"`},
+ {token.STRING, `"\U0000ffAB"`},
+ {token.STRING, `"` + f100 + `"`},
+ },
+ "number": []tokenPair{
+ {token.NUMBER, "0"},
+ {token.NUMBER, "1"},
+ {token.NUMBER, "9"},
+ {token.NUMBER, "42"},
+ {token.NUMBER, "1234567890"},
+ {token.NUMBER, "-0"},
+ {token.NUMBER, "-1"},
+ {token.NUMBER, "-9"},
+ {token.NUMBER, "-42"},
+ {token.NUMBER, "-1234567890"},
+ },
+ "float": []tokenPair{
+ {token.FLOAT, "0."},
+ {token.FLOAT, "1."},
+ {token.FLOAT, "42."},
+ {token.FLOAT, "01234567890."},
+ {token.FLOAT, ".0"},
+ {token.FLOAT, ".1"},
+ {token.FLOAT, ".42"},
+ {token.FLOAT, ".0123456789"},
+ {token.FLOAT, "0.0"},
+ {token.FLOAT, "1.0"},
+ {token.FLOAT, "42.0"},
+ {token.FLOAT, "01234567890.0"},
+ {token.FLOAT, "0e0"},
+ {token.FLOAT, "1e0"},
+ {token.FLOAT, "42e0"},
+ {token.FLOAT, "01234567890e0"},
+ {token.FLOAT, "0E0"},
+ {token.FLOAT, "1E0"},
+ {token.FLOAT, "42E0"},
+ {token.FLOAT, "01234567890E0"},
+ {token.FLOAT, "0e+10"},
+ {token.FLOAT, "1e-10"},
+ {token.FLOAT, "42e+10"},
+ {token.FLOAT, "01234567890e-10"},
+ {token.FLOAT, "0E+10"},
+ {token.FLOAT, "1E-10"},
+ {token.FLOAT, "42E+10"},
+ {token.FLOAT, "01234567890E-10"},
+ {token.FLOAT, "01.8e0"},
+ {token.FLOAT, "1.4e0"},
+ {token.FLOAT, "42.2e0"},
+ {token.FLOAT, "01234567890.12e0"},
+ {token.FLOAT, "0.E0"},
+ {token.FLOAT, "1.12E0"},
+ {token.FLOAT, "42.123E0"},
+ {token.FLOAT, "01234567890.213E0"},
+ {token.FLOAT, "0.2e+10"},
+ {token.FLOAT, "1.2e-10"},
+ {token.FLOAT, "42.54e+10"},
+ {token.FLOAT, "01234567890.98e-10"},
+ {token.FLOAT, "0.1E+10"},
+ {token.FLOAT, "1.1E-10"},
+ {token.FLOAT, "42.1E+10"},
+ {token.FLOAT, "01234567890.1E-10"},
+ {token.FLOAT, "-0.0"},
+ {token.FLOAT, "-1.0"},
+ {token.FLOAT, "-42.0"},
+ {token.FLOAT, "-01234567890.0"},
+ {token.FLOAT, "-0e0"},
+ {token.FLOAT, "-1e0"},
+ {token.FLOAT, "-42e0"},
+ {token.FLOAT, "-01234567890e0"},
+ {token.FLOAT, "-0E0"},
+ {token.FLOAT, "-1E0"},
+ {token.FLOAT, "-42E0"},
+ {token.FLOAT, "-01234567890E0"},
+ {token.FLOAT, "-0e+10"},
+ {token.FLOAT, "-1e-10"},
+ {token.FLOAT, "-42e+10"},
+ {token.FLOAT, "-01234567890e-10"},
+ {token.FLOAT, "-0E+10"},
+ {token.FLOAT, "-1E-10"},
+ {token.FLOAT, "-42E+10"},
+ {token.FLOAT, "-01234567890E-10"},
+ {token.FLOAT, "-01.8e0"},
+ {token.FLOAT, "-1.4e0"},
+ {token.FLOAT, "-42.2e0"},
+ {token.FLOAT, "-01234567890.12e0"},
+ {token.FLOAT, "-0.E0"},
+ {token.FLOAT, "-1.12E0"},
+ {token.FLOAT, "-42.123E0"},
+ {token.FLOAT, "-01234567890.213E0"},
+ {token.FLOAT, "-0.2e+10"},
+ {token.FLOAT, "-1.2e-10"},
+ {token.FLOAT, "-42.54e+10"},
+ {token.FLOAT, "-01234567890.98e-10"},
+ {token.FLOAT, "-0.1E+10"},
+ {token.FLOAT, "-1.1E-10"},
+ {token.FLOAT, "-42.1E+10"},
+ {token.FLOAT, "-01234567890.1E-10"},
+ },
+}
+
+var orderedTokenLists = []string{
+ "comment",
+ "operator",
+ "bool",
+ "string",
+ "number",
+ "float",
+}
+
+func TestPosition(t *testing.T) {
+ // create artifical source code
+ buf := new(bytes.Buffer)
+
+ for _, listName := range orderedTokenLists {
+ for _, ident := range tokenLists[listName] {
+ fmt.Fprintf(buf, "\t\t\t\t%s\n", ident.text)
+ }
+ }
+
+ s := New(buf.Bytes())
+
+ pos := token.Pos{"", 4, 1, 5}
+ s.Scan()
+ for _, listName := range orderedTokenLists {
+
+ for _, k := range tokenLists[listName] {
+ curPos := s.tokPos
+ // fmt.Printf("[%q] s = %+v:%+v\n", k.text, curPos.Offset, curPos.Column)
+
+ if curPos.Offset != pos.Offset {
+ t.Fatalf("offset = %d, want %d for %q", curPos.Offset, pos.Offset, k.text)
+ }
+ if curPos.Line != pos.Line {
+ t.Fatalf("line = %d, want %d for %q", curPos.Line, pos.Line, k.text)
+ }
+ if curPos.Column != pos.Column {
+ t.Fatalf("column = %d, want %d for %q", curPos.Column, pos.Column, k.text)
+ }
+ pos.Offset += 4 + len(k.text) + 1 // 4 tabs + token bytes + newline
+ pos.Line += countNewlines(k.text) + 1 // each token is on a new line
+
+ s.Error = func(pos token.Pos, msg string) {
+ t.Errorf("error %q for %q", msg, k.text)
+ }
+
+ s.Scan()
+ }
+ }
+ // make sure there were no token-internal errors reported by scanner
+ if s.ErrorCount != 0 {
+ t.Errorf("%d errors", s.ErrorCount)
+ }
+}
+
+func TestComment(t *testing.T) {
+ testTokenList(t, tokenLists["comment"])
+}
+
+func TestOperator(t *testing.T) {
+ testTokenList(t, tokenLists["operator"])
+}
+
+func TestBool(t *testing.T) {
+ testTokenList(t, tokenLists["bool"])
+}
+
+func TestIdent(t *testing.T) {
+ testTokenList(t, tokenLists["ident"])
+}
+
+func TestString(t *testing.T) {
+ testTokenList(t, tokenLists["string"])
+}
+
+func TestNumber(t *testing.T) {
+ testTokenList(t, tokenLists["number"])
+}
+
+func TestFloat(t *testing.T) {
+ testTokenList(t, tokenLists["float"])
+}
+
+func TestRealExample(t *testing.T) {
+ complexReal := `
+{
+ "variable": {
+ "foo": {
+ "default": "bar",
+ "description": "bar",
+ "depends_on": ["something"]
+ }
+ }
+}`
+
+ literals := []struct {
+ tokenType token.Type
+ literal string
+ }{
+ {token.LBRACE, `{`},
+ {token.STRING, `"variable"`},
+ {token.COLON, `:`},
+ {token.LBRACE, `{`},
+ {token.STRING, `"foo"`},
+ {token.COLON, `:`},
+ {token.LBRACE, `{`},
+ {token.STRING, `"default"`},
+ {token.COLON, `:`},
+ {token.STRING, `"bar"`},
+ {token.COMMA, `,`},
+ {token.STRING, `"description"`},
+ {token.COLON, `:`},
+ {token.STRING, `"bar"`},
+ {token.COMMA, `,`},
+ {token.STRING, `"depends_on"`},
+ {token.COLON, `:`},
+ {token.LBRACK, `[`},
+ {token.STRING, `"something"`},
+ {token.RBRACK, `]`},
+ {token.RBRACE, `}`},
+ {token.RBRACE, `}`},
+ {token.RBRACE, `}`},
+ {token.EOF, ``},
+ }
+
+ s := New([]byte(complexReal))
+ for _, l := range literals {
+ tok := s.Scan()
+ if l.tokenType != tok.Type {
+ t.Errorf("got: %s want %s for %s\n", tok, l.tokenType, tok.String())
+ }
+
+ if l.literal != tok.Text {
+ t.Errorf("got: %s want %s\n", tok, l.literal)
+ }
+ }
+
+}
+
+func TestError(t *testing.T) {
+ testError(t, "\x80", "1:1", "illegal UTF-8 encoding", token.ILLEGAL)
+ testError(t, "\xff", "1:1", "illegal UTF-8 encoding", token.ILLEGAL)
+
+ testError(t, `"ab`+"\x80", "1:4", "illegal UTF-8 encoding", token.STRING)
+ testError(t, `"abc`+"\xff", "1:5", "illegal UTF-8 encoding", token.STRING)
+
+ testError(t, `01238`, "1:7", "numbers cannot start with 0", token.NUMBER)
+ testError(t, `01238123`, "1:10", "numbers cannot start with 0", token.NUMBER)
+ testError(t, `'aa'`, "1:1", "illegal char: '", token.ILLEGAL)
+
+ testError(t, `"`, "1:2", "literal not terminated", token.STRING)
+ testError(t, `"abc`, "1:5", "literal not terminated", token.STRING)
+ testError(t, `"abc`+"\n", "1:5", "literal not terminated", token.STRING)
+}
+
+func testError(t *testing.T, src, pos, msg string, tok token.Type) {
+ s := New([]byte(src))
+
+ errorCalled := false
+ s.Error = func(p token.Pos, m string) {
+ if !errorCalled {
+ if pos != p.String() {
+ t.Errorf("pos = %q, want %q for %q", p, pos, src)
+ }
+
+ if m != msg {
+ t.Errorf("msg = %q, want %q for %q", m, msg, src)
+ }
+ errorCalled = true
+ }
+ }
+
+ tk := s.Scan()
+ if tk.Type != tok {
+ t.Errorf("tok = %s, want %s for %q", tk, tok, src)
+ }
+ if !errorCalled {
+ t.Errorf("error handler not called for %q", src)
+ }
+ if s.ErrorCount == 0 {
+ t.Errorf("count = %d, want > 0 for %q", s.ErrorCount, src)
+ }
+}
+
+func testTokenList(t *testing.T, tokenList []tokenPair) {
+ // create artifical source code
+ buf := new(bytes.Buffer)
+ for _, ident := range tokenList {
+ fmt.Fprintf(buf, "%s\n", ident.text)
+ }
+
+ s := New(buf.Bytes())
+ for _, ident := range tokenList {
+ tok := s.Scan()
+ if tok.Type != ident.tok {
+ t.Errorf("tok = %q want %q for %q\n", tok, ident.tok, ident.text)
+ }
+
+ if tok.Text != ident.text {
+ t.Errorf("text = %q want %q", tok.String(), ident.text)
+ }
+
+ }
+}
+
+func countNewlines(s string) int {
+ n := 0
+ for _, ch := range s {
+ if ch == '\n' {
+ n++
+ }
+ }
+ return n
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/array.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/array.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/array.json
new file mode 100644
index 0000000..e320f17
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/array.json
@@ -0,0 +1,4 @@
+{
+ "foo": [1, 2, "bar"],
+ "bar": "baz"
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/basic.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/basic.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/basic.json
new file mode 100644
index 0000000..b54bde9
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/basic.json
@@ -0,0 +1,3 @@
+{
+ "foo": "bar"
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/object.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/object.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/object.json
new file mode 100644
index 0000000..72168a3
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/object.json
@@ -0,0 +1,5 @@
+{
+ "foo": {
+ "bar": [1,2]
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/types.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/types.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/types.json
new file mode 100644
index 0000000..9a142a6
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/test-fixtures/types.json
@@ -0,0 +1,10 @@
+{
+ "foo": "bar",
+ "bar": 7,
+ "baz": [1,2,3],
+ "foo": -12,
+ "bar": 3.14159,
+ "foo": true,
+ "bar": false,
+ "foo": null
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/token/position.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/token/position.go b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/token/position.go
new file mode 100644
index 0000000..59c1bb7
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/token/position.go
@@ -0,0 +1,46 @@
+package token
+
+import "fmt"
+
+// Pos describes an arbitrary source position
+// including the file, line, and column location.
+// A Position is valid if the line number is > 0.
+type Pos struct {
+ Filename string // filename, if any
+ Offset int // offset, starting at 0
+ Line int // line number, starting at 1
+ Column int // column number, starting at 1 (character count)
+}
+
+// IsValid returns true if the position is valid.
+func (p *Pos) IsValid() bool { return p.Line > 0 }
+
+// String returns a string in one of several forms:
+//
+// file:line:column valid position with file name
+// line:column valid position without file name
+// file invalid position with file name
+// - invalid position without file name
+func (p Pos) String() string {
+ s := p.Filename
+ if p.IsValid() {
+ if s != "" {
+ s += ":"
+ }
+ s += fmt.Sprintf("%d:%d", p.Line, p.Column)
+ }
+ if s == "" {
+ s = "-"
+ }
+ return s
+}
+
+// Before reports whether the position p is before u.
+func (p Pos) Before(u Pos) bool {
+ return u.Offset > p.Offset || u.Line > p.Line
+}
+
+// After reports whether the position p is after u.
+func (p Pos) After(u Pos) bool {
+ return u.Offset < p.Offset || u.Line < p.Line
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/token/token.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/token/token.go b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/token/token.go
new file mode 100644
index 0000000..95a0c3e
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/token/token.go
@@ -0,0 +1,118 @@
+package token
+
+import (
+ "fmt"
+ "strconv"
+
+ hcltoken "github.com/hashicorp/hcl/hcl/token"
+)
+
+// Token defines a single HCL token which can be obtained via the Scanner
+type Token struct {
+ Type Type
+ Pos Pos
+ Text string
+}
+
+// Type is the set of lexical tokens of the HCL (HashiCorp Configuration Language)
+type Type int
+
+const (
+ // Special tokens
+ ILLEGAL Type = iota
+ EOF
+
+ identifier_beg
+ literal_beg
+ NUMBER // 12345
+ FLOAT // 123.45
+ BOOL // true,false
+ STRING // "abc"
+ NULL // null
+ literal_end
+ identifier_end
+
+ operator_beg
+ LBRACK // [
+ LBRACE // {
+ COMMA // ,
+ PERIOD // .
+ COLON // :
+
+ RBRACK // ]
+ RBRACE // }
+
+ operator_end
+)
+
+var tokens = [...]string{
+ ILLEGAL: "ILLEGAL",
+
+ EOF: "EOF",
+
+ NUMBER: "NUMBER",
+ FLOAT: "FLOAT",
+ BOOL: "BOOL",
+ STRING: "STRING",
+ NULL: "NULL",
+
+ LBRACK: "LBRACK",
+ LBRACE: "LBRACE",
+ COMMA: "COMMA",
+ PERIOD: "PERIOD",
+ COLON: "COLON",
+
+ RBRACK: "RBRACK",
+ RBRACE: "RBRACE",
+}
+
+// String returns the string corresponding to the token tok.
+func (t Type) String() string {
+ s := ""
+ if 0 <= t && t < Type(len(tokens)) {
+ s = tokens[t]
+ }
+ if s == "" {
+ s = "token(" + strconv.Itoa(int(t)) + ")"
+ }
+ return s
+}
+
+// IsIdentifier returns true for tokens corresponding to identifiers and basic
+// type literals; it returns false otherwise.
+func (t Type) IsIdentifier() bool { return identifier_beg < t && t < identifier_end }
+
+// IsLiteral returns true for tokens corresponding to basic type literals; it
+// returns false otherwise.
+func (t Type) IsLiteral() bool { return literal_beg < t && t < literal_end }
+
+// IsOperator returns true for tokens corresponding to operators and
+// delimiters; it returns false otherwise.
+func (t Type) IsOperator() bool { return operator_beg < t && t < operator_end }
+
+// String returns the token's literal text. Note that this is only
+// applicable for certain token types, such as token.IDENT,
+// token.STRING, etc..
+func (t Token) String() string {
+ return fmt.Sprintf("%s %s %s", t.Pos.String(), t.Type.String(), t.Text)
+}
+
+// HCLToken converts this token to an HCL token.
+//
+// The token type must be a literal type or this will panic.
+func (t Token) HCLToken() hcltoken.Token {
+ switch t.Type {
+ case BOOL:
+ return hcltoken.Token{Type: hcltoken.BOOL, Text: t.Text}
+ case FLOAT:
+ return hcltoken.Token{Type: hcltoken.FLOAT, Text: t.Text}
+ case NULL:
+ return hcltoken.Token{Type: hcltoken.STRING, Text: ""}
+ case NUMBER:
+ return hcltoken.Token{Type: hcltoken.NUMBER, Text: t.Text}
+ case STRING:
+ return hcltoken.Token{Type: hcltoken.STRING, Text: t.Text, JSON: true}
+ default:
+ panic(fmt.Sprintf("unimplemented HCLToken for type: %s", t.Type))
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/token/token_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/token/token_test.go b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/token/token_test.go
new file mode 100644
index 0000000..a83fdd5
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/json/token/token_test.go
@@ -0,0 +1,34 @@
+package token
+
+import (
+ "testing"
+)
+
+func TestTypeString(t *testing.T) {
+ var tokens = []struct {
+ tt Type
+ str string
+ }{
+ {ILLEGAL, "ILLEGAL"},
+ {EOF, "EOF"},
+ {NUMBER, "NUMBER"},
+ {FLOAT, "FLOAT"},
+ {BOOL, "BOOL"},
+ {STRING, "STRING"},
+ {NULL, "NULL"},
+ {LBRACK, "LBRACK"},
+ {LBRACE, "LBRACE"},
+ {COMMA, "COMMA"},
+ {PERIOD, "PERIOD"},
+ {RBRACK, "RBRACK"},
+ {RBRACE, "RBRACE"},
+ }
+
+ for _, token := range tokens {
+ if token.tt.String() != token.str {
+ t.Errorf("want: %q got:%q\n", token.str, token.tt)
+
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/lex.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/lex.go b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/lex.go
new file mode 100644
index 0000000..2e38ecb
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/lex.go
@@ -0,0 +1,31 @@
+package hcl
+
+import (
+ "unicode"
+)
+
+type lexModeValue byte
+
+const (
+ lexModeUnknown lexModeValue = iota
+ lexModeHcl
+ lexModeJson
+)
+
+// lexMode returns whether we're going to be parsing in JSON
+// mode or HCL mode.
+func lexMode(v string) lexModeValue {
+ for _, r := range v {
+ if unicode.IsSpace(r) {
+ continue
+ }
+
+ if r == '{' {
+ return lexModeJson
+ } else {
+ return lexModeHcl
+ }
+ }
+
+ return lexModeHcl
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/lex_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/lex_test.go b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/lex_test.go
new file mode 100644
index 0000000..f7ee378
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/lex_test.go
@@ -0,0 +1,37 @@
+package hcl
+
+import (
+ "testing"
+)
+
+func TestLexMode(t *testing.T) {
+ cases := []struct {
+ Input string
+ Mode lexModeValue
+ }{
+ {
+ "",
+ lexModeHcl,
+ },
+ {
+ "foo",
+ lexModeHcl,
+ },
+ {
+ "{}",
+ lexModeJson,
+ },
+ {
+ " {}",
+ lexModeJson,
+ },
+ }
+
+ for i, tc := range cases {
+ actual := lexMode(tc.Input)
+
+ if actual != tc.Mode {
+ t.Fatalf("%d: %#v", i, actual)
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/parse.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/parse.go b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/parse.go
new file mode 100644
index 0000000..d0719c2
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/parse.go
@@ -0,0 +1,23 @@
+package hcl
+
+import (
+ "fmt"
+
+ "github.com/hashicorp/hcl/hcl/ast"
+ hclParser "github.com/hashicorp/hcl/hcl/parser"
+ jsonParser "github.com/hashicorp/hcl/json/parser"
+)
+
+// Parse parses the given input and returns the root object.
+//
+// The input format can be either HCL or JSON.
+func Parse(input string) (*ast.File, error) {
+ switch lexMode(input) {
+ case lexModeHcl:
+ return hclParser.Parse([]byte(input))
+ case lexModeJson:
+ return jsonParser.Parse([]byte(input))
+ }
+
+ return nil, fmt.Errorf("unknown config format")
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic.hcl
new file mode 100644
index 0000000..9499944
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic.hcl
@@ -0,0 +1,2 @@
+foo = "bar"
+bar = "${file("bing/bong.txt")}"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic.json
new file mode 100644
index 0000000..7bdddc8
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic.json
@@ -0,0 +1,4 @@
+{
+ "foo": "bar",
+ "bar": "${file(\"bing/bong.txt\")}"
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic_int_string.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic_int_string.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic_int_string.hcl
new file mode 100644
index 0000000..4e415da
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic_int_string.hcl
@@ -0,0 +1 @@
+count = "3"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic_squish.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic_squish.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic_squish.hcl
new file mode 100644
index 0000000..363697b
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/basic_squish.hcl
@@ -0,0 +1,3 @@
+foo="bar"
+bar="${file("bing/bong.txt")}"
+foo-bar="baz"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_policy.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_policy.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_policy.hcl
new file mode 100644
index 0000000..5b185cc
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_policy.hcl
@@ -0,0 +1,15 @@
+key "" {
+ policy = "read"
+}
+
+key "foo/" {
+ policy = "write"
+}
+
+key "foo/bar/" {
+ policy = "read"
+}
+
+key "foo/bar/baz" {
+ policy = "deny"
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_policy.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_policy.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_policy.json
new file mode 100644
index 0000000..151864e
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_policy.json
@@ -0,0 +1,19 @@
+{
+ "key": {
+ "": {
+ "policy": "read"
+ },
+
+ "foo/": {
+ "policy": "write"
+ },
+
+ "foo/bar/": {
+ "policy": "read"
+ },
+
+ "foo/bar/baz": {
+ "policy": "deny"
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.hcl
new file mode 100644
index 0000000..52dcaa1
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.hcl
@@ -0,0 +1,10 @@
+variable "foo" {
+ default = "bar"
+ description = "bar"
+}
+
+variable "amis" {
+ default = {
+ east = "foo"
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.json
new file mode 100644
index 0000000..49f921e
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/decode_tf_variable.json
@@ -0,0 +1,14 @@
+{
+ "variable": {
+ "foo": {
+ "default": "bar",
+ "description": "bar"
+ },
+
+ "amis": {
+ "default": {
+ "east": "foo"
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/empty.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/empty.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/empty.hcl
new file mode 100644
index 0000000..5be1b23
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/empty.hcl
@@ -0,0 +1 @@
+resource "foo" {}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/escape.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/escape.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/escape.hcl
new file mode 100644
index 0000000..ead1b8b
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/escape.hcl
@@ -0,0 +1 @@
+foo = "bar\"baz\\n"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/flat.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/flat.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/flat.hcl
new file mode 100644
index 0000000..9bca551
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/flat.hcl
@@ -0,0 +1,2 @@
+foo = "bar"
+Key = 7
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/float.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/float.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/float.hcl
new file mode 100644
index 0000000..eed44e5
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/float.hcl
@@ -0,0 +1 @@
+a = 1.02
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/float.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/float.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/float.json
new file mode 100644
index 0000000..a9d1ab4
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/float.json
@@ -0,0 +1,3 @@
+{
+ "a": 1.02
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/interpolate_escape.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/interpolate_escape.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/interpolate_escape.hcl
new file mode 100644
index 0000000..7b95391
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/interpolate_escape.hcl
@@ -0,0 +1 @@
+foo="${file(\"bing/bong.txt\")}"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline.hcl
new file mode 100644
index 0000000..f883bd7
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline.hcl
@@ -0,0 +1,4 @@
+foo = <<EOF
+bar
+baz
+EOF
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline.json
new file mode 100644
index 0000000..93f7cc5
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline.json
@@ -0,0 +1,3 @@
+{
+ "foo": "bar\nbaz"
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline_bad.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline_bad.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline_bad.hcl
new file mode 100644
index 0000000..4cd0f4d
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline_bad.hcl
@@ -0,0 +1,4 @@
+foo = <EOF
+bar
+baz
+EOF
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline_no_eof.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline_no_eof.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline_no_eof.hcl
new file mode 100644
index 0000000..faa1329
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline_no_eof.hcl
@@ -0,0 +1,5 @@
+foo = <<EOF
+bar
+baz
+EOF
+key = "value"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline_no_marker.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline_no_marker.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline_no_marker.hcl
new file mode 100644
index 0000000..55c1739
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/multiline_no_marker.hcl
@@ -0,0 +1 @@
+foo = <<
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/nested_block_comment.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/nested_block_comment.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/nested_block_comment.hcl
new file mode 100644
index 0000000..e827782
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/nested_block_comment.hcl
@@ -0,0 +1,5 @@
+/*
+foo = "bar/*"
+*/
+
+bar = "value"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/object_list.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/object_list.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/object_list.json
new file mode 100644
index 0000000..73f3674
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/object_list.json
@@ -0,0 +1,15 @@
+{
+ "resource": {
+ "aws_instance": {
+ "db": {
+ "vpc": "foo",
+ "provisioner": [{
+ "file": {
+ "source": "foo",
+ "destination": "bar"
+ }
+ }]
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/scientific.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/scientific.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/scientific.hcl
new file mode 100644
index 0000000..b9eca28
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/scientific.hcl
@@ -0,0 +1,6 @@
+a = 1e-10
+b = 1e+10
+c = 1e10
+d = 1.2e-10
+e = 1.2e+10
+f = 1.2e10
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/scientific.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/scientific.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/scientific.json
new file mode 100644
index 0000000..c1fce3c
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/scientific.json
@@ -0,0 +1,8 @@
+{
+ "a": 1e-10,
+ "b": 1e+10,
+ "c": 1e10,
+ "d": 1.2e-10,
+ "e": 1.2e+10,
+ "f": 1.2e10
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/slice_expand.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/slice_expand.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/slice_expand.hcl
new file mode 100644
index 0000000..4d3725f
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/slice_expand.hcl
@@ -0,0 +1,7 @@
+service "my-service-0" {
+ key = "value"
+}
+
+service "my-service-1" {
+ key = "value"
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure.hcl
new file mode 100644
index 0000000..18b6b1e
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure.hcl
@@ -0,0 +1,5 @@
+// This is a test structure for the lexer
+foo "baz" {
+ key = 7
+ foo = "bar"
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure.json
new file mode 100644
index 0000000..30aa765
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure.json
@@ -0,0 +1,8 @@
+{
+ "foo": [{
+ "baz": [{
+ "key": 7,
+ "foo": "bar"
+ }]
+ }]
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure2.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure2.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure2.hcl
new file mode 100644
index 0000000..7577ffc
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure2.hcl
@@ -0,0 +1,9 @@
+// This is a test structure for the lexer
+foo "baz" {
+ key = 7
+ foo = "bar"
+}
+
+foo {
+ key = 7
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure2.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure2.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure2.json
new file mode 100644
index 0000000..c51fcf5
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure2.json
@@ -0,0 +1,10 @@
+{
+ "foo": [{
+ "baz": {
+ "key": 7,
+ "foo": "bar"
+ }
+ }, {
+ "key": 7
+ }]
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_flat.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_flat.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_flat.json
new file mode 100644
index 0000000..5256db4
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_flat.json
@@ -0,0 +1,8 @@
+{
+ "foo": {
+ "baz": {
+ "key": 7,
+ "foo": "bar"
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_flatmap.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_flatmap.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_flatmap.hcl
new file mode 100644
index 0000000..fcf689e
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_flatmap.hcl
@@ -0,0 +1,7 @@
+foo {
+ key = 7
+}
+
+foo {
+ foo = "bar"
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_list.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_list.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_list.hcl
new file mode 100644
index 0000000..33193ae
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_list.hcl
@@ -0,0 +1,6 @@
+foo {
+ key = 7
+}
+foo {
+ key = 12
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_list.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_list.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_list.json
new file mode 100644
index 0000000..806a60e
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_list.json
@@ -0,0 +1,7 @@
+{
+ "foo": [{
+ "key": 7
+ }, {
+ "key": 12
+ }]
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_list_deep.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_list_deep.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_list_deep.json
new file mode 100644
index 0000000..46e98be
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_list_deep.json
@@ -0,0 +1,16 @@
+{
+ "bar": {
+ "foo": {
+ "name": "terraform_example",
+ "ingress": [
+ {
+ "from_port": 22
+ },
+ {
+ "from_port": 80
+ }
+ ]
+ }
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_multi.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_multi.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_multi.hcl
new file mode 100644
index 0000000..e45b23d
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_multi.hcl
@@ -0,0 +1,7 @@
+foo "baz" {
+ key = 7
+}
+
+foo "bar" {
+ key = 12
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_multi.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_multi.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_multi.json
new file mode 100644
index 0000000..773761a
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/structure_multi.json
@@ -0,0 +1,11 @@
+{
+ "foo": {
+ "baz": {
+ "key": 7
+ },
+
+ "bar": {
+ "key": 12
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.hcl
new file mode 100644
index 0000000..fda9241
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.hcl
@@ -0,0 +1,5 @@
+name = "terraform-test-app"
+
+config_vars {
+ FOO = "bar"
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.json
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.json b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.json
new file mode 100644
index 0000000..e8c6fac
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/terraform_heroku.json
@@ -0,0 +1,6 @@
+{
+ "name": "terraform-test-app",
+ "config_vars": {
+ "FOO": "bar"
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/tfvars.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/tfvars.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/tfvars.hcl
new file mode 100644
index 0000000..5f623e0
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/tfvars.hcl
@@ -0,0 +1,3 @@
+regularvar = "Should work"
+map.key1 = "Value"
+map.key2 = "Other value"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/unterminated_block_comment.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/unterminated_block_comment.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/unterminated_block_comment.hcl
new file mode 100644
index 0000000..c0ce34d
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/unterminated_block_comment.hcl
@@ -0,0 +1,2 @@
+/*
+Foo
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/unterminated_brace.hcl
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/unterminated_brace.hcl b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/unterminated_brace.hcl
new file mode 100644
index 0000000..31b37c4
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/hcl/test-fixtures/unterminated_brace.hcl
@@ -0,0 +1,2 @@
+foo "baz" {
+ bar = "baz"
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/.gitignore
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/.gitignore b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/.gitignore
new file mode 100644
index 0000000..0026861
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/.gitignore
@@ -0,0 +1,22 @@
+# Compiled Object files, Static and Dynamic libs (Shared Objects)
+*.o
+*.a
+*.so
+
+# Folders
+_obj
+_test
+
+# Architecture specific extensions/prefixes
+*.[568vq]
+[568vq].out
+
+*.cgo1.go
+*.cgo2.c
+_cgo_defun.c
+_cgo_gotypes.go
+_cgo_export.*
+
+_testmain.go
+
+*.exe
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/LICENSE
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/LICENSE b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/LICENSE
new file mode 100644
index 0000000..c33dcc7
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/LICENSE
@@ -0,0 +1,354 @@
+Mozilla Public License, version 2.0
+
+1. Definitions
+
+1.1. “Contributor”
+
+ means each individual or legal entity that creates, contributes to the
+ creation of, or owns Covered Software.
+
+1.2. “Contributor Version”
+
+ means the combination of the Contributions of others (if any) used by a
+ Contributor and that particular Contributor’s Contribution.
+
+1.3. “Contribution”
+
+ means Covered Software of a particular Contributor.
+
+1.4. “Covered Software”
+
+ means Source Code Form to which the initial Contributor has attached the
+ notice in Exhibit A, the Executable Form of such Source Code Form, and
+ Modifications of such Source Code Form, in each case including portions
+ thereof.
+
+1.5. “Incompatible With Secondary Licenses”
+ means
+
+ a. that the initial Contributor has attached the notice described in
+ Exhibit B to the Covered Software; or
+
+ b. that the Covered Software was made available under the terms of version
+ 1.1 or earlier of the License, but not also under the terms of a
+ Secondary License.
+
+1.6. “Executable Form”
+
+ means any form of the work other than Source Code Form.
+
+1.7. “Larger Work”
+
+ means a work that combines Covered Software with other material, in a separate
+ file or files, that is not Covered Software.
+
+1.8. “License”
+
+ means this document.
+
+1.9. “Licensable”
+
+ means having the right to grant, to the maximum extent possible, whether at the
+ time of the initial grant or subsequently, any and all of the rights conveyed by
+ this License.
+
+1.10. “Modifications”
+
+ means any of the following:
+
+ a. any file in Source Code Form that results from an addition to, deletion
+ from, or modification of the contents of Covered Software; or
+
+ b. any new file in Source Code Form that contains any Covered Software.
+
+1.11. “Patent Claims” of a Contributor
+
+ means any patent claim(s), including without limitation, method, process,
+ and apparatus claims, in any patent Licensable by such Contributor that
+ would be infringed, but for the grant of the License, by the making,
+ using, selling, offering for sale, having made, import, or transfer of
+ either its Contributions or its Contributor Version.
+
+1.12. “Secondary License”
+
+ means either the GNU General Public License, Version 2.0, the GNU Lesser
+ General Public License, Version 2.1, the GNU Affero General Public
+ License, Version 3.0, or any later versions of those licenses.
+
+1.13. “Source Code Form”
+
+ means the form of the work preferred for making modifications.
+
+1.14. “You” (or “Your”)
+
+ means an individual or a legal entity exercising rights under this
+ License. For legal entities, “You” includes any entity that controls, is
+ controlled by, or is under common control with You. For purposes of this
+ definition, “control” means (a) the power, direct or indirect, to cause
+ the direction or management of such entity, whether by contract or
+ otherwise, or (b) ownership of more than fifty percent (50%) of the
+ outstanding shares or beneficial ownership of such entity.
+
+
+2. License Grants and Conditions
+
+2.1. Grants
+
+ Each Contributor hereby grants You a world-wide, royalty-free,
+ non-exclusive license:
+
+ a. under intellectual property rights (other than patent or trademark)
+ Licensable by such Contributor to use, reproduce, make available,
+ modify, display, perform, distribute, and otherwise exploit its
+ Contributions, either on an unmodified basis, with Modifications, or as
+ part of a Larger Work; and
+
+ b. under Patent Claims of such Contributor to make, use, sell, offer for
+ sale, have made, import, and otherwise transfer either its Contributions
+ or its Contributor Version.
+
+2.2. Effective Date
+
+ The licenses granted in Section 2.1 with respect to any Contribution become
+ effective for each Contribution on the date the Contributor first distributes
+ such Contribution.
+
+2.3. Limitations on Grant Scope
+
+ The licenses granted in this Section 2 are the only rights granted under this
+ License. No additional rights or licenses will be implied from the distribution
+ or licensing of Covered Software under this License. Notwithstanding Section
+ 2.1(b) above, no patent license is granted by a Contributor:
+
+ a. for any code that a Contributor has removed from Covered Software; or
+
+ b. for infringements caused by: (i) Your and any other third party’s
+ modifications of Covered Software, or (ii) the combination of its
+ Contributions with other software (except as part of its Contributor
+ Version); or
+
+ c. under Patent Claims infringed by Covered Software in the absence of its
+ Contributions.
+
+ This License does not grant any rights in the trademarks, service marks, or
+ logos of any Contributor (except as may be necessary to comply with the
+ notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+ No Contributor makes additional grants as a result of Your choice to
+ distribute the Covered Software under a subsequent version of this License
+ (see Section 10.2) or under the terms of a Secondary License (if permitted
+ under the terms of Section 3.3).
+
+2.5. Representation
+
+ Each Contributor represents that the Contributor believes its Contributions
+ are its original creation(s) or it has sufficient rights to grant the
+ rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+
+ This License is not intended to limit any rights You have under applicable
+ copyright doctrines of fair use, fair dealing, or other equivalents.
+
+2.7. Conditions
+
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
+ Section 2.1.
+
+
+3. Responsibilities
+
+3.1. Distribution of Source Form
+
+ All distribution of Covered Software in Source Code Form, including any
+ Modifications that You create or to which You contribute, must be under the
+ terms of this License. You must inform recipients that the Source Code Form
+ of the Covered Software is governed by the terms of this License, and how
+ they can obtain a copy of this License. You may not attempt to alter or
+ restrict the recipients’ rights in the Source Code Form.
+
+3.2. Distribution of Executable Form
+
+ If You distribute Covered Software in Executable Form then:
+
+ a. such Covered Software must also be made available in Source Code Form,
+ as described in Section 3.1, and You must inform recipients of the
+ Executable Form how they can obtain a copy of such Source Code Form by
+ reasonable means in a timely manner, at a charge no more than the cost
+ of distribution to the recipient; and
+
+ b. You may distribute such Executable Form under the terms of this License,
+ or sublicense it under different terms, provided that the license for
+ the Executable Form does not attempt to limit or alter the recipients’
+ rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+
+ You may create and distribute a Larger Work under terms of Your choice,
+ provided that You also comply with the requirements of this License for the
+ Covered Software. If the Larger Work is a combination of Covered Software
+ with a work governed by one or more Secondary Licenses, and the Covered
+ Software is not Incompatible With Secondary Licenses, this License permits
+ You to additionally distribute such Covered Software under the terms of
+ such Secondary License(s), so that the recipient of the Larger Work may, at
+ their option, further distribute the Covered Software under the terms of
+ either this License or such Secondary License(s).
+
+3.4. Notices
+
+ You may not remove or alter the substance of any license notices (including
+ copyright notices, patent notices, disclaimers of warranty, or limitations
+ of liability) contained within the Source Code Form of the Covered
+ Software, except that You may alter any license notices to the extent
+ required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+
+ You may choose to offer, and to charge a fee for, warranty, support,
+ indemnity or liability obligations to one or more recipients of Covered
+ Software. However, You may do so only on Your own behalf, and not on behalf
+ of any Contributor. You must make it absolutely clear that any such
+ warranty, support, indemnity, or liability obligation is offered by You
+ alone, and You hereby agree to indemnify every Contributor for any
+ liability incurred by such Contributor as a result of warranty, support,
+ indemnity or liability terms You offer. You may include additional
+ disclaimers of warranty and limitations of liability specific to any
+ jurisdiction.
+
+4. Inability to Comply Due to Statute or Regulation
+
+ If it is impossible for You to comply with any of the terms of this License
+ with respect to some or all of the Covered Software due to statute, judicial
+ order, or regulation then You must: (a) comply with the terms of this License
+ to the maximum extent possible; and (b) describe the limitations and the code
+ they affect. Such description must be placed in a text file included with all
+ distributions of the Covered Software under this License. Except to the
+ extent prohibited by statute or regulation, such description must be
+ sufficiently detailed for a recipient of ordinary skill to be able to
+ understand it.
+
+5. Termination
+
+5.1. The rights granted under this License will terminate automatically if You
+ fail to comply with any of its terms. However, if You become compliant,
+ then the rights granted under this License from a particular Contributor
+ are reinstated (a) provisionally, unless and until such Contributor
+ explicitly and finally terminates Your grants, and (b) on an ongoing basis,
+ if such Contributor fails to notify You of the non-compliance by some
+ reasonable means prior to 60 days after You have come back into compliance.
+ Moreover, Your grants from a particular Contributor are reinstated on an
+ ongoing basis if such Contributor notifies You of the non-compliance by
+ some reasonable means, this is the first time You have received notice of
+ non-compliance with this License from such Contributor, and You become
+ compliant prior to 30 days after Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+ infringement claim (excluding declaratory judgment actions, counter-claims,
+ and cross-claims) alleging that a Contributor Version directly or
+ indirectly infringes any patent, then the rights granted to You by any and
+ all Contributors for the Covered Software under Section 2.1 of this License
+ shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
+ license agreements (excluding distributors and resellers) which have been
+ validly granted by You or Your distributors under this License prior to
+ termination shall survive termination.
+
+6. Disclaimer of Warranty
+
+ Covered Software is provided under this License on an “as is” basis, without
+ warranty of any kind, either expressed, implied, or statutory, including,
+ without limitation, warranties that the Covered Software is free of defects,
+ merchantable, fit for a particular purpose or non-infringing. The entire
+ risk as to the quality and performance of the Covered Software is with You.
+ Should any Covered Software prove defective in any respect, You (not any
+ Contributor) assume the cost of any necessary servicing, repair, or
+ correction. This disclaimer of warranty constitutes an essential part of this
+ License. No use of any Covered Software is authorized under this License
+ except under this disclaimer.
+
+7. Limitation of Liability
+
+ Under no circumstances and under no legal theory, whether tort (including
+ negligence), contract, or otherwise, shall any Contributor, or anyone who
+ distributes Covered Software as permitted above, be liable to You for any
+ direct, indirect, special, incidental, or consequential damages of any
+ character including, without limitation, damages for lost profits, loss of
+ goodwill, work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses, even if such party shall have been
+ informed of the possibility of such damages. This limitation of liability
+ shall not apply to liability for death or personal injury resulting from such
+ party’s negligence to the extent applicable law prohibits such limitation.
+ Some jurisdictions do not allow the exclusion or limitation of incidental or
+ consequential damages, so this exclusion and limitation may not apply to You.
+
+8. Litigation
+
+ Any litigation relating to this License may be brought only in the courts of
+ a jurisdiction where the defendant maintains its principal place of business
+ and such litigation shall be governed by laws of that jurisdiction, without
+ reference to its conflict-of-law provisions. Nothing in this Section shall
+ prevent a party’s ability to bring cross-claims or counter-claims.
+
+9. Miscellaneous
+
+ This License represents the complete agreement concerning the subject matter
+ hereof. If any provision of this License is held to be unenforceable, such
+ provision shall be reformed only to the extent necessary to make it
+ enforceable. Any law or regulation which provides that the language of a
+ contract shall be construed against the drafter shall not be used to construe
+ this License against a Contributor.
+
+
+10. Versions of the License
+
+10.1. New Versions
+
+ Mozilla Foundation is the license steward. Except as provided in Section
+ 10.3, no one other than the license steward has the right to modify or
+ publish new versions of this License. Each version will be given a
+ distinguishing version number.
+
+10.2. Effect of New Versions
+
+ You may distribute the Covered Software under the terms of the version of
+ the License under which You originally received the Covered Software, or
+ under the terms of any subsequent version published by the license
+ steward.
+
+10.3. Modified Versions
+
+ If you create software not governed by this License, and you want to
+ create a new license for such software, you may create and use a modified
+ version of this License if you rename the license and remove any
+ references to the name of the license steward (except to note that such
+ modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses
+ If You choose to distribute Source Code Form that is Incompatible With
+ Secondary Licenses under the terms of this version of the License, the
+ notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+
+ This Source Code Form is subject to the
+ terms of the Mozilla Public License, v.
+ 2.0. If a copy of the MPL was not
+ distributed with this file, You can
+ obtain one at
+ http://mozilla.org/MPL/2.0/.
+
+If it is not possible or desirable to put the notice in a particular file, then
+You may include the notice in a location (such as a LICENSE file in a relevant
+directory) where a recipient would be likely to look for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - “Incompatible With Secondary Licenses” Notice
+
+ This Source Code Form is “Incompatible
+ With Secondary Licenses”, as defined by
+ the Mozilla Public License, v. 2.0.
+
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/README.md
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/README.md b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/README.md
new file mode 100644
index 0000000..49490ea
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/README.md
@@ -0,0 +1,36 @@
+# logutils
+
+logutils is a Go package that augments the standard library "log" package
+to make logging a bit more modern, without fragmenting the Go ecosystem
+with new logging packages.
+
+## The simplest thing that could possibly work
+
+Presumably your application already uses the default `log` package. To switch, you'll want your code to look like the following:
+
+```go
+package main
+
+import (
+ "log"
+ "os"
+
+ "github.com/hashicorp/logutils"
+)
+
+func main() {
+ filter := &logutils.LevelFilter{
+ Levels: []logutils.LogLevel{"DEBUG", "WARN", "ERROR"},
+ MinLevel: logutils.LogLevel("WARN"),
+ Writer: os.Stderr,
+ }
+ log.SetOutput(filter)
+
+ log.Print("[DEBUG] Debugging") // this will not print
+ log.Print("[WARN] Warning") // this will
+ log.Print("[ERROR] Erring") // and so will this
+ log.Print("Message I haven't updated") // and so will this
+}
+```
+
+This logs to standard error exactly like go's standard logger. Any log messages you haven't converted to have a level will continue to print as before.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level.go b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level.go
new file mode 100644
index 0000000..6381bf1
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level.go
@@ -0,0 +1,81 @@
+// Package logutils augments the standard log package with levels.
+package logutils
+
+import (
+ "bytes"
+ "io"
+ "sync"
+)
+
+type LogLevel string
+
+// LevelFilter is an io.Writer that can be used with a logger that
+// will filter out log messages that aren't at least a certain level.
+//
+// Once the filter is in use somewhere, it is not safe to modify
+// the structure.
+type LevelFilter struct {
+ // Levels is the list of log levels, in increasing order of
+ // severity. Example might be: {"DEBUG", "WARN", "ERROR"}.
+ Levels []LogLevel
+
+ // MinLevel is the minimum level allowed through
+ MinLevel LogLevel
+
+ // The underlying io.Writer where log messages that pass the filter
+ // will be set.
+ Writer io.Writer
+
+ badLevels map[LogLevel]struct{}
+ once sync.Once
+}
+
+// Check will check a given line if it would be included in the level
+// filter.
+func (f *LevelFilter) Check(line []byte) bool {
+ f.once.Do(f.init)
+
+ // Check for a log level
+ var level LogLevel
+ x := bytes.IndexByte(line, '[')
+ if x >= 0 {
+ y := bytes.IndexByte(line[x:], ']')
+ if y >= 0 {
+ level = LogLevel(line[x+1 : x+y])
+ }
+ }
+
+ _, ok := f.badLevels[level]
+ return !ok
+}
+
+func (f *LevelFilter) Write(p []byte) (n int, err error) {
+ // Note in general that io.Writer can receive any byte sequence
+ // to write, but the "log" package always guarantees that we only
+ // get a single line. We use that as a slight optimization within
+ // this method, assuming we're dealing with a single, complete line
+ // of log data.
+
+ if !f.Check(p) {
+ return len(p), nil
+ }
+
+ return f.Writer.Write(p)
+}
+
+// SetMinLevel is used to update the minimum log level
+func (f *LevelFilter) SetMinLevel(min LogLevel) {
+ f.MinLevel = min
+ f.init()
+}
+
+func (f *LevelFilter) init() {
+ badLevels := make(map[LogLevel]struct{})
+ for _, level := range f.Levels {
+ if level == f.MinLevel {
+ break
+ }
+ badLevels[level] = struct{}{}
+ }
+ f.badLevels = badLevels
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_benchmark_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_benchmark_test.go b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_benchmark_test.go
new file mode 100644
index 0000000..3c2caf7
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_benchmark_test.go
@@ -0,0 +1,37 @@
+package logutils
+
+import (
+ "io/ioutil"
+ "testing"
+)
+
+var messages [][]byte
+
+func init() {
+ messages = [][]byte{
+ []byte("[TRACE] foo"),
+ []byte("[DEBUG] foo"),
+ []byte("[INFO] foo"),
+ []byte("[WARN] foo"),
+ []byte("[ERROR] foo"),
+ }
+}
+
+func BenchmarkDiscard(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ ioutil.Discard.Write(messages[i%len(messages)])
+ }
+}
+
+func BenchmarkLevelFilter(b *testing.B) {
+ filter := &LevelFilter{
+ Levels: []LogLevel{"TRACE", "DEBUG", "INFO", "WARN", "ERROR"},
+ MinLevel: "WARN",
+ Writer: ioutil.Discard,
+ }
+
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ filter.Write(messages[i%len(messages)])
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_test.go b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_test.go
new file mode 100644
index 0000000..f6b6ac3
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/hashicorp/logutils/level_test.go
@@ -0,0 +1,94 @@
+package logutils
+
+import (
+ "bytes"
+ "io"
+ "log"
+ "testing"
+)
+
+func TestLevelFilter_impl(t *testing.T) {
+ var _ io.Writer = new(LevelFilter)
+}
+
+func TestLevelFilter(t *testing.T) {
+ buf := new(bytes.Buffer)
+ filter := &LevelFilter{
+ Levels: []LogLevel{"DEBUG", "WARN", "ERROR"},
+ MinLevel: "WARN",
+ Writer: buf,
+ }
+
+ logger := log.New(filter, "", 0)
+ logger.Print("[WARN] foo")
+ logger.Println("[ERROR] bar")
+ logger.Println("[DEBUG] baz")
+ logger.Println("[WARN] buzz")
+
+ result := buf.String()
+ expected := "[WARN] foo\n[ERROR] bar\n[WARN] buzz\n"
+ if result != expected {
+ t.Fatalf("bad: %#v", result)
+ }
+}
+
+func TestLevelFilterCheck(t *testing.T) {
+ filter := &LevelFilter{
+ Levels: []LogLevel{"DEBUG", "WARN", "ERROR"},
+ MinLevel: "WARN",
+ Writer: nil,
+ }
+
+ testCases := []struct {
+ line string
+ check bool
+ }{
+ {"[WARN] foo\n", true},
+ {"[ERROR] bar\n", true},
+ {"[DEBUG] baz\n", false},
+ {"[WARN] buzz\n", true},
+ }
+
+ for _, testCase := range testCases {
+ result := filter.Check([]byte(testCase.line))
+ if result != testCase.check {
+ t.Errorf("Fail: %s", testCase.line)
+ }
+ }
+}
+
+func TestLevelFilter_SetMinLevel(t *testing.T) {
+ filter := &LevelFilter{
+ Levels: []LogLevel{"DEBUG", "WARN", "ERROR"},
+ MinLevel: "ERROR",
+ Writer: nil,
+ }
+
+ testCases := []struct {
+ line string
+ checkBefore bool
+ checkAfter bool
+ }{
+ {"[WARN] foo\n", false, true},
+ {"[ERROR] bar\n", true, true},
+ {"[DEBUG] baz\n", false, false},
+ {"[WARN] buzz\n", false, true},
+ }
+
+ for _, testCase := range testCases {
+ result := filter.Check([]byte(testCase.line))
+ if result != testCase.checkBefore {
+ t.Errorf("Fail: %s", testCase.line)
+ }
+ }
+
+ // Update the minimum level to WARN
+ filter.SetMinLevel("WARN")
+
+ for _, testCase := range testCases {
+ result := filter.Check([]byte(testCase.line))
+ if result != testCase.checkAfter {
+ t.Errorf("Fail: %s", testCase.line)
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/kr/pretty/.gitignore
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/.gitignore b/newt/Godeps/_workspace/src/github.com/kr/pretty/.gitignore
new file mode 100644
index 0000000..1f0a99f
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/kr/pretty/.gitignore
@@ -0,0 +1,4 @@
+[568].out
+_go*
+_test*
+_obj
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/kr/pretty/License
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/License b/newt/Godeps/_workspace/src/github.com/kr/pretty/License
new file mode 100644
index 0000000..05c783c
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/kr/pretty/License
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright 2012 Keith Rarick
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/kr/pretty/Readme
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/Readme b/newt/Godeps/_workspace/src/github.com/kr/pretty/Readme
new file mode 100644
index 0000000..c589fc6
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/kr/pretty/Readme
@@ -0,0 +1,9 @@
+package pretty
+
+ import "github.com/kr/pretty"
+
+ Package pretty provides pretty-printing for Go values.
+
+Documentation
+
+ http://godoc.org/github.com/kr/pretty
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/kr/pretty/diff.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/diff.go b/newt/Godeps/_workspace/src/github.com/kr/pretty/diff.go
new file mode 100644
index 0000000..8fe8e24
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/kr/pretty/diff.go
@@ -0,0 +1,158 @@
+package pretty
+
+import (
+ "fmt"
+ "io"
+ "reflect"
+)
+
+type sbuf []string
+
+func (s *sbuf) Write(b []byte) (int, error) {
+ *s = append(*s, string(b))
+ return len(b), nil
+}
+
+// Diff returns a slice where each element describes
+// a difference between a and b.
+func Diff(a, b interface{}) (desc []string) {
+ Fdiff((*sbuf)(&desc), a, b)
+ return desc
+}
+
+// Fdiff writes to w a description of the differences between a and b.
+func Fdiff(w io.Writer, a, b interface{}) {
+ diffWriter{w: w}.diff(reflect.ValueOf(a), reflect.ValueOf(b))
+}
+
+type diffWriter struct {
+ w io.Writer
+ l string // label
+}
+
+func (w diffWriter) printf(f string, a ...interface{}) {
+ var l string
+ if w.l != "" {
+ l = w.l + ": "
+ }
+ fmt.Fprintf(w.w, l+f, a...)
+}
+
+func (w diffWriter) diff(av, bv reflect.Value) {
+ if !av.IsValid() && bv.IsValid() {
+ w.printf("nil != %#v", bv.Interface())
+ return
+ }
+ if av.IsValid() && !bv.IsValid() {
+ w.printf("%#v != nil", av.Interface())
+ return
+ }
+ if !av.IsValid() && !bv.IsValid() {
+ return
+ }
+
+ at := av.Type()
+ bt := bv.Type()
+ if at != bt {
+ w.printf("%v != %v", at, bt)
+ return
+ }
+
+ // numeric types, including bool
+ if at.Kind() < reflect.Array {
+ a, b := av.Interface(), bv.Interface()
+ if a != b {
+ w.printf("%#v != %#v", a, b)
+ }
+ return
+ }
+
+ switch at.Kind() {
+ case reflect.String:
+ a, b := av.Interface(), bv.Interface()
+ if a != b {
+ w.printf("%q != %q", a, b)
+ }
+ case reflect.Ptr:
+ switch {
+ case av.IsNil() && !bv.IsNil():
+ w.printf("nil != %v", bv.Interface())
+ case !av.IsNil() && bv.IsNil():
+ w.printf("%v != nil", av.Interface())
+ case !av.IsNil() && !bv.IsNil():
+ w.diff(av.Elem(), bv.Elem())
+ }
+ case reflect.Struct:
+ for i := 0; i < av.NumField(); i++ {
+ w.relabel(at.Field(i).Name).diff(av.Field(i), bv.Field(i))
+ }
+ case reflect.Slice:
+ lenA := av.Len()
+ lenB := bv.Len()
+ if lenA != lenB {
+ w.printf("%s[%d] != %s[%d]", av.Type(), lenA, bv.Type(), lenB)
+ break
+ }
+ for i := 0; i < lenA; i++ {
+ w.relabel(fmt.Sprintf("[%d]", i)).diff(av.Index(i), bv.Index(i))
+ }
+ case reflect.Map:
+ ak, both, bk := keyDiff(av.MapKeys(), bv.MapKeys())
+ for _, k := range ak {
+ w := w.relabel(fmt.Sprintf("[%#v]", k.Interface()))
+ w.printf("%q != (missing)", av.MapIndex(k))
+ }
+ for _, k := range both {
+ w := w.relabel(fmt.Sprintf("[%#v]", k.Interface()))
+ w.diff(av.MapIndex(k), bv.MapIndex(k))
+ }
+ for _, k := range bk {
+ w := w.relabel(fmt.Sprintf("[%#v]", k.Interface()))
+ w.printf("(missing) != %q", bv.MapIndex(k))
+ }
+ case reflect.Interface:
+ w.diff(reflect.ValueOf(av.Interface()), reflect.ValueOf(bv.Interface()))
+ default:
+ if !reflect.DeepEqual(av.Interface(), bv.Interface()) {
+ w.printf("%# v != %# v", Formatter(av.Interface()), Formatter(bv.Interface()))
+ }
+ }
+}
+
+func (d diffWriter) relabel(name string) (d1 diffWriter) {
+ d1 = d
+ if d.l != "" && name[0] != '[' {
+ d1.l += "."
+ }
+ d1.l += name
+ return d1
+}
+
+func keyDiff(a, b []reflect.Value) (ak, both, bk []reflect.Value) {
+ for _, av := range a {
+ inBoth := false
+ for _, bv := range b {
+ if reflect.DeepEqual(av.Interface(), bv.Interface()) {
+ inBoth = true
+ both = append(both, av)
+ break
+ }
+ }
+ if !inBoth {
+ ak = append(ak, av)
+ }
+ }
+ for _, bv := range b {
+ inBoth := false
+ for _, av := range a {
+ if reflect.DeepEqual(av.Interface(), bv.Interface()) {
+ inBoth = true
+ break
+ }
+ }
+ if !inBoth {
+ bk = append(bk, bv)
+ }
+ }
+ return
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/kr/pretty/diff_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/diff_test.go b/newt/Godeps/_workspace/src/github.com/kr/pretty/diff_test.go
new file mode 100644
index 0000000..3c388f1
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/kr/pretty/diff_test.go
@@ -0,0 +1,74 @@
+package pretty
+
+import (
+ "testing"
+)
+
+type difftest struct {
+ a interface{}
+ b interface{}
+ exp []string
+}
+
+type S struct {
+ A int
+ S *S
+ I interface{}
+ C []int
+}
+
+var diffs = []difftest{
+ {a: nil, b: nil},
+ {a: S{A: 1}, b: S{A: 1}},
+
+ {0, "", []string{`int != string`}},
+ {0, 1, []string{`0 != 1`}},
+ {S{}, new(S), []string{`pretty.S != *pretty.S`}},
+ {"a", "b", []string{`"a" != "b"`}},
+ {S{}, S{A: 1}, []string{`A: 0 != 1`}},
+ {new(S), &S{A: 1}, []string{`A: 0 != 1`}},
+ {S{S: new(S)}, S{S: &S{A: 1}}, []string{`S.A: 0 != 1`}},
+ {S{}, S{I: 0}, []string{`I: nil != 0`}},
+ {S{I: 1}, S{I: "x"}, []string{`I: int != string`}},
+ {S{}, S{C: []int{1}}, []string{`C: []int[0] != []int[1]`}},
+ {S{C: []int{}}, S{C: []int{1}}, []string{`C: []int[0] != []int[1]`}},
+ {S{C: []int{1, 2, 3}}, S{C: []int{1, 2, 4}}, []string{`C[2]: 3 != 4`}},
+ {S{}, S{A: 1, S: new(S)}, []string{`A: 0 != 1`, `S: nil != &{0 <nil> <nil> []}`}},
+}
+
+func TestDiff(t *testing.T) {
+ for _, tt := range diffs {
+ got := Diff(tt.a, tt.b)
+ eq := len(got) == len(tt.exp)
+ if eq {
+ for i := range got {
+ eq = eq && got[i] == tt.exp[i]
+ }
+ }
+ if !eq {
+ t.Errorf("diffing % #v", tt.a)
+ t.Errorf("with % #v", tt.b)
+ diffdiff(t, got, tt.exp)
+ continue
+ }
+ }
+}
+
+func diffdiff(t *testing.T, got, exp []string) {
+ minus(t, "unexpected:", got, exp)
+ minus(t, "missing:", exp, got)
+}
+
+func minus(t *testing.T, s string, a, b []string) {
+ var i, j int
+ for i = 0; i < len(a); i++ {
+ for j = 0; j < len(b); j++ {
+ if a[i] == b[j] {
+ break
+ }
+ }
+ if j == len(b) {
+ t.Error(s, a[i])
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/0766779d/newt/Godeps/_workspace/src/github.com/kr/pretty/example_test.go
----------------------------------------------------------------------
diff --git a/newt/Godeps/_workspace/src/github.com/kr/pretty/example_test.go b/newt/Godeps/_workspace/src/github.com/kr/pretty/example_test.go
new file mode 100644
index 0000000..ecf40f3
--- /dev/null
+++ b/newt/Godeps/_workspace/src/github.com/kr/pretty/example_test.go
@@ -0,0 +1,20 @@
+package pretty_test
+
+import (
+ "fmt"
+ "github.com/kr/pretty"
+)
+
+func Example() {
+ type myType struct {
+ a, b int
+ }
+ var x = []myType{{1, 2}, {3, 4}, {5, 6}}
+ fmt.Printf("%# v", pretty.Formatter(x))
+ // output:
+ // []pretty_test.myType{
+ // {a:1, b:2},
+ // {a:3, b:4},
+ // {a:5, b:6},
+ // }
+}