use of de.be4.eventb.core.parser.node.Start in project probparsers by bendisposto.
the class StructureTest method testWitnessTick.
@Test
public void testWitnessTick() throws Exception {
final Start root = parseInput("machine WitnessTick\nevents\nevent Eve\nwith\n@x' x' :: NAT\nend\nend", false);
final AMachineParseUnit parseUnit = (AMachineParseUnit) root.getPParseUnit();
final LinkedList<PEvent> events = parseUnit.getEvents();
assertEquals(1, events.size());
final AEvent event = (AEvent) events.get(0);
final LinkedList<PWitness> witnesses = event.getWitnesses();
assertEquals(1, witnesses.size());
assertEquals("x'", ((AWitness) witnesses.get(0)).getName().getText());
}
use of de.be4.eventb.core.parser.node.Start in project probparsers by bendisposto.
the class CtlParser method applyPrologGenerator.
@Override
protected void applyPrologGenerator(StructuredPrologOutput pto, String stateID, ProBParserBase specParser, Start ast) {
final PrologCtlGenerator prologGenerator = new PrologCtlGenerator(pto, stateID, specParser);
ast.apply(prologGenerator);
}
use of de.be4.eventb.core.parser.node.Start in project probparsers by bendisposto.
the class CtlParser method parseFormula.
protected Start parseFormula(final String formula) throws LtlParseException, IOException {
StringReader reader = new StringReader(formula);
PushbackReader r = new PushbackReader(reader);
Lexer l = new CtlLexer(r);
Parser p = new Parser(l);
Start ast = null;
try {
ast = p.parse();
} catch (ParserException e) {
final UniversalToken token = UniversalToken.createToken(e.getToken());
throw new LtlParseException(token, e.getLocalizedMessage());
} catch (LexerException e) {
throw new LtlParseException(null, e.getLocalizedMessage());
}
return ast;
}
use of de.be4.eventb.core.parser.node.Start in project probparsers by bendisposto.
the class LtlParser method applyPrologGenerator.
@Override
protected void applyPrologGenerator(StructuredPrologOutput pto, String stateID, ProBParserBase specParser, Start ast) {
final PrologGenerator prologGenerator = new PrologGenerator(pto, stateID, specParser);
ast.apply(prologGenerator);
}
use of de.be4.eventb.core.parser.node.Start in project probparsers by bendisposto.
the class ErrorMessagesTest method getTreeAsString.
private String getTreeAsString(final String testMachine) throws BCompoundException {
// System.out.println("Parsing \"" + testMachine + "\"");
final BParser parser = new BParser("testcase");
parser.getOptions().setGrammar(RulesGrammar.getInstance());
final Start startNode = parser.parse(testMachine, false);
// startNode.apply(new ASTPrinter());
final Ast2String ast2String = new Ast2String();
startNode.apply(ast2String);
final String string = ast2String.toString();
// System.out.println(string);
return string;
}
Aggregations