Search in sources :

Example 11 with Start

use of de.prob.core.sablecc.node.Start in project probparsers by bendisposto.

the class AnswerTest method testGetANumber.

// yes('.'(=('CurID',root),[]))
@Test
public void testGetANumber() throws ResultParserException {
    final String testString = "yes('.'(=('CurId',root),[]))";
    final Start rootNode = ProBResultParser.parse(testString);
    assertNotNull(PARSETREE_WAS_NULL, rootNode);
}
Also used : Start(de.prob.core.sablecc.node.Start) Test(org.junit.Test)

Example 12 with Start

use of de.prob.core.sablecc.node.Start in project probparsers by bendisposto.

the class AnswerTest method testYes.

// executeOperationNr(1).
// yes([])
@Test
public void testYes() throws ResultParserException {
    final String testString = "yes([])";
    final Start rootNode = ProBResultParser.parse(testString);
    assertNotNull(PARSETREE_WAS_NULL, rootNode);
}
Also used : Start(de.prob.core.sablecc.node.Start) Test(org.junit.Test)

Example 13 with Start

use of de.prob.core.sablecc.node.Start in project prob2 by bendisposto.

the class CommandProcessor method sendCommand.

public IPrologResult sendCommand(final AbstractCommand command) {
    String query;
    if (command instanceof IRawCommand) {
        query = ((IRawCommand) command).getCommand();
        if (!query.endsWith(".")) {
            query += ".";
        }
    } else {
        PrologTermStringOutput pto = new PrologTermStringOutput();
        command.writeCommand(pto);
        pto.printAtom("true");
        query = pto.fullstop().toString();
    }
    if (logger.isDebugEnabled()) {
        logger.debug(StringUtils.chomp(StringUtils.abbreviate(query, 200)));
    }
    String result = cli.send(query);
    final Start ast = parseResult(result);
    IPrologResult extractResult = extractResult(ast);
    if (logger.isDebugEnabled()) {
        logger.debug(StringUtils.chomp(StringUtils.abbreviate(extractResult.toString(), 200)));
    }
    return extractResult;
}
Also used : Start(de.prob.core.sablecc.node.Start) PrologTermStringOutput(de.prob.prolog.output.PrologTermStringOutput) IRawCommand(de.prob.animator.command.IRawCommand)

Aggregations

Start (de.prob.core.sablecc.node.Start)13 Test (org.junit.Test)11 IRawCommand (de.prob.animator.command.IRawCommand)1 Lexer (de.prob.core.sablecc.lexer.Lexer)1 LexerException (de.prob.core.sablecc.lexer.LexerException)1 Parser (de.prob.core.sablecc.parser.Parser)1 ParserException (de.prob.core.sablecc.parser.ParserException)1 PrologTermStringOutput (de.prob.prolog.output.PrologTermStringOutput)1 IOException (java.io.IOException)1 PushbackReader (java.io.PushbackReader)1 StringReader (java.io.StringReader)1