void () { final String tokenText = getBaseTokenText(); if (isBaseAt(PyTokenTypes.FSTRING_START)) { final int prefixLength = PyStringLiteralUtil.getPrefixLength(tokenText); final String openingQuotes = tokenText.substring(prefixLength); assert !openingQuotes.isEmpty(); myFStringStack.push(new FString(openingQuotes, new Stack<>())); } else if (isBaseAt(PyTokenTypes.FSTRING_END)) { while (!myFStringStack.isEmpty()) { final FString lastFString = myFStringStack.pop(); if (lastFString.quotes.equals(tokenText)) { break; } } } else if (isBaseAt(PyTokenTypes.FSTRING_FRAGMENT_START)) { assert !myFStringStack.isEmpty(); myFStringStack.peek().fragments.push(FStringFragmentPart.EXPRESSION); } else if (isBaseAt(PyTokenTypes.FSTRING_FRAGMENT_END)) { assert !myFStringStack.isEmpty(); FString topmostFString = myFStringStack.peek(); assert !topmostFString.fragments.isEmpty(); topmostFString.fragments.pop(); } else if (isBaseAt(PyTokenTypes.FSTRING_FRAGMENT_FORMAT_START) || isBaseAt(PyTokenTypes.FSTRING_FRAGMENT_TYPE_CONVERSION)) { assert !myFStringStack.isEmpty(); FString topmostFString = myFStringStack.peek(); assert !topmostFString.fragments.isEmpty(); topmostFString.fragments.pop(); topmostFString.fragments.push(FStringFragmentPart.TYPE_CONVERSION_OR_FORMAT); } }