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

Function lastNodeIndex

src/FormatVisitor.cpp:76–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76int lastNodeIndex(tree::ParseTree* t) {
77 if (t == nullptr) {
78 return -1;
79 }
80 auto* c = dynamic_cast<ParserRuleContext*>(t);
81 if (c != nullptr) {
82 return c->getStop()->getTokenIndex();
83 }
84 auto* n = dynamic_cast<tree::TerminalNode*>(t);
85 if (n != nullptr) {
86 return n->getSymbol()->getTokenIndex();
87 }
88 return INT_MAX;
89}
90
91// commentAfter returns comments between a ParseTreeNode and the next Node.
92// expect: return expect string if no comments found

Callers 3

commentAfterMethod · 0.85
commentAfterNewLineMethod · 0.85
fastTestColumnLimitMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected