1234567891011121314151617181920 |
- package parser
- import (
- "code.osinet.fr/fgm/waiig15/ast"
- )
- func (p *Parser) parsePrefixExpression() ast.Expression {
- expression := &ast.PrefixExpression{
- Token: p.curToken,
- Operator: p.curToken.Literal,
- }
- // Consume the operator token to progress to the prefixed expression.
- p.nextToken()
- // The precedence is now that of the prefix operator instead of the lowest.
- expression.Right = p.parseExpression(PREFIX)
- return expression
- }
|