1234567891011121314151617181920212223242526272829 |
- 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
- }
|