| 890 | static Token *findmatch(Token * startTok, const char pattern[], const Token * end, nonneg int varid = 0); |
| 891 | |
| 892 | private: |
| 893 | template<class T, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*> )> |
| 894 | static T *tokAtImpl(T *tok, int index) |
| 895 | { |
| 896 | while (index > 0 && tok) { |
| 897 | tok = tok->next(); |
| 898 | --index; |
| 899 | } |
| 900 | while (index < 0 && tok) { |
| 901 | tok = tok->previous(); |
| 902 | ++index; |
| 903 | } |
| 904 | return tok; |
| 905 | } |
| 906 | |
| 907 | /** |
| 908 | * @throws InternalError thrown if index is out of range |