FlyweightCapableTreeStructure<LighterASTNode> (ASTNode chameleon) { PsiElement psi = chameleon.getPsi(); assert psi != null : "Bad chameleon: " + chameleon; Project project = psi.getProject(); PsiBuilderFactory factory = PsiBuilderFactory.getInstance(); PsiBuilder builder = factory.createBuilder(project, chameleon); ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(getLanguage()); assert parserDefinition != null : this; PsiParser parser = parserDefinition.createParser(project); if (parser instanceof LightPsiParser) { ((LightPsiParser)parser).parseLight(this, builder); } else { parser.parse(this, builder); } return builder.getLightTree(); }