More tree changes
This commit is contained in:
parent
edd4b39642
commit
c4101dcd33
@ -169,18 +169,6 @@ func (phrase Phrase) Kind () (kind PhraseKind) {
|
||||
return
|
||||
}
|
||||
|
||||
// ArgumentsLength returns the amount of arguments in the phrase.
|
||||
func (phrase Phrase) ArgumentsLength () (length int) {
|
||||
length = len(phrase.arguments)
|
||||
return
|
||||
}
|
||||
|
||||
// Argument returns the argument at index.
|
||||
func (phrase Phrase) Argument (index int) (argument Argument) {
|
||||
argument = phrase.arguments[index]
|
||||
return
|
||||
}
|
||||
|
||||
// ReturneesLength returns the amount of things the phrase returns to.
|
||||
func (phrase Phrase) ReturneesLength () (length int) {
|
||||
length = len(phrase.returnees)
|
||||
|
@ -43,7 +43,7 @@ type typeable struct {
|
||||
|
||||
// Type returns the type of the node.
|
||||
func (trait typeable) Type () (what Type) {
|
||||
what = trait.what
|
||||
what = trait.what
|
||||
return
|
||||
}
|
||||
|
||||
@ -60,17 +60,28 @@ func (trait permissionable) Permission () (permission types.Permission) {
|
||||
|
||||
// valuable allows a node to have an argument value.
|
||||
type valuable struct {
|
||||
value Argument
|
||||
}
|
||||
|
||||
// Value returns the value argument of the node.
|
||||
func (trait valuable) Value () (value Argument) {
|
||||
value = trait.value
|
||||
return
|
||||
}
|
||||
|
||||
// multiValuable allows a node to have several argument values.
|
||||
type multiValuable struct {
|
||||
values []Argument
|
||||
}
|
||||
|
||||
// Length returns the amount of default values in the node.
|
||||
func (node valuable) Length () (length int) {
|
||||
length = len(node.values)
|
||||
return
|
||||
}
|
||||
|
||||
// Value returns the default value at the specified index.
|
||||
func (node valuable) Value (index int) (value Argument) {
|
||||
value = node.values[index]
|
||||
// Value returns the value at index.
|
||||
func (trait multiValuable) Value (index int) (value Argument) {
|
||||
value = trait.values[index]
|
||||
return
|
||||
}
|
||||
|
||||
// Length returns the amount of values in the mode.
|
||||
func (trait multiValuable) Length () (length int) {
|
||||
length = len(trait.values)
|
||||
return
|
||||
}
|
||||
|
@ -82,6 +82,12 @@ type Declaration struct {
|
||||
typeable
|
||||
}
|
||||
|
||||
// List represents an array or object literal.
|
||||
type List struct {
|
||||
locatable
|
||||
multiValuable
|
||||
}
|
||||
|
||||
// ArgumentKind specifies the type of thing the value of an argument should be
|
||||
// cast to.
|
||||
type ArgumentKind int
|
||||
@ -94,6 +100,9 @@ const (
|
||||
// etc...
|
||||
ArgumentKindPhrase
|
||||
|
||||
// (argument argument argument)
|
||||
ArgumentKindList
|
||||
|
||||
// {name}
|
||||
ArgumentKindDereference
|
||||
|
||||
@ -221,8 +230,8 @@ const (
|
||||
type Phrase struct {
|
||||
location file.Location
|
||||
command Argument
|
||||
arguments []Argument
|
||||
returnees []Argument
|
||||
multiValuable
|
||||
|
||||
kind PhraseKind
|
||||
|
||||
|
Reference in New Issue
Block a user