From 16ce140272a686c3968c40fb9542ab4ed69f80c1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 6 Nov 2015 18:29:48 -0800 Subject: [PATCH] hcl/token: add Value for IDENT --- hcl/token/token.go | 2 ++ hcl/token/token_test.go | 1 + 2 files changed, 3 insertions(+) diff --git a/hcl/token/token.go b/hcl/token/token.go index 26291d0..32015a2 100644 --- a/hcl/token/token.go +++ b/hcl/token/token.go @@ -133,6 +133,8 @@ func (t Token) Value() interface{} { } return int64(v) + case IDENT: + return t.Text case STRING: // It is wrapped in quotes always return t.Text[1 : len(t.Text)-1] diff --git a/hcl/token/token_test.go b/hcl/token/token_test.go index 8876ed1..014e76c 100644 --- a/hcl/token/token_test.go +++ b/hcl/token/token_test.go @@ -47,6 +47,7 @@ func TestTokenValue(t *testing.T) { {Token{Type: BOOL, Text: `false`}, false}, {Token{Type: FLOAT, Text: `3.14`}, float64(3.14)}, {Token{Type: NUMBER, Text: `42`}, int64(42)}, + {Token{Type: IDENT, Text: `foo`}, "foo"}, {Token{Type: STRING, Text: `"foo"`}, "foo"}, }