#ifndef SYNTAX_LANGS_H #define SYNTAX_LANGS_H #include "syntax/decl.h" #define DEF_LANG(name) \ std::unique_ptr name##_parse( \ std::vector *tokens, StateBase *in_state, const char *text, \ uint32_t len, uint32_t line_num); \ bool name##_state_match(StateBase *state_1, StateBase *state_2); #define LANG_A(name) \ { \ #name, { name##_parse, name##_state_match } \ } template std::unique_ptr static_unique_ptr_cast(std::unique_ptr &&p) { return std::unique_ptr(static_cast(p.release())); } DEF_LANG(ruby); DEF_LANG(bash); inline static const std::unordered_map< std::string, std::tuple (*)( std::vector *tokens, StateBase *in_state, const char *text, uint32_t len, uint32_t line_num), bool (*)(StateBase *state_1, StateBase *state_2)>> parsers = { LANG_A(ruby), LANG_A(bash), }; #endif