diff --git a/entity/meta.go b/entity/meta.go index 70ec58e..4ae964d 100644 --- a/entity/meta.go +++ b/entity/meta.go @@ -10,10 +10,11 @@ import "git.tebibyte.media/fspl/fspl/errors" // Metadata represents a module metadata file. type Metadata struct { - Position errors.Position + Pos errors.Position UUID uuid.UUID Dependencies []*Dependency } +func (this *Metadata) Position () errors.Position { return this.Pos } func (this *Metadata) String () string { out := fmt.Sprint(Quote(this.UUID.String())) for _, dependency := range this.Dependencies { @@ -24,16 +25,24 @@ func (this *Metadata) String () string { // Directive is a declaration within a module metadata file. type Directive interface { + fmt.Stringer + + // Position returns the position of the directive within its metadata + // file. + Position () errors.Position + directive() } +var _ Directive = &Dependency { } // Dependency is a metadata dependency listing. type Dependency struct { - Position errors.Position + Pos errors.Position Address Address Nickname string } func (*Dependency) directive () { } +func (this *Dependency) Position () errors.Position { return this.Pos } func (this *Dependency) String () string { out := fmt.Sprint("+ ", this.Address) if this.Nickname != "" {