X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=vendor%2Fgithub.com%2Fhashicorp%2Fhcl2%2Fhcl%2Fpos.go;h=06db8bfbd4f8e3708467a7e856e1fd67193d6ef6;hb=107c1cdb09c575aa2f61d97f48d8587eb6bada4c;hp=1a4b329dcfbbabce33af854c18b05a094638c200;hpb=844b5a68d8af4791755b8f0ad293cc99f5959183;p=github%2Ffretlink%2Fterraform-provider-statuscake.git 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 { Byte int } +// InitialPos is a suitable position to use to mark the start of a file. +var InitialPos = Pos{Byte: 0, Line: 1, Column: 1} + // Range represents a span of characters between two positions in a source // file. // @@ -94,6 +97,16 @@ func RangeOver(a, b Range) Range { } } +// ContainsPos returns true if and only if the given position is contained within +// the receiving range. +// +// In the unlikely case that the line/column information disagree with the byte +// offset information in the given position or receiving range, the byte +// offsets are given priority. +func (r Range) ContainsPos(pos Pos) bool { + return r.ContainsOffset(pos.Byte) +} + // ContainsOffset returns true if and only if the given byte offset is within // the receiving Range. func (r Range) ContainsOffset(offset int) bool {