use of fr.lirmm.graphik.graal.api.io.ParseException in project graal by graphik-team.
the class DlgpParser method parse.
// /////////////////////////////////////////////////////////////////////////
// PRIVATE
// /////////////////////////////////////////////////////////////////////////
private static Object parse(String s) throws ParseException {
InMemoryStream<Object> stream = new QueueStream<Object>();
Producer p = new Producer(new StringReader(s), stream);
try {
p.run();
} catch (Throwable t) {
throw new DlgpParseException(t);
}
if (!stream.hasNext()) {
throw new DlgpParseException("No statement found.");
}
Object o = null;
do {
o = stream.next();
} while (o instanceof Directive || o instanceof Prefix);
if (stream.hasNext()) {
throw new DlgpParseException("Too much statements.");
}
stream.close();
if (o instanceof ParseException) {
throw (ParseException) o;
}
return o;
}
Aggregations