MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / Parse

Method Parse

CodeFormatServer/src/Lib/LineIndex/LineIndex.cpp:7–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5}
6
7void LineIndex::Parse(std::string &text) {
8 _newLines.clear();
9 _newLines.resize(1, LineOffset(0));
10 for (std::size_t i = 0; i < text.size();) {
11 char c = text[i];
12 if (c > 0) {
13 std::size_t cLen = sizeof(char);
14 _newLines.back().Push(cLen);
15 if (c == '\n') {
16 _newLines.emplace_back(i + 1);
17 }
18 i++;
19 } else {
20 std::size_t cLen = utf8::Utf8OneCharLen(text.data() + i);
21 i += cLen;
22 _newLines.back().Push(cLen);
23 }
24 }
25}
26
27LineCol LineIndex::GetLineCol(std::size_t offset) {
28 auto lineIt = std::partition_point(

Callers 3

UpdateFileMethod · 0.45
GetSyntaxTreeMethod · 0.45
GetLineIndexMethod · 0.45

Calls 6

LineOffsetClass · 0.85
PushMethod · 0.80
clearMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected