package ast import ( "code.osinet.fr/fgm/waiig15/token" "bytes" ) // LetStatement is the Node type for Let statements. type LetStatement struct { Token token.Token // the token.LET token. Why do we need it ? Name *Identifier Value Expression } // String implements Node and fmt.Stringer. func (ls *LetStatement) String() string { var out bytes.Buffer out.WriteString(ls.TokenLiteral() + " ") out.WriteString(ls.Name.String()) out.WriteString(" = ") if ls.Value != nil { out.WriteString(ls.Value.String()) } out.WriteString(";") return out.String() } func (ls *LetStatement) statementNode() {} // TokenLiteral satisfies the Node interface. func (ls *LetStatement) TokenLiteral() string { return ls.Token.Literal }