MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / _parse_next_token

Method _parse_next_token

src/Chain/libraries/glua/glua_tokenparser.cpp:512–741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

510 }
511
512 GluaParserToken GluaTokenParser::_parse_next_token(std::string &code)
513 {
514 ++_cycle_count;
515 if (end_cycle(_cycle_count))
516 return eof_token();
517 while (_parsing_pos < code.length())
518 {
519 int cur = code[_parsing_pos];
520 int sep;
521 int nextchar;
522 switch (_current_char(code))
523 {
524 case '\n': case '\r':
525 {
526 _inc_line(code);
527 } break;
528 case ' ': case '\f': case '\t': case '\v':
529 {
530 ++_parsing_pos;
531 } break;
532 case '-':
533 {
534 ++_parsing_pos;
535 if (_parsing_pos >= code.length() || (_parsing_pos < code.length() && code[_parsing_pos] != '-'))
536 {
537 GluaParserToken token;
538 token.linenumber = _parsing_linenumber;
539 token.position = _parsing_pos - 1;
540 char codestr[2];
541 codestr[0] = (char) cur;
542 codestr[1] = '\0';
543 token.token = std::string(codestr);
544 token.end_linenumber = token.linenumber + glua::util::string_lines_count(token.token) - 1;
545 token.type = (TOKEN_RESERVED) cur;
546 _tokens.push_back(token);
547 return token;
548 }
549 // else is a comment
550 ++_parsing_pos;
551 if (_parsing_pos < code.length() && code[_parsing_pos] == '[')
552 {
553 // long comment
554 int sep = _skip_sep(code);
555 if (sep >= 0)
556 {
557 _read_long_string(code, false, sep);
558 _reset_parse_buff();
559 break;
560 }
561 }
562 // short comment
563 while (!is_new_line_start(_current_char(code)) && _current_char(code) != EOF_TOKEN_CHAR)
564 ++_parsing_pos;
565 } break;
566 case '[':
567 // long string
568 sep = _skip_sep(code);
569 if (sep >= 0)

Callers

nothing calls this directly

Calls 9

end_cycleFunction · 0.85
eof_tokenFunction · 0.85
string_lines_countFunction · 0.85
is_new_line_startFunction · 0.85
is_digitFunction · 0.70
is_alphaFunction · 0.70
stringClass · 0.50
lengthMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected