void () { IElementType CHAMELEON_2 = new MyChameleon2Type(); IElementType CHAMELEON_1 = new MyChameleon1Type(CHAMELEON_2); doTest("ab{12[.?]}cd{x}", """ Element(ROOT) PsiElement(LETTER)('a') PsiElement(LETTER)('b') Element(CHAMELEON_1) PsiElement(OTHER)('{') PsiElement(DIGIT)('1') PsiElement(DIGIT)('2') Element(OTHER) Element(CHAMELEON_2) PsiElement(OTHER)('[') PsiElement(OTHER)('.') PsiErrorElement:test error 2 PsiElement(OTHER)('?') PsiElement(OTHER)(']') PsiErrorElement:test error 1 <empty list> PsiElement(OTHER)('}') PsiElement(LETTER)('c') PsiElement(LETTER)('d') Element(CHAMELEON_1) PsiElement(OTHER)('{') PsiElement(LETTER)('x') PsiElement(OTHER)('}') """, builder -> { PsiBuilderUtil.advance(builder, 2); PsiBuilder.Marker chameleon = builder.mark(); PsiBuilderUtil.advance(builder, 8); chameleon.collapse(CHAMELEON_1); PsiBuilderUtil.advance(builder, 2); chameleon = builder.mark(); PsiBuilderUtil.advance(builder, 3); chameleon.collapse(CHAMELEON_1); } ); }