use of de.prob.translator.types.BObject in project probparsers by bendisposto.
the class TranslatingVisitor method caseACoupleExpression.
@Override
public void caseACoupleExpression(ACoupleExpression node) {
List<BObject> s = new ArrayList<BObject>();
for (PExpression e : node.getList()) {
e.apply(this);
s.add(this.getResult());
}
this.setResult(new Tuple(s));
}
use of de.prob.translator.types.BObject in project probparsers by bendisposto.
the class TranslatingVisitor method getResult.
public BObject getResult() {
if (this.result == null) {
throw new IllegalStateException("Trying to read a missing intermediate result. This might be a missing case in the translator");
}
BObject res = this.result;
this.result = null;
return res;
}
use of de.prob.translator.types.BObject in project probparsers by bendisposto.
the class TranslatingVisitor method caseASequenceExtensionExpression.
@Override
public void caseASequenceExtensionExpression(ASequenceExtensionExpression node) {
List<BObject> s = new ArrayList<BObject>();
for (PExpression e : node.getExpression()) {
e.apply(this);
s.add(this.getResult());
}
this.setResult(new Sequence(s));
}
use of de.prob.translator.types.BObject in project prob2 by bendisposto.
the class EvalResult method translate.
public TranslatedEvalResult translate() throws BCompoundException {
BObject val = Translator.translate(value);
Map<String, BObject> sols = new HashMap<>();
Set<Entry<String, String>> entrySet = solutions.entrySet();
for (Entry<String, String> entry : entrySet) {
sols.put(entry.getKey(), Translator.translate(entry.getValue()));
}
return new TranslatedEvalResult(val, sols);
}
use of de.prob.translator.types.BObject in project probparsers by bendisposto.
the class TestTranslator method testTranslateAnything.
@Test
public void testTranslateAnything() throws Exception {
BObject o = Translator.translate("5");
assertNotNull(o);
}
Aggregations