identifier.go 460 B

123456789101112131415161718192021
  1. package ast
  2. import "code.osinet.fr/fgm/waiig15/token"
  3. // Identifier is the Node type for identifiers.
  4. type Identifier struct {
  5. Token token.Token // the token.IDENT token. Why do we need it ?
  6. Value string // The identifier string.
  7. }
  8. func (i *Identifier) String() string {
  9. return i.Value
  10. }
  11. func (i *Identifier) expressionNode() {}
  12. // TokenLiteral satisfies the Node interface.
  13. func (i *Identifier) TokenLiteral() string {
  14. return i.Token.Literal
  15. }