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 } func (p *Parser) registerInfix(tokenType token.TokenType, fn infixParseFn) { p.infixParseFns[tokenType] = fn } func (p *Parser) registerPrefix(tokenType token.TokenType, fn prefixParseFn) { p.prefixParseFns[tokenType] = fn }