123456789101112131415161718192021222324 |
- package parser
- import (
- "code.osinet.fr/fgm/waiig15/ast"
- "code.osinet.fr/fgm/waiig15/token"
- )
- func (p *Parser) parseReturnStatement() *ast.ReturnStatement {
- stmt := &ast.ReturnStatement{
- Token: p.curToken,
- }
- // There should be an expression to consume here.
- p.nextToken()
- // Skip the expression for now, progress to the semicolon terminating the
- // statement.
- for !p.curTokenIs(token.SEMICOLON) {
- p.nextToken()
- }
- return stmt
- }
|