Add the cool epic to meta

This commit is contained in:
Sasha Koshka 2024-03-14 02:43:59 -04:00
parent 0a56a61f4f
commit 2be41be609

View File

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