| 168 | } |
| 169 | |
| 170 | Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, String &r_err_str) { |
| 171 | bool string_name = false; |
| 172 | |
| 173 | while (true) { |
| 174 | char32_t cchar; |
| 175 | if (p_stream->saved) { |
| 176 | cchar = p_stream->saved; |
| 177 | p_stream->saved = 0; |
| 178 | } else { |
| 179 | cchar = p_stream->get_char(); |
| 180 | if (p_stream->is_eof()) { |
| 181 | r_token.type = TK_EOF; |
| 182 | return OK; |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | switch (cchar) { |
| 187 | case '\n': { |
| 188 | line++; |
| 189 | break; |
| 190 | } |
| 191 | case 0: { |
| 192 | r_token.type = TK_EOF; |
| 193 | return OK; |
| 194 | } break; |
| 195 | case '{': { |
| 196 | r_token.type = TK_CURLY_BRACKET_OPEN; |
| 197 | return OK; |
| 198 | } |
| 199 | case '}': { |
| 200 | r_token.type = TK_CURLY_BRACKET_CLOSE; |
| 201 | return OK; |
| 202 | } |
| 203 | case '[': { |
| 204 | r_token.type = TK_BRACKET_OPEN; |
| 205 | return OK; |
| 206 | } |
| 207 | case ']': { |
| 208 | r_token.type = TK_BRACKET_CLOSE; |
| 209 | return OK; |
| 210 | } |
| 211 | case '(': { |
| 212 | r_token.type = TK_PARENTHESIS_OPEN; |
| 213 | return OK; |
| 214 | } |
| 215 | case ')': { |
| 216 | r_token.type = TK_PARENTHESIS_CLOSE; |
| 217 | return OK; |
| 218 | } |
| 219 | case ':': { |
| 220 | r_token.type = TK_COLON; |
| 221 | return OK; |
| 222 | } |
| 223 | case ';': { |
| 224 | while (true) { |
| 225 | char32_t ch = p_stream->get_char(); |
| 226 | if (p_stream->is_eof()) { |
| 227 | r_token.type = TK_EOF; |
nothing calls this directly
no test coverage detected