seekGroupClosing method
Search for parentheses end that can close the current one, return the token next to it.
Implementation
Token seekGroupClosing(Map<String, String> groupClosings) {
var current = curTok;
final List<String> closings = [];
var distance = 0;
var depth = 0;
do {
current = peek(distance);
++distance;
if (groupClosings.containsKey(current.type)) {
closings.add(groupClosings[current.type]!);
++depth;
} else if (closings.isNotEmpty && (current.type == closings.last)) {
closings.removeLast();
--depth;
}
} while (depth > 0 && current.type != Semantic.endOfFile);
return peek(distance);
}