public String transform(String testName, String[] data) throws Exception { String fileText = data[0]; Lexer lexer = new ScalaLexer(); lexer.start(fileText); StringBuilder buffer = new StringBuilder(); IElementType type; while ((type = lexer.getTokenType()) != null) { CharSequence s = lexer.getBufferSequence(); s = s.subSequence(lexer.getTokenStart(), lexer.getTokenEnd()); buffer.append(type.toString()).append(" {").append(s).append("}"); lexer.advance(); if (lexer.getTokenType() != null) { buffer.append("\n"); } } Console.println("------------------------ " + testName + " ------------------------"); Console.println(buffer.toString()); Console.println(""); return buffer.toString(); }
public String transform(String testName, String[] data) throws Exception { setSettings(); String fileText = data[0]; final PsiFile psiFile = TestUtils.createPseudoPhysicalScalaFile(myProject, fileText); String result = processFile(psiFile); Console.println("------------------------ " + testName + " ------------------------"); Console.println(result); Console.println(""); return result; }