IValueFactory vf = eval.getValueFactory();
prod = ProductionAdapter.setDefined(prod, vf.constructor(Factory.Symbol_Label, vf.string("$parsed"), sym));
return TreeAdapter.setProduction(TreeAdapter.setArg(tree, "parts", fragment), prod);
}
catch (ParseError e) {
ISourceLocation loc = TreeAdapter.getLocation(tree);
ISourceLocation src = eval.getValueFactory().sourceLocation(loc.getURI(), loc.getOffset() + e.getOffset(), loc.getLength(), loc.getBeginLine() + e.getBeginLine() - 1, loc.getEndLine() + e.getEndLine() - 1, loc.getBeginColumn() + e.getBeginColumn(), loc.getBeginColumn() + e.getEndColumn());
eval.getMonitor().warning("parse error in concrete syntax", src);
return tree.asAnnotatable().setAnnotation("parseError", src);
}
catch (StaticError e) {
ISourceLocation loc = TreeAdapter.getLocation(tree);
ISourceLocation src = eval.getValueFactory().sourceLocation(loc.getURI(), loc.getOffset(), loc.getLength(), loc.getBeginLine(), loc.getEndLine(), loc.getBeginColumn(), loc.getBeginColumn());
eval.getMonitor().warning(e.getMessage(), e.getLocation());
return tree.asAnnotatable().setAnnotation("can not parse fragment due to " + e.getMessage(), src);
}
catch (UndeclaredNonTerminalException e) {
ISourceLocation loc = TreeAdapter.getLocation(tree);
ISourceLocation src = eval.getValueFactory().sourceLocation(loc.getURI(), loc.getOffset(), loc.getLength(), loc.getBeginLine(), loc.getEndLine(), loc.getBeginColumn(), loc.getBeginColumn());
eval.getMonitor().warning(e.getMessage(), src);
return tree.asAnnotatable().setAnnotation("can not parse fragment due to " + e.getMessage(), src);
}
}