use of de.prob.prolog.term.PrologTerm in project probparsers by bendisposto.
the class PrologGeneratorTest method testCurrent1.
@Test
public void testCurrent1() throws Exception {
final PrologTerm root = new CompoundPrologTerm("root");
final PrologTerm stateid = new CompoundPrologTerm("stateid", root);
final PrologTerm ap = new CompoundPrologTerm("ap", stateid);
final PrologTerm implies = new CompoundPrologTerm("implies", ap, TERM_TRUE);
final PrologTerm expected = new CompoundPrologTerm("globally", implies);
check("G (current => true)", expected);
}
use of de.prob.prolog.term.PrologTerm in project probparsers by bendisposto.
the class PrologGeneratorTest method testAction.
@Test
public void testAction() throws Exception {
final PrologTerm transPred = new CompoundPrologTerm("bla");
final PrologTerm wrapped = new CompoundPrologTerm("dtrans", transPred);
final PrologTerm expected = new CompoundPrologTerm("action", wrapped);
check("[bla]", expected);
}
use of de.prob.prolog.term.PrologTerm in project probparsers by bendisposto.
the class Parserlib17Test method testParserlib17.
@Test
@Ignore
public void testParserlib17() throws Exception {
// has to be ignored because the dummyparser can not parse the ap
// might check for the syntax error exception instead?
final PrologTerm none = new CompoundPrologTerm("none");
final PrologTerm stringl = new CompoundPrologTerm("string", none, new CompoundPrologTerm("{"));
final PrologTerm stringr = new CompoundPrologTerm("string", none, new CompoundPrologTerm("1"));
final PrologTerm eq = new CompoundPrologTerm("equal", none, stringl, stringr);
final PrologTerm bpred = new CompoundPrologTerm("bpred", eq);
final PrologTerm ap = new CompoundPrologTerm("ap", bpred);
final PrologTerm expected = new CompoundPrologTerm("globally", ap);
check("G {\"{\"=\"1\"}", expected);
}
use of de.prob.prolog.term.PrologTerm in project probparsers by bendisposto.
the class JoinedParserBase method parse.
private void parse(final Type type, final IPrologTermOutput pto, final String formula, final boolean wrap) throws ProBParseException {
ProBParseException parseException = null;
UnsupportedOperationException unsupportedException = null;
for (final ProBParserBaseAdapter parser : parsers) {
try {
final PrologTerm term;
switch(type) {
case EXPR:
term = parser.parseExpression(formula, wrap);
break;
case PRED:
term = parser.parsePredicate(formula, wrap);
break;
case TRANS:
term = parser.parseTransitionPredicate(formula, wrap);
break;
default:
throw new IllegalStateException();
}
pto.printTerm(term);
return;
} catch (ProBParseException e) {
if (parseException == null) {
parseException = e;
}
} catch (UnsupportedOperationException e) {
if (unsupportedException == e) {
unsupportedException = e;
}
}
}
if (parseException != null)
throw parseException;
else
throw unsupportedException;
}
use of de.prob.prolog.term.PrologTerm in project probparsers by bendisposto.
the class StructuredPrologOutput method closeList.
public IPrologTermOutput closeList() {
PrologTerm[] elements = getArguments();
popFromStack();
addArgument(new ListPrologTerm(elements));
return this;
}
Aggregations