use of de.prob.exception.ProBError in project prob2 by bendisposto.
the class ClassicalBFactory method parseAllMachines.
/**
* Given an {@link Start} ast, {@link File} f, and {@link BParser} bparser, all
* machines are loaded.
*
* @param ast
* {@link Start} representing the abstract syntax tree for the
* machine
* @param directory
* the directory relative to which machines should be loaded
* @param f
* {@link File} containing machine
* @param contentProvider
* the content provider to use
* @param bparser
* {@link BParser} for parsing
* @return {@link RecursiveMachineLoader} rml with all loaded machines
* @throws ProBError
* if the model could not be loaded
*/
public RecursiveMachineLoader parseAllMachines(final Start ast, final String directory, final File f, final IDefinitionFileProvider contentProvider, final BParser bparser) {
try {
ParsingBehaviour parsingBehaviour = new ParsingBehaviour();
parsingBehaviour.setAddLineNumbers(true);
final RecursiveMachineLoader rml = new RecursiveMachineLoader(directory, contentProvider, parsingBehaviour);
rml.loadAllMachines(f, ast, bparser.getDefinitions());
logger.trace("Done parsing '{}'", f.getAbsolutePath());
return rml;
} catch (BCompoundException e) {
throw new ProBError(e);
}
}
use of de.prob.exception.ProBError in project prob2 by bendisposto.
the class ClassicalBFactory method parseString.
private Start parseString(final String model, final BParser bparser) {
try {
logger.trace("Parsing file");
Start ast = null;
ast = bparser.parse(model, false);
return ast;
} catch (BCompoundException e) {
throw new ProBError(e);
}
}
Aggregations