2021-04-19 23:34:39 +01:00
|
|
|
/* -*- C++ -*-
|
2021-03-22 19:53:10 +00:00
|
|
|
* Serene programming language.
|
|
|
|
*
|
2021-04-19 23:34:39 +01:00
|
|
|
* Copyright (c) 2019-2021 Sameer Rahmani <lxsameer@gnu.org>
|
2021-03-22 19:53:10 +00:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2021-04-19 23:34:39 +01:00
|
|
|
#ifndef SERENE_ERRORS_CONSTANTS_H
|
|
|
|
#define SERENE_ERRORS_CONSTANTS_H
|
2021-03-22 19:53:10 +00:00
|
|
|
|
2021-04-19 23:34:39 +01:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2021-03-22 19:53:10 +00:00
|
|
|
|
|
|
|
namespace serene {
|
2021-04-19 23:34:39 +01:00
|
|
|
namespace errors {
|
2021-04-22 00:49:11 +01:00
|
|
|
|
2021-04-19 23:34:39 +01:00
|
|
|
enum ErrID {
|
|
|
|
E0000,
|
|
|
|
E0001,
|
2021-03-22 19:53:10 +00:00
|
|
|
|
2021-04-19 23:34:39 +01:00
|
|
|
};
|
2021-03-22 19:53:10 +00:00
|
|
|
|
2021-04-22 00:49:11 +01:00
|
|
|
struct ErrorVariant {
|
|
|
|
ErrID id;
|
|
|
|
std::string description;
|
|
|
|
std::string longDescription;
|
|
|
|
|
|
|
|
ErrorVariant(ErrID id, std::string desc, std::string longDesc)
|
|
|
|
: id(id), description(desc), longDescription(longDesc){};
|
|
|
|
};
|
|
|
|
|
|
|
|
static ErrorVariant
|
|
|
|
UnknownError(E0000, "Can't find any description for this error.", "");
|
|
|
|
static ErrorVariant
|
|
|
|
DefExpectSymbol(E0001, "The first argument to 'def' has to be a Symbol.",
|
|
|
|
"");
|
|
|
|
|
|
|
|
static std::map<ErrID, ErrorVariant *> ErrDesc = {{E0000, &UnknownError},
|
|
|
|
{E0001, &DefExpectSymbol}};
|
2021-03-22 19:53:10 +00:00
|
|
|
|
2021-04-19 23:34:39 +01:00
|
|
|
} // namespace errors
|
2021-03-22 19:53:10 +00:00
|
|
|
} // namespace serene
|
2021-04-19 23:34:39 +01:00
|
|
|
#endif
|