123456789101112131415161718192021222324252627 |
- package ast
- import "code.osinet.fr/fgm/waiig15/token"
- // ExpressionStatement fulfills the Node and Statement interfaces.
- // It represents a statement made of a bare expression like:
- // x + 10;
- type ExpressionStatement struct {
- Token token.Token // the first token of the expression
- Expression Expression
- }
- // String satisfies the Node and fmt.Stringer interfaces.
- func (es *ExpressionStatement) String() string {
- if es.Expression != nil {
- return es.Expression.String()
- }
- return "";
- }
- func (es *ExpressionStatement) statementNode() {}
- // TokenLiteral satisfies the Node interface.
- func (es *ExpressionStatement) TokenLiteral() string {
- return es.Token.Literal
- }
|