xgo/compiler/ast/ident.go

30 lines
559 B
Go
Raw Normal View History

2019-01-09 10:17:42 +03:00
package ast
2019-01-11 13:27:28 +03:00
import "github.com/d5/tengo/compiler/source"
2019-01-09 10:17:42 +03:00
2019-01-17 12:56:05 +03:00
// Ident represents an identifier.
2019-01-09 10:17:42 +03:00
type Ident struct {
Name string
NamePos source.Pos
2019-01-09 10:17:42 +03:00
}
func (e *Ident) exprNode() {}
// Pos returns the position of first character belonging to the node.
func (e *Ident) Pos() source.Pos {
2019-01-09 10:17:42 +03:00
return e.NamePos
}
// End returns the position of first character immediately after the node.
func (e *Ident) End() source.Pos {
return source.Pos(int(e.NamePos) + len(e.Name))
2019-01-09 10:17:42 +03:00
}
func (e *Ident) String() string {
if e != nil {
return e.Name
}
return nullRep
}