mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
If the setting is enable use the new Parser diffs.
This commit is contained in:
parent
507b7ea2fc
commit
4c4d89b449
1 changed files with 10 additions and 3 deletions
|
@ -26,6 +26,7 @@ import org.eclipse.jface.text.Document;
|
|||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.Position;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.internal.parser.CStructurizer;
|
||||
import org.eclipse.cdt.internal.parser.IStructurizerCallback;
|
||||
|
@ -69,14 +70,20 @@ public class CStructureCreator implements IStructureCreator {
|
|||
DocumentInputStream is= new DocumentInputStream(doc);
|
||||
IStructurizerCallback callback= new CNodeTreeConstructor(root, doc);
|
||||
try {
|
||||
CStructurizer.getCStructurizer().parse(callback, is);
|
||||
if (CCorePlugin.getDefault().useNewParser()) {
|
||||
// new parser
|
||||
ComparatorModelBuilder modelBuilder = new ComparatorModelBuilder(callback, (s != null ? s : ""));
|
||||
modelBuilder.parse();
|
||||
} else {
|
||||
CStructurizer.getCStructurizer().parse(callback, is);
|
||||
}
|
||||
} catch (NodeConstructorError e) {
|
||||
System.out.println("Parse error: " + e);
|
||||
return null;
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue