MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / get_token

Method get_token

core/variant/variant_parser.cpp:170–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170Error 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;

Callers

nothing calls this directly

Calls 14

is_hex_digitFunction · 0.85
is_digitFunction · 0.85
is_ascii_alphabet_charFunction · 0.85
is_underscoreFunction · 0.85
get_charMethod · 0.80
is_eofMethod · 0.80
is_utf8Method · 0.80
as_doubleMethod · 0.80
as_intMethod · 0.80
StringNameClass · 0.70
as_stringMethod · 0.45
asciiMethod · 0.45

Tested by

no test coverage detected