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

Method GetTextRange

LuaParser/src/Ast/LuaSyntaxNode.cpp:10–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8}
9
10TextRange LuaSyntaxNode::GetTextRange(const LuaSyntaxTree &t) const {
11 if (IsToken(t)) {
12 return t.GetTokenRange(_index);
13 } else if (IsNull(t)) {
14 return TextRange(0, 0);
15 }
16
17 auto start = t.GetStartOffset(_index);
18 auto end = t.GetEndOffset(_index);
19 if (end >= start) {
20 return TextRange(start, end - start + 1);
21 }
22 return TextRange(start, 0);
23}
24
25std::size_t LuaSyntaxNode::GetStartLine(const LuaSyntaxTree &t) const {
26 return t.GetFile().GetLine(t.GetStartOffset(_index));

Callers 10

IdentifyAnalyzeMethod · 0.80
TextAnalyzeMethod · 0.80
DiagnosticMethod · 0.80
BasicResolveMethod · 0.80
CompleteMissTokenMethod · 0.80
DoResolveMethod · 0.80
ResolveAlignGroupMethod · 0.80

Calls 5

TextRangeClass · 0.85
GetStartOffsetMethod · 0.80
IsNullFunction · 0.50
GetTokenRangeMethod · 0.45
GetEndOffsetMethod · 0.45

Tested by

no test coverage detected