1
0
Fork 0
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:
Alain Magloire 2003-04-14 17:31:25 +00:00
parent 507b7ea2fc
commit 4c4d89b449

View file

@ -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;
}