// Go up and find open keywords (and offer them for closing)
PsiElement cursor = curr;
while(cursor != null && (cursor.getPrevSibling() != null || cursor.getParent() != null)) {
// macro found {xx} found
if(cursor instanceof MacroNodeImpl) {
MacroNodeImpl node = (MacroNodeImpl) cursor;
String name = node.getMacroName();
if(name.charAt(0) == '/') { // closing macro
closedMacros.add(name.substring(1));
} else if(PAIR_MACROS.contains(name)) {
if(closedMacros.contains(name)) closedMacros.remove(name); // is closed later