void () { final PsiBuilder.Marker root = myBuilder.mark(); final PsiBuilder.Marker composite = myBuilder.mark(); final PsiBuilder.Marker backup = myBuilder.mark(); if ("foo".equals(myBuilder.getTokenText())) { myBuilder.advanceLexer(); myBuilder.getTokenType(); myBuilder.mark().done(JavaStubElementTypes.TYPE_PARAMETER_LIST); backup.done(JavaStubElementTypes.ANNOTATION_METHOD); } else { backup.rollbackTo(); } composite.done(JavaStubElementTypes.ANONYMOUS_CLASS); myBuilder.getTokenType(); myBuilder.advanceLexer(); root.done(JavaStubElementTypes.ENUM_CONSTANT_INITIALIZER); }