mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +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.IDocument;
|
||||||
import org.eclipse.jface.text.Position;
|
import org.eclipse.jface.text.Position;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.internal.parser.CStructurizer;
|
import org.eclipse.cdt.internal.parser.CStructurizer;
|
||||||
import org.eclipse.cdt.internal.parser.IStructurizerCallback;
|
import org.eclipse.cdt.internal.parser.IStructurizerCallback;
|
||||||
|
@ -69,14 +70,20 @@ public class CStructureCreator implements IStructureCreator {
|
||||||
DocumentInputStream is= new DocumentInputStream(doc);
|
DocumentInputStream is= new DocumentInputStream(doc);
|
||||||
IStructurizerCallback callback= new CNodeTreeConstructor(root, doc);
|
IStructurizerCallback callback= new CNodeTreeConstructor(root, doc);
|
||||||
try {
|
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) {
|
} catch (NodeConstructorError e) {
|
||||||
System.out.println("Parse error: " + e);
|
System.out.println("Parse error: " + e);
|
||||||
return null;
|
return null;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue