vendor update

This commit is contained in:
Abhishek
2017-03-24 00:31:39 +05:30
parent 55ad1d9b1f
commit d212758856
67 changed files with 1198 additions and 2348 deletions
+3 -11
View File
@@ -91,7 +91,7 @@ func (d *decoder) decode(name string, node ast.Node, result reflect.Value) error
return d.decodeBool(name, node, result)
case reflect.Float64:
return d.decodeFloat(name, node, result)
case reflect.Int, reflect.Int32, reflect.Int64:
case reflect.Int:
return d.decodeInt(name, node, result)
case reflect.Interface:
// When we see an interface, we make our own thing
@@ -164,11 +164,7 @@ func (d *decoder) decodeInt(name string, node ast.Node, result reflect.Value) er
return err
}
if result.Kind() == reflect.Interface {
result.Set(reflect.ValueOf(int(v)))
} else {
result.SetInt(v)
}
result.Set(reflect.ValueOf(int(v)))
return nil
case token.STRING:
v, err := strconv.ParseInt(n.Token.Value().(string), 0, 0)
@@ -176,11 +172,7 @@ func (d *decoder) decodeInt(name string, node ast.Node, result reflect.Value) er
return err
}
if result.Kind() == reflect.Interface {
result.Set(reflect.ValueOf(int(v)))
} else {
result.SetInt(v)
}
result.Set(reflect.ValueOf(int(v)))
return nil
}
}
+7 -14
View File
@@ -256,10 +256,7 @@ func (p *Parser) objectKey() ([]*ast.ObjectKey, error) {
keyCount++
keys = append(keys, &ast.ObjectKey{Token: p.tok})
case token.ILLEGAL:
return keys, &PosError{
Pos: p.tok.Pos,
Err: fmt.Errorf("illegal character"),
}
fmt.Println("illegal")
default:
return keys, &PosError{
Pos: p.tok.Pos,
@@ -346,7 +343,7 @@ func (p *Parser) listType() (*ast.ListType, error) {
}
}
switch tok.Type {
case token.BOOL, token.NUMBER, token.FLOAT, token.STRING, token.HEREDOC:
case token.NUMBER, token.FLOAT, token.STRING, token.HEREDOC:
node, err := p.literalType()
if err != nil {
return nil, err
@@ -388,16 +385,12 @@ func (p *Parser) listType() (*ast.ListType, error) {
}
l.Add(node)
needComma = true
case token.BOOL:
// TODO(arslan) should we support? not supported by HCL yet
case token.LBRACK:
node, err := p.listType()
if err != nil {
return nil, &PosError{
Pos: tok.Pos,
Err: fmt.Errorf(
"error while trying to parse list within list: %s", err),
}
}
l.Add(node)
// TODO(arslan) should we support nested lists? Even though it's
// written in README of HCL, it's not a part of the grammar
// (not defined in parse.y)
case token.RBRACK:
// finished
l.Rbrack = p.tok.Pos
+1 -1
View File
@@ -480,7 +480,7 @@ func (s *Scanner) scanString() {
// read character after quote
ch := s.next()
if (ch == '\n' && braces == 0) || ch < 0 || ch == eof {
if ch < 0 || ch == eof {
s.err("literal not terminated")
return
}
-7
View File
@@ -27,9 +27,6 @@ func Unquote(s string) (t string, err error) {
if quote != '"' {
return "", ErrSyntax
}
if !contains(s, '$') && !contains(s, '{') && contains(s, '\n') {
return "", ErrSyntax
}
// Is it trivial? Avoid allocation.
if !contains(s, '\\') && !contains(s, quote) && !contains(s, '$') {
@@ -87,10 +84,6 @@ func Unquote(s string) (t string, err error) {
}
}
if s[0] == '\n' {
return "", ErrSyntax
}
c, multibyte, ss, err := unquoteChar(s, quote)
if err != nil {
return "", err