use of de.be4.classicalb.core.parser.BParser in project probparsers by bendisposto.
the class ClassicalBParser method parseExpression.
@Override
public void parseExpression(final IPrologTermOutput pto, final String expression, final boolean wrap) throws ProBParseException {
try {
Start ast = new BParser().parseExpression(expression);
printAst(pto, ast, wrap, WRAPPER_EXPR);
} catch (BCompoundException e) {
throw new ProBParseException(e.getFirstException().getLocalizedMessage());
}
}
use of de.be4.classicalb.core.parser.BParser in project probparsers by bendisposto.
the class ClassicalBParser method parseTransitionPredicate.
@Override
public void parseTransitionPredicate(final IPrologTermOutput pto, final String trans, final boolean wrap) throws ProBParseException {
try {
Start ast = new BParser().parseTranstion(trans);
printAst(pto, ast, wrap, WRAPPER_TRANS);
} catch (BCompoundException e) {
throw new ProBParseException(e.getFirstException().getLocalizedMessage());
}
}
use of de.be4.classicalb.core.parser.BParser in project prob2 by bendisposto.
the class ClassicalBFactory method create.
public ExtractedModel<ClassicalBModel> create(final Start model) {
ClassicalBModel classicalBModel = modelCreator.get();
BParser bparser = new BParser();
final RecursiveMachineLoader rml = parseAllMachines(model, ".", new File(""), new CachingDefinitionFileProvider(), bparser);
classicalBModel = classicalBModel.create(model, rml, new File("from_string"), bparser);
return new ExtractedModel<>(classicalBModel, classicalBModel.getMainMachine());
}
use of de.be4.classicalb.core.parser.BParser in project prob2 by bendisposto.
the class ClassicalBFactory method create.
public ExtractedModel<ClassicalBModel> create(final String model) {
ClassicalBModel classicalBModel = modelCreator.get();
BParser bparser = new BParser();
Start ast = parseString(model, bparser);
final RecursiveMachineLoader rml = parseAllMachines(ast, ".", new File(""), bparser.getContentProvider(), bparser);
classicalBModel = classicalBModel.create(ast, rml, new File("from_string"), bparser);
return new ExtractedModel<>(classicalBModel, classicalBModel.getMainMachine());
}
use of de.be4.classicalb.core.parser.BParser in project prob2 by bendisposto.
the class ClassicalBFactory method extract.
@Override
public ExtractedModel<ClassicalBModel> extract(final String modelPath) throws IOException, ModelTranslationError {
ClassicalBModel classicalBModel = modelCreator.get();
File f = new File(modelPath);
BParser bparser = new BParser();
Start ast = parseFile(f, bparser);
RecursiveMachineLoader rml = parseAllMachines(ast, f.getParent(), f, bparser.getContentProvider(), bparser);
classicalBModel = classicalBModel.create(ast, rml, f, bparser);
return new ExtractedModel<>(classicalBModel, classicalBModel.getMainMachine());
}
Aggregations