if (stdOut.trim().isEmpty())
return null;
RangeFactory factory = new RangeFactory() {
public IRange parse(String str) {
LineColRange range = new LineColRange(str);
return new MyRange(range.getRange(file));
}
public IRange create(ILocation start, ILocation end) {
MyLocation from = (MyLocation) start;
MyLocation to = (MyLocation) end;
return MyLocation.create(from, to);
}
};
TreeParser parser = new TreeParser(new BufferedReader(new StringReader(stdOut)), factory);
ModuleTree moduleTree = parser.readTree(new MyRange(file.getTextRange()));
SortedMap<ILocation, Filler> ranges = new TreeMap<ILocation, Filler>();
String text = file.getText();
HaskellLexer lexer = new HaskellLexer();
lexer.start(text);
while (true) {
IElementType type = lexer.getTokenType();
if (type == null)
break;
if (!HaskellTokenTypes.WHITESPACES.contains(type)) {
TextRange textRange = new TextRange(lexer.getTokenStart(), lexer.getTokenEnd());
IRange range = new MyRange(textRange);
ranges.put(range.getStart(), new Filler(range, type, lexer.getTokenText()));
}
lexer.advance();
}
moduleTree.buildBlocks(ranges, factory);