Skip to content
Extraits de code Groupes Projets
Vérifiée Valider dff1eac4 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

PARSING: Add more options to throw with unexpected tokens (add a message)

parent efd0b0cd
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!25Draft: New Vivy module spec
Pipeline #2873 réussi
......@@ -13,6 +13,19 @@ IrElement::throwUnexpectedToken(const Token &tok) const
tok.toString());
}
void
IrElement::throwUnexpectedToken(const Token &tok, const std::string &msg) const
{
throw std::runtime_error("Unexpected token in location " + tok.location().toString() + ": " +
tok.toString() + " with message: " + msg);
}
void
IrElement::throwUnexpectedToken(const Token &tok, const char *msg) const
{
throwUnexpectedToken(tok, std::string(msg));
}
IrElement::~IrElement() noexcept
{
std::erase_if(childElements, [this](IrElement *child) noexcept -> bool {
......
......@@ -116,7 +116,9 @@ protected:
void detachElementFromParent() noexcept;
void addChild(IrElement *) noexcept;
void throwUnexpectedToken(const Token &tok) const;
[[noreturn]] void throwUnexpectedToken(const Token &) const;
[[noreturn]] void throwUnexpectedToken(const Token &, const std::string &) const;
[[noreturn]] void throwUnexpectedToken(const Token &, const char *) const;
public:
virtual ~IrElement() noexcept;
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter