Skip to content

Conversation

@thekid
Copy link
Member

@thekid thekid commented Jul 19, 2020

See https://wiki.php.net/rfc/match_expression_v2 and php/php-src#5371

$statement= match ($this->lexer->lookahead['type']) {
  Lexer::T_SELECT => $this->selectStatement(),
  Lexer::T_UPDATE => $this->updateStatement(),
  Lexer::T_DELETE => $this->deleteStatement(),
  default => $this->syntaxError('SELECT, UPDATE or DELETE'),
};

This will produce a lang.ast.nodes.MatchExpression node with cases using lang.ast.nodes.MatchCondition and a default expression.

thekid added a commit to xp-framework/compiler that referenced this pull request Jul 19, 2020
@thekid thekid merged commit 0e411f8 into master Jul 20, 2020
@thekid thekid deleted the feature/match-statement branch July 20, 2020 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants