void () { doTest("1(a(b)c)2(d)3", """ Element(ROOT) PsiElement(DIGIT)('1') Element(OTHER) PsiElement(OTHER)('(') PsiElement(LETTER)('a') Element(OTHER) PsiElement(OTHER)('(') PsiElement(LETTER)('b') PsiElement(OTHER)(')') PsiElement(LETTER)('c') PsiElement(OTHER)(')') PsiElement(DIGIT)('2') Element(OTHER) PsiElement(OTHER)('(') Element(OTHER) <empty list> PsiElement(LETTER)('d') PsiElement(OTHER)(')') PsiElement(DIGIT)('3') """, builder -> { PsiBuilderUtil.advance(builder, 1); PsiBuilder.Marker marker1 = builder.mark(); PsiBuilderUtil.advance(builder, 2); PsiBuilder.Marker marker2 = builder.mark(); PsiBuilderUtil.advance(builder, 3); marker2.done(OTHER); PsiBuilderUtil.advance(builder, 2); marker1.done(OTHER); PsiBuilderUtil.advance(builder, 1); PsiBuilder.Marker marker3 = builder.mark(); PsiBuilderUtil.advance(builder, 1); builder.mark().done(OTHER); PsiBuilderUtil.advance(builder, 2); marker3.done(OTHER); PsiBuilderUtil.advance(builder, 1); } ); }