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

Method dump

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

Source from the content-addressed store, hash-verified

783 }
784
785 std::string GluaTokenParser::dump() const
786 {
787 // TODO: 把生成ldf文件的处理放到这里来
788 std::stringstream ss;
789 size_t lastline = 1;
790 size_t lasttoken_lines_count = 0;
791 for (auto it = _tokens.begin(); it != _tokens.end(); ++it)
792 {
793 if (it->linenumber != lastline && it->linenumber > 1) {
794 int lines_count_to_insert = static_cast<int>(it->linenumber) - static_cast<int>(lastline) - static_cast<int>(lasttoken_lines_count) + 1;
795 if (lines_count_to_insert < 1)
796 lines_count_to_insert = 1;
797 for(int k =0;k<lines_count_to_insert;++k)
798 ss << "\n";
799 }
800 else if (it->type != '.' && it->type != ':' && it->type != '(' && it->type != ')'
801 && it->type != '[' && it->type != ']')
802 ss << " ";
803 lastline = it->linenumber;
804 switch (it->type)
805 {
806 case LTK_STRING:
807 {
808 auto lstr = it->token;
809 if (it->source_token.length() > 0)
810 lstr = it->source_token;
811 bool is_long_string = it->source_token.length() < 1;
812 ss << lstr;
813 lasttoken_lines_count = glua::util::string_lines_count(lstr);
814 }
815 break;
816 default:
817 {
818 ss << it->token;
819 lasttoken_lines_count = glua::util::string_lines_count(it->token);
820 }
821 }
822 }
823 return ss.str();
824 }
825
826 }
827}

Callers

nothing calls this directly

Calls 5

string_lines_countFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
lengthMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected