php-parser/node/identifier.go

30 lines
467 B
Go
Raw Normal View History

package node
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/token"
)
type Identifier struct {
2017-12-27 17:55:58 +00:00
name string
token token.Token
}
2017-12-27 17:55:58 +00:00
func (n Identifier) Name() string {
return "Identifier"
}
func NewIdentifier(token token.Token) Node {
return Identifier{
2017-12-27 17:55:58 +00:00
"Identifier",
token,
}
}
func (n Identifier) Print(out io.Writer, indent string) {
2017-12-27 17:55:58 +00:00
fmt.Fprintf(out, "\n%v%v [- -]", indent, n.name)
fmt.Fprintf(out, "\n%vname: %q", indent+" ", n.token.Value)
}