diff options
author | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
---|---|---|
committer | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
commit | 107c1cdb09c575aa2f61d97f48d8587eb6bada4c (patch) | |
tree | ca7d008643efc555c388baeaf1d986e0b6b3e28c /vendor/github.com/hashicorp/hcl2/hcl/pos.go | |
parent | 844b5a68d8af4791755b8f0ad293cc99f5959183 (diff) | |
download | terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.gz terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.zst terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.zip |
Upgrade to 0.12
Diffstat (limited to 'vendor/github.com/hashicorp/hcl2/hcl/pos.go')
-rw-r--r-- | vendor/github.com/hashicorp/hcl2/hcl/pos.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/hcl2/hcl/pos.go b/vendor/github.com/hashicorp/hcl2/hcl/pos.go index 1a4b329..06db8bf 100644 --- a/vendor/github.com/hashicorp/hcl2/hcl/pos.go +++ b/vendor/github.com/hashicorp/hcl2/hcl/pos.go | |||
@@ -31,6 +31,9 @@ type Pos struct { | |||
31 | Byte int | 31 | Byte int |
32 | } | 32 | } |
33 | 33 | ||
34 | // InitialPos is a suitable position to use to mark the start of a file. | ||
35 | var InitialPos = Pos{Byte: 0, Line: 1, Column: 1} | ||
36 | |||
34 | // Range represents a span of characters between two positions in a source | 37 | // Range represents a span of characters between two positions in a source |
35 | // file. | 38 | // file. |
36 | // | 39 | // |
@@ -94,6 +97,16 @@ func RangeOver(a, b Range) Range { | |||
94 | } | 97 | } |
95 | } | 98 | } |
96 | 99 | ||
100 | // ContainsPos returns true if and only if the given position is contained within | ||
101 | // the receiving range. | ||
102 | // | ||
103 | // In the unlikely case that the line/column information disagree with the byte | ||
104 | // offset information in the given position or receiving range, the byte | ||
105 | // offsets are given priority. | ||
106 | func (r Range) ContainsPos(pos Pos) bool { | ||
107 | return r.ContainsOffset(pos.Byte) | ||
108 | } | ||
109 | |||
97 | // ContainsOffset returns true if and only if the given byte offset is within | 110 | // ContainsOffset returns true if and only if the given byte offset is within |
98 | // the receiving Range. | 111 | // the receiving Range. |
99 | func (r Range) ContainsOffset(offset int) bool { | 112 | func (r Range) ContainsOffset(offset int) bool { |