package ast import ( "code.osinet.fr/fgm/waiig15/token" "bytes" ) // ReturnStatement fulfills the Node and Statement interfaces. type ReturnStatement struct { Token token.Token // the token.RETURN token. Why do we need it ? Name *Identifier ReturnValue Expression } // String satisfies the Node and fmt.Stringer interfaces. func (rs *ReturnStatement) String() string { var out bytes.Buffer out.WriteString(rs.TokenLiteral() + " ") if rs.ReturnValue != nil { out.WriteString(rs.ReturnValue.String()) } out.WriteString(";") return out.String() } func (rs *ReturnStatement) statementNode() {} // TokenLiteral satisfies the Node interface. func (rs *ReturnStatement) TokenLiteral() string { return rs.Token.Literal }