use of de.prob.core.sablecc.node.Start in project probparsers by bendisposto.
the class AnswerTest method testOperation3.
@Test
public void testOperation3() throws ResultParserException {
final String testString = "yes('.'(=('PLOps','.'(op(initialise_machine,1,[],root),[])),[]))";
final Start rootNode = ProBResultParser.parse(testString);
/* Review: Using System.out.println is ok, this is a test only */
// NOPMD by fabian on 8/13/07 12:48 PM
System.out.println(testString);
// new RootNode(new SableAST(rootNode),
// new HashMap<SetElementItem, String>());
assertNotNull(PARSETREE_WAS_NULL, rootNode);
}
use of de.prob.core.sablecc.node.Start in project probparsers by bendisposto.
the class AnswerTest method testNo.
// executeOperation(1).
// no
@Test
public void testNo() throws ResultParserException {
final String testString = "no";
final Start rootNode = ProBResultParser.parse(testString);
assertNotNull(PARSETREE_WAS_NULL, rootNode);
}
use of de.prob.core.sablecc.node.Start in project probparsers by bendisposto.
the class AnswerTest method testOperation2.
// computeOperationsForState(7,X).
// yes('.'(=('X','.'(op(add(fd(3,'Name'),fd(1,'Code')),11,[]),'.'(op(add(fd(3,'Name'),fd(2,'Code')),12,[]),'.'(op(lookup(fd(1,'Name')),7,'.'(fd(1,'Code'),[])),'.'(op(lookup(fd(2,'Name')),7,'.'(fd(1,'Code'),[])),'.'(op(update(fd(1,'Name'),fd(1,'Code')),7,[]),'.'(op(update(fd(1,'Name'),fd(2,'Code')),13,[]),'.'(op(update(fd(2,'Name'),fd(1,'Code')),7,[]),'.'(op(update(fd(2,'Name'),fd(2,'Code')),8,[]),[]))))))))),[]))
@Test
public void testOperation2() throws ResultParserException {
final String testString = "yes('.'(=('X','.'(op(add(fd(3,'Name'),fd(1,'Code')),11,[],0),'.'(op(add(fd(3,'Name'),fd(2,'Code')),12,[],0),'.'(op(lookup(fd(1,'Name')),7,'.'(fd(1,'Code'),[]),0),'.'(op(lookup(fd(2,'Name')),7,'.'(fd(1,'Code'),[]),0),'.'(op(update(fd(1,'Name'),fd(1,'Code')),7,[],0),'.'(op(update(fd(1,'Name'),fd(2,'Code')),13,[],0),'.'(op(update(fd(2,'Name'),fd(1,'Code')),7,[],0),'.'(op(update(fd(2,'Name'),fd(2,'Code')),8,[],0),[]))))))))),[]))";
final Start rootNode = ProBResultParser.parse(testString);
/* Review: Using System.out.println is ok, this is a test only */
// NOPMD by fabian on 8/13/07 12:48 PM
System.out.println(testString);
// new RootNode(new SableAST(rootNode),
// new HashMap<SetElementItem, String>());
assertNotNull(PARSETREE_WAS_NULL, rootNode);
}
use of de.prob.core.sablecc.node.Start in project probparsers by bendisposto.
the class ProBResultParser method parse.
public static Start parse(final String prologAnswer) throws ResultParserException {
if (prologAnswer.length() == 0)
throw new ResultParserException("Received empty Result", null);
final PushbackReader codeReader = new PushbackReader(new StringReader(prologAnswer), prologAnswer.length());
final Lexer lexer = new Lexer(codeReader);
final Parser parser = new Parser(lexer);
Start parseResult = null;
try {
parseResult = parser.parse();
} catch (final ParserException e) {
String message = "Internal Error while parsing ProB answer. This ist most likely a bug in the Result-Parser. String was: '" + prologAnswer + "'. Last Token was '" + e.getToken() + "': " + e.getLocalizedMessage();
throw new ResultParserException(message, e);
} catch (final LexerException e) {
String message = "Internal Error while parsing ProB answer. This ist most likely a bug in the Result-Parser String was: '" + prologAnswer + "': " + e.getLocalizedMessage();
throw new ResultParserException(message, e);
} catch (final IOException e) {
String message = "Internal Error while parsing ProB answer. This ist most likely a bug in the Result-Parser String was: " + prologAnswer + "': " + e.getLocalizedMessage();
throw new ResultParserException(message, e);
}
return parseResult;
}
use of de.prob.core.sablecc.node.Start in project probparsers by bendisposto.
the class AnswerTest method testGetNegativeNumber.
// yes('.'(=('CurID',-1),[]))
@Test
public void testGetNegativeNumber() throws ResultParserException {
final String testString = "yes('.'(=('CurId',-1),[]))";
final Start rootNode = ProBResultParser.parse(testString);
assertNotNull(PARSETREE_WAS_NULL, rootNode);
}
Aggregations