Fix some parsing issues for MatchExpression
This commit is contained in:
parent
b6706dd801
commit
fb5a9df48b
1 changed files with 4 additions and 2 deletions
|
@ -241,10 +241,12 @@ after_constraints:
|
||||||
{
|
{
|
||||||
Tokens.get();
|
Tokens.get();
|
||||||
auto T1 = Tokens.peek();
|
auto T1 = Tokens.peek();
|
||||||
Expression* Value = nullptr;
|
Expression* Value;
|
||||||
BlockStart* BlockStart;
|
BlockStart* BlockStart;
|
||||||
if (llvm::isa<class BlockStart>(T1)) {
|
if (llvm::isa<class BlockStart>(T1)) {
|
||||||
|
Value = nullptr;
|
||||||
BlockStart = static_cast<class BlockStart*>(T1);
|
BlockStart = static_cast<class BlockStart*>(T1);
|
||||||
|
Tokens.get();
|
||||||
} else {
|
} else {
|
||||||
Value = parseExpression();
|
Value = parseExpression();
|
||||||
BlockStart = expectToken<class BlockStart>();
|
BlockStart = expectToken<class BlockStart>();
|
||||||
|
@ -269,7 +271,7 @@ after_constraints:
|
||||||
Tokens.get();
|
Tokens.get();
|
||||||
return new ConstantExpression(T0);
|
return new ConstantExpression(T0);
|
||||||
default:
|
default:
|
||||||
throw UnexpectedTokenDiagnostic(File, T0, std::vector { NodeKind::Identifier, NodeKind::IntegerLiteral, NodeKind::StringLiteral });
|
throw UnexpectedTokenDiagnostic(File, T0, { NodeKind::MatchKeyword, NodeKind::Identifier, NodeKind::IdentifierAlt, NodeKind::IntegerLiteral, NodeKind::StringLiteral });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue