Slight performance improvements for parsing statements.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
a9c3a9e0c4
commit
037470a0ce
|
@ -547,12 +547,17 @@ namespace MalachScript::Parser {
|
|||
}
|
||||
|
||||
bool Parser::ParseStatement(ScopedPtr<const ParsedStatement>& out, const LexToken*& currentToken) {
|
||||
// TODO: All the other statements.
|
||||
|
||||
return ParseIfStatement(out, currentToken) || ParseForStatement(out, currentToken) ||
|
||||
ParseWhileStatement(out, currentToken) || ParseReturn(out, currentToken) ||
|
||||
ParseStatBlock(out, currentToken) || ParseBreak(out, currentToken) || ParseContinue(out, currentToken) ||
|
||||
ParseExprStat(out, currentToken);
|
||||
// TODO: All the other statements. (dowhile | switch | try );
|
||||
switch (currentToken->GetKind()) {
|
||||
case LexTokenKind::IfKeyword: return ParseIfStatement(out, currentToken);
|
||||
case LexTokenKind::ForKeyword: return ParseForStatement(out, currentToken);
|
||||
case LexTokenKind::WhileKeyword: return ParseWhileStatement(out, currentToken);
|
||||
case LexTokenKind::ReturnKeyword: return ParseReturn(out, currentToken);
|
||||
case LexTokenKind::BreakKeyword: return ParseBreak(out, currentToken);
|
||||
case LexTokenKind::ContinueKeyword: return ParseContinue(out, currentToken);
|
||||
default: return ParseStatBlock(out, currentToken) || ParseExprStat(out, currentToken);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Parser::ParseVar([[maybe_unused]] ScopedPtr<const ParsedStatement>& out, const LexToken*& currentToken) {
|
||||
|
|
Loading…
Reference in New Issue