PsiBuilderImpl (CharSequence text) { ParserDefinition parserDefinition = new PlainTextParserDefinition() { @NotNull @Override public Lexer createLexer(Project project) { return new MyTestLexer(); } @NotNull @Override public TokenSet getWhitespaceTokens() { return WHITESPACE_SET; } @NotNull @Override public TokenSet getCommentTokens() { return COMMENT_SET; } }; return new PsiBuilderImpl(null, null, parserDefinition, parserDefinition.createLexer(null), null, text, null, null); }