Auto-update dlang core files [skip ci]
This commit is contained in:
1 parent
c8a040ed7c
commit
890f4290b6
5 files changed
+21
-10
No files matched your search
@@ -46,10 +46,13 @@ Token& Parser::ShouldBe(TokenType type, const std::string& value)
|
||||
const auto& current = Current();
|
||||
|
||||
if (current.type != type)
|
||||
throw std::runtime_error("Unexpected type '" + std::string(TokenTypeToString(current.type)) + "' where '" + std::string(TokenTypeToString(type)) + "' should be " + LocationText(current));
|
||||
throw std::runtime_error("Syntax Error: Expected token type '" + std::string(TokenTypeToString(type)) +
|
||||
"' but got '" + std::string(TokenTypeToString(current.type)) +
|
||||
"' (value: '" + current.value + "') " + LocationText(current));
|
||||
|
||||
if(!value.empty() && value != current.value)
|
||||
throw std::runtime_error("Unexpected value '" + current.value + "' where '" + value + "' should be " + LocationText(current));
|
||||
if (!value.empty() && value != current.value)
|
||||
throw std::runtime_error("Syntax Error: Expected specific value '" + value +
|
||||
"' but got '" + current.value + "' " + LocationText(current));
|
||||
|
||||
return Consume();
|
||||
}
|
||||
@@ -481,7 +484,11 @@ std::unique_ptr<Expression> Parser::ParsePrimary()
|
||||
return left;
|
||||
}
|
||||
|
||||
throw std::runtime_error("Expected expression " + LocationText(current));
|
||||
std::string tokenDesc = std::string(TokenTypeToString(current.type));
|
||||
if (!current.value.empty()) {
|
||||
tokenDesc += " ('" + current.value + "')";
|
||||
}
|
||||
throw std::runtime_error("Expected expression, but found unexpected token type " + tokenDesc + " " + LocationText(current));
|
||||
}
|
||||
|
||||
std::unique_ptr<Expression> Parser::ParseMultiplicative()
|
||||
|
||||
Reference in new issue
Block a user