| 74 | } |
| 75 | |
| 76 | int 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 |
no outgoing calls
no test coverage detected