Get all syntax errors [message #1805024] |
Thu, 04 April 2019 12:08  |
Eclipse User |
|
|
|
Hey,
i am getting only the first syntax error of my language file but i have typed 4 syntactical mistakes in my language file. What am i missing?
/*
* class for parsing the language file to a model/abstract syntax tree
*/
public class A2bParser {
Injector injector;
XtextResourceSet resourceSet;
Resource resource;
public A2bParser(){
initializeParser();
}
private void initializeParser(){
injector = new A2BStandaloneSetup().createInjectorAndDoEMFRegistration();
resourceSet = injector.getInstance(XtextResourceSet.class);
resourceSet.addLoadOption(XtextResource.OPTION_ENCODING, "UTF-8");
resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
}
public Model parse(String uriPath) throws A2BParseErrorException{
resource = resourceSet.getResource(URI.createFileURI(uriPath), true);
if(resource.getErrors().isEmpty()) {
Model model = (Model) resource.getContents().get(0);
return model;
}else {
System.out.println(resource.getErrors().size());
EList<Diagnostic> errorList = resource.getErrors();
throw new A2BParseErrorException(errorList);
}
}
}
So my println gives me every time only the size of 1.
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03474 seconds