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