| 859 | } |
| 860 | |
| 861 | template<class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*> )> |
| 862 | static T* getCondTokFromEndImpl(T* endBlock) |
| 863 | { |
| 864 | if (!Token::simpleMatch(endBlock, "}")) |
| 865 | return nullptr; |
| 866 | T* startBlock = endBlock->link(); |
| 867 | if (!Token::simpleMatch(startBlock, "{")) |
| 868 | return nullptr; |
| 869 | if (Token::simpleMatch(startBlock->previous(), "do")) |
| 870 | return getCondTok(startBlock->previous()); |
| 871 | if (Token::simpleMatch(startBlock->previous(), ")")) |
| 872 | return getCondTok(startBlock->linkAt(-1)); |
| 873 | if (Token::simpleMatch(startBlock->tokAt(-2), "} else {")) |
| 874 | return getCondTokFromEnd(startBlock->tokAt(-2)); |
| 875 | return nullptr; |
| 876 | } |
| 877 | |
| 878 | template<class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*> )> |
| 879 | static T* getInitTokImpl(T* tok) |
no test coverage detected