Lattice Land Core Library
Loading...
Searching...
No Matches
diagnostics.hpp File Reference
#include "battery/utility.hpp"
#include "battery/vector.hpp"
#include "battery/string.hpp"
#include "battery/tuple.hpp"
#include "battery/variant.hpp"
#include "ast.hpp"

Go to the source code of this file.

Classes

class  lala::IDiagnostics
 

Namespaces

namespace  lala
 

Macros

#define INTERPRETATION_ERROR(MSG)
 
#define INTERPRETATION_WARNING(MSG)
 
#define RETURN_INTERPRETATION_ERROR(MSG)
 
#define RETURN_INTERPRETATION_WARNING(MSG)
 
#define CALL_WITH_ERROR_CONTEXT_WITH_MERGE(MSG, CALL, MERGE)
 
#define CALL_WITH_ERROR_CONTEXT(MSG, CALL)
 

Macro Definition Documentation

◆ INTERPRETATION_ERROR

#define INTERPRETATION_ERROR ( MSG)
Value:
if constexpr(diagnose) { \
diagnostics.add_suberror(IDiagnostics(true, name, (MSG), f)); \
}

◆ INTERPRETATION_WARNING

#define INTERPRETATION_WARNING ( MSG)
Value:
if constexpr(diagnose) { \
diagnostics.add_suberror(IDiagnostics(false, name, (MSG), f)); \
}

◆ RETURN_INTERPRETATION_ERROR

#define RETURN_INTERPRETATION_ERROR ( MSG)
Value:
return false;
#define INTERPRETATION_ERROR(MSG)
Definition diagnostics.hpp:145

◆ RETURN_INTERPRETATION_WARNING

#define RETURN_INTERPRETATION_WARNING ( MSG)
Value:
return true;
#define INTERPRETATION_WARNING(MSG)
Definition diagnostics.hpp:150

◆ CALL_WITH_ERROR_CONTEXT_WITH_MERGE

#define CALL_WITH_ERROR_CONTEXT_WITH_MERGE ( MSG,
CALL,
MERGE )
Value:
size_t error_context = 0; \
if constexpr(diagnose) { \
diagnostics.add_suberror(IDiagnostics(false, name, (MSG), f)); \
error_context = diagnostics.num_suberrors(); \
} \
bool res = CALL; \
if constexpr(diagnose) { \
diagnostics.merge(res, error_context); \
} \
if(res) { MERGE; } \
return res;

This macro creates a high-level error message that is possibly erased if call does not lead to any error. If call leads to errors, these errors are moved as suberrors of the high-level error message. Additionally, merge is executed if call does not lead to any error.

◆ CALL_WITH_ERROR_CONTEXT

#define CALL_WITH_ERROR_CONTEXT ( MSG,
CALL )
Value:
#define CALL_WITH_ERROR_CONTEXT_WITH_MERGE(MSG, CALL, MERGE)
Definition diagnostics.hpp:167