feat(aa): a Constraint and Kind method to the Rule interface.

This commit is contained in:
Alexandre Pujol 2024-05-04 23:41:47 +01:00
parent a5c4eab0cf
commit f763d31a07
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
18 changed files with 210 additions and 19 deletions

View file

@ -40,7 +40,7 @@ func (r *Comment) IsPreamble() bool {
return true
}
func (r *Comment) Constraint() RuleConstraint {
func (r *Comment) Constraint() constraint {
return anyKind
}
@ -71,6 +71,14 @@ func (r *Abi) String() string {
return renderTemplate(tokABI, r)
}
func (r *Abi) Constraint() constraint {
return preambleKind
}
func (r *Abi) Kind() string {
return tokABI
}
type Alias struct {
RuleBase
Path string
@ -94,6 +102,14 @@ func (r *Alias) String() string {
return renderTemplate(tokALIAS, r)
}
func (r *Alias) Constraint() constraint {
return preambleKind
}
func (r *Alias) Kind() string {
return tokALIAS
}
type Include struct {
RuleBase
IfExists bool
@ -121,6 +137,14 @@ func (r *Include) String() string {
return renderTemplate(tokINCLUDE, r)
}
func (r *Include) Constraint() constraint {
return anyKind
}
func (r *Include) Kind() string {
return tokINCLUDE
}
type Variable struct {
RuleBase
Name string
@ -146,3 +170,11 @@ func (r *Variable) Equals(other any) bool {
func (r *Variable) String() string {
return renderTemplate("variable", r)
}
func (r *Variable) Constraint() constraint {
return preambleKind
}
func (r *Variable) Kind() string {
return tokVARIABLE
}