summaryrefslogtreecommitdiff
path: root/vendor/github.com/hashicorp/hil/ast/arithmetic.go
diff options
context:
space:
mode:
authorFlavio Castelli <fcastelli@suse.com>2017-05-03 11:37:08 +0200
committerAlvaro <alvaro.saurin@gmail.com>2017-05-03 11:40:31 +0200
commitee12004ab93e54f326896e9909ba9e6a2bd11e89 (patch)
tree1ea30d204b04425ebd1dadaf8cc991d572c7f0fb /vendor/github.com/hashicorp/hil/ast/arithmetic.go
parenta286dc5494691c2b04c48ef6695ed0c902912c0f (diff)
downloadterraform-provider-libvirt-ee12004ab93e54f326896e9909ba9e6a2bd11e89.tar
terraform-provider-libvirt-ee12004ab93e54f326896e9909ba9e6a2bd11e89.tar.gz
Vendor dependencies with vndr
This fixes issue #123
Diffstat (limited to 'vendor/github.com/hashicorp/hil/ast/arithmetic.go')
-rw-r--r--vendor/github.com/hashicorp/hil/ast/arithmetic.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/hil/ast/arithmetic.go b/vendor/github.com/hashicorp/hil/ast/arithmetic.go
new file mode 100644
index 00000000..94dc24f8
--- /dev/null
+++ b/vendor/github.com/hashicorp/hil/ast/arithmetic.go
@@ -0,0 +1,43 @@
+package ast
+
+import (
+ "bytes"
+ "fmt"
+)
+
+// Arithmetic represents a node where the result is arithmetic of
+// two or more operands in the order given.
+type Arithmetic struct {
+ Op ArithmeticOp
+ Exprs []Node
+ Posx Pos
+}
+
+func (n *Arithmetic) Accept(v Visitor) Node {
+ for i, expr := range n.Exprs {
+ n.Exprs[i] = expr.Accept(v)
+ }
+
+ return v(n)
+}
+
+func (n *Arithmetic) Pos() Pos {
+ return n.Posx
+}
+
+func (n *Arithmetic) GoString() string {
+ return fmt.Sprintf("*%#v", *n)
+}
+
+func (n *Arithmetic) String() string {
+ var b bytes.Buffer
+ for _, expr := range n.Exprs {
+ b.WriteString(fmt.Sprintf("%s", expr))
+ }
+
+ return b.String()
+}
+
+func (n *Arithmetic) Type(Scope) (Type, error) {
+ return TypeInt, nil
+}