Add dereference parsing #17
@ -133,6 +133,9 @@ func (argument Argument) ToString (indent int, breakLine bool) (output string) {
|
||||
|
||||
case ArgumentKindList:
|
||||
output += argument.value.(List).ToString(indent, breakLine)
|
||||
|
||||
case ArgumentKindDereference:
|
||||
output += argument.value.(Dereference).ToString(indent)
|
||||
|
||||
case ArgumentKindIdentifier:
|
||||
output += doIndent (
|
||||
@ -276,6 +279,16 @@ func (behavior FaceBehavior) ToString (indent int) (output string) {
|
||||
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) {
|
||||
if ownLine {
|
||||
output += doIndent(indent)
|
||||
|
@ -97,10 +97,8 @@ const (
|
||||
ArgumentKindList
|
||||
|
||||
// {name}
|
||||
ArgumentKindDereference
|
||||
|
||||
// {name 23}
|
||||
ArgumentKindSubscript
|
||||
ArgumentKindDereference
|
||||
|
||||
// name.name
|
||||
// name.name.name
|
||||
@ -220,6 +218,15 @@ type FaceSection struct {
|
||||
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.
|
||||
type PhraseKind int
|
||||
|
||||
|
Reference in New Issue
Block a user