Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add support for match expression#8

Merged
thekid merged 6 commits into
masterxp-framework/ast:masterfrom
feature/match-statementxp-framework/ast:feature/match-statementCopy head branch name to clipboard
Jul 20, 2020
Merged

Add support for match expression#8
thekid merged 6 commits into
masterxp-framework/ast:masterfrom
feature/match-statementxp-framework/ast:feature/match-statementCopy head branch name to clipboard

Conversation

@thekid
Copy link
Copy Markdown
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.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.