NOTE: This only supports up to Godot 4.0-dev2; does not support any 4.x releases.
| 141 | |
| 142 | // NOTE: This only supports up to Godot 4.0-dev2; does not support any 4.x releases. |
| 143 | class GDScriptV1TokenizerTextCompat : public GDScriptTokenizerV1Compat { |
| 144 | public: |
| 145 | using TokenType = GDScriptDecomp::GlobalToken; |
| 146 | using T = TokenType; |
| 147 | |
| 148 | enum { |
| 149 | MAX_LOOKAHEAD = 4, |
| 150 | TK_RB_SIZE = MAX_LOOKAHEAD * 2 + 1 |
| 151 | |
| 152 | }; |
| 153 | enum StringMode { |
| 154 | STRING_SINGLE_QUOTE, |
| 155 | STRING_DOUBLE_QUOTE, |
| 156 | STRING_MULTILINE |
| 157 | }; |
| 158 | |
| 159 | private: |
| 160 | void _make_token(TokenType p_type); |
| 161 | void _make_newline(int p_indentation = 0, int p_tabs = 0); |
| 162 | void _make_identifier(const StringName &p_identifier); |
| 163 | void _make_built_in_func(int p_func); |
| 164 | void _make_constant(const Variant &p_constant); |
| 165 | void _make_type(const int &p_type); |
| 166 | void _make_error(const String &p_error); |
| 167 | |
| 168 | String code; |
| 169 | int len = 0; |
| 170 | int code_pos = 0; |
| 171 | const CharType *_code = nullptr; |
| 172 | int line = 0; |
| 173 | int column = 0; |
| 174 | Token tk_rb[TK_RB_SIZE * 2 + 1]; |
| 175 | int tk_rb_pos = 0; |
| 176 | String last_error; |
| 177 | bool error_flag = 0; |
| 178 | |
| 179 | const Ref<GodotVer> engine_ver; |
| 180 | |
| 181 | bool compat_newline_after_string_debug_fix = false; |
| 182 | bool compat_bin_consts = false; |
| 183 | bool compat_no_mixed_spaces = false; |
| 184 | bool compat_underscore_num_consts = false; |
| 185 | bool compat_gdscript_2_0 = false; |
| 186 | |
| 187 | #ifdef DEBUG_ENABLED |
| 188 | Vector<Pair<int, String>> warning_skips; |
| 189 | RBSet<String> warning_global_skips; |
| 190 | bool ignore_warnings = true; |
| 191 | #endif // DEBUG_ENABLED |
| 192 | |
| 193 | void _advance(); |
| 194 | |
| 195 | public: |
| 196 | // bool is_token_literal(int p_offset = 0, bool variable_safe = false) const; |
| 197 | // StringName get_token_literal(int p_offset = 0) const; |
| 198 | |
| 199 | void set_code(const String &p_code); |
| 200 | virtual GDScriptDecomp::GlobalToken get_token(int p_offset = 0) const; |
no outgoing calls
no test coverage detected