MCPcopy Create free account
hub / github.com/Koihik/LuaFormatter / firstNodeIndex

Function firstNodeIndex

src/FormatVisitor.cpp:61–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59static bool isBlankChar(const char c) { return c == ' ' || c == '\t' || c == '\u000C'; }
60
61int firstNodeIndex(tree::ParseTree* t) {
62 if (t == nullptr) {
63 return -1;
64 }
65 auto* c = dynamic_cast<ParserRuleContext*>(t);
66 if (c != nullptr) {
67 return c->getStart()->getTokenIndex();
68 }
69 auto* n = dynamic_cast<tree::TerminalNode*>(t);
70 if (n != nullptr) {
71 return n->getSymbol()->getTokenIndex();
72 }
73 return INT_MAX;
74}
75
76int lastNodeIndex(tree::ParseTree* t) {
77 if (t == nullptr) {

Callers 1

fastTestColumnLimitMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected