Add dereference to tree
This commit is contained in:
parent
746fda6843
commit
1cd7511ced
@ -133,6 +133,9 @@ func (argument Argument) ToString (indent int, breakLine bool) (output string) {
|
|||||||
|
|
||||||
case ArgumentKindList:
|
case ArgumentKindList:
|
||||||
output += argument.value.(List).ToString(indent, breakLine)
|
output += argument.value.(List).ToString(indent, breakLine)
|
||||||
|
|
||||||
|
case ArgumentKindDereference:
|
||||||
|
output += argument.value.(Dereference).ToString(indent)
|
||||||
|
|
||||||
case ArgumentKindIdentifier:
|
case ArgumentKindIdentifier:
|
||||||
output += doIndent (
|
output += doIndent (
|
||||||
@ -276,6 +279,16 @@ func (behavior FaceBehavior) ToString (indent int) (output string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (dereference Dereference) ToString (indent int) (output string) {
|
||||||
|
output += "{"
|
||||||
|
output += dereference.argument.ToString(indent, false)
|
||||||
|
if dereference.offset != 0 {
|
||||||
|
output += fmt.Sprint(" ", dereference.offset)
|
||||||
|
}
|
||||||
|
output += "}"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (phrase Phrase) ToString (indent int, ownLine bool) (output string) {
|
func (phrase Phrase) ToString (indent int, ownLine bool) (output string) {
|
||||||
if ownLine {
|
if ownLine {
|
||||||
output += doIndent(indent)
|
output += doIndent(indent)
|
||||||
|
@ -97,10 +97,8 @@ const (
|
|||||||
ArgumentKindList
|
ArgumentKindList
|
||||||
|
|
||||||
// {name}
|
// {name}
|
||||||
ArgumentKindDereference
|
|
||||||
|
|
||||||
// {name 23}
|
// {name 23}
|
||||||
ArgumentKindSubscript
|
ArgumentKindDereference
|
||||||
|
|
||||||
// name.name
|
// name.name
|
||||||
// name.name.name
|
// name.name.name
|
||||||
@ -220,6 +218,15 @@ type FaceSection struct {
|
|||||||
FaceBehavior
|
FaceBehavior
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dereference represents a pointer dereference or array subscript.
|
||||||
|
type Dereference struct {
|
||||||
|
locatable
|
||||||
|
valuable
|
||||||
|
|
||||||
|
// if a simple dereference was parsed, this should just be zero.
|
||||||
|
offset int
|
||||||
|
}
|
||||||
|
|
||||||
// PhraseKind determines what semantic role a phrase plays.
|
// PhraseKind determines what semantic role a phrase plays.
|
||||||
type PhraseKind int
|
type PhraseKind int
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user