mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
Pattern Language rewrite (#111)
* Initial parser rewrite effort Lexer and Token cleanup, Parser started over * Greatly improved parser syntax * Reimplemented using declarations and variable placement parsing * Added back unions and structs * Added enums as well as mathematical expressions (+, -, *, /, <<, >>, &, |, ^) * Code style improvement * Implemented arrays and fixed memory issues * Fixed more memory issues in parser, reimplemented validator, evaluator and patterns * Fixed builtin types, arrays and reimplemented strings * Improved error messages * Made character a distinct type, used for chars and strings * Implemented padding, fixed arrays * Added bitfields * Added rvalue parsing, no evaluating yet * Added .idea folder to gitignore * Fixed build on MacOS * Added custom implementation of integral concept if not available * Rebased onto master * Fixed array variable decl crash * Added rvalues and dot syntax * Lower case all pattern language error messages * Fixed typo in variable name * Fixed bug where preprocessor would not ignore commented out directives * Reimplemented pointers * Fixed rebase issues
This commit is contained in:
@@ -23,4 +23,52 @@ extern char **mainArgv;
|
||||
#define MAGIC_PATH_SEPARATOR ";"
|
||||
#else
|
||||
#define MAGIC_PATH_SEPARATOR ":"
|
||||
#endif
|
||||
|
||||
template<>
|
||||
struct std::is_integral<u128> : public std::true_type { };
|
||||
template<>
|
||||
struct std::is_integral<s128> : public std::true_type { };
|
||||
template<>
|
||||
struct std::is_signed<s128> : public std::true_type { };
|
||||
|
||||
#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 12000
|
||||
#if __has_include(<concepts>)
|
||||
// Make sure we break when derived_from is implemented in libc++. Then we can fix a compatibility version above
|
||||
#include <concepts>
|
||||
#endif
|
||||
// libcxx 12 still doesn't have many default concepts implemented, as a result we need to define it ourself using clang built-ins.
|
||||
// [concept.derived] (patch from https://reviews.llvm.org/D74292)
|
||||
namespace hex {
|
||||
template<class _Dp, class _Bp>
|
||||
concept derived_from =
|
||||
__is_base_of(_Bp, _Dp) && __is_convertible_to(const volatile _Dp*, const volatile _Bp*);
|
||||
}
|
||||
|
||||
// [concepts.arithmetic] (patch from https://reviews.llvm.org/D88131)
|
||||
namespace hex {
|
||||
template<class _Tp>
|
||||
concept integral = __is_integral(_Tp);
|
||||
|
||||
template<class _Tp>
|
||||
concept signed_integral = integral<_Tp> && __is_signed(_Tp);
|
||||
|
||||
template<class _Tp>
|
||||
concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;
|
||||
|
||||
template<class _Tp>
|
||||
concept floating_point = __is_floating_point(_Tp);
|
||||
}
|
||||
#else
|
||||
// Assume supported
|
||||
#include <concepts>
|
||||
|
||||
namespace hex {
|
||||
using std::derived_from;
|
||||
|
||||
using std::integral;
|
||||
using std::signed_integral;
|
||||
using std::unsigned_integral;
|
||||
using std::floating_point;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user