| 101 | }; |
| 102 | |
| 103 | class compiler_type final { |
| 104 | public: |
| 105 | // Symbol Table |
| 106 | static const mapping<std::string, signal_types> signal_map; |
| 107 | static const mapping<std::string, action_types> action_map; |
| 108 | static const mapping<std::string, std::function<token_base *()>> reserved_map; |
| 109 | static const mapping<char32_t, char32_t> escape_map; |
| 110 | static const set_t<char32_t> signals; |
| 111 | static const mapping<signal_types, int> signal_level_map; |
| 112 | static const set_t<signal_types> signal_left_associative; |
| 113 | |
| 114 | // Lexer |
| 115 | static bool issignal(char32_t ch) |
| 116 | { |
| 117 | return signals.count(ch) > 0; |
| 118 | } |
| 119 | |
| 120 | private: |
| 121 | // Constants Pool |
| 122 | std::vector<var> constant_pool; |
| 123 | // Status |
| 124 | bool inside_lambda = false; |
| 125 | bool no_optimize = false; |
| 126 | // Context |
| 127 | context_t context; |
| 128 | // Translator |
| 129 | translator_type translator; |
| 130 | |
| 131 | // Preprocessor |
| 132 | class preprocessor; |
| 133 | |
| 134 | // Lexer |
| 135 | void process_char_buff(const std::deque<char> &, std::deque<token_base *> &, charset); |
| 136 | |
| 137 | void process_token_buff(std::deque<token_base *> &, std::deque<std::deque<token_base *>> &); |
| 138 | |
| 139 | void translate_into_tokens(const std::deque<char> &, std::deque<token_base *> &, charset); |
| 140 | |
| 141 | void process_empty_brackets(std::deque<token_base *> &); |
| 142 | |
| 143 | void process_brackets(std::deque<token_base *> &); |
| 144 | |
| 145 | // AST Builder |
| 146 | int get_signal_level(token_base *ptr) |
| 147 | { |
| 148 | if (ptr == nullptr) |
| 149 | throw compile_error("Get the level of null token."); |
| 150 | if (ptr->get_type() != token_types::signal) |
| 151 | throw compile_error("Get the level of non-signal token."); |
| 152 | return signal_level_map.match(static_cast<token_signal *>(ptr)->get_signal()); |
| 153 | } |
| 154 | |
| 155 | bool is_left_associative(token_base *ptr) |
| 156 | { |
| 157 | if (ptr == nullptr) |
| 158 | throw compile_error("Get the level of null token."); |
| 159 | if (ptr->get_type() != token_types::signal) |
| 160 | throw compile_error("Get the level of non-signal token."); |
nothing calls this directly
no outgoing calls
no test coverage detected