Search in sources :

Example 41 with Token

use of de.be4.classicalb.core.preparser.node.Token in project probparsers by bendisposto.

the class PrologCtlGenerator method caseAActionCtl.

@Override
public void caseAActionCtl(final AActionCtl node) {
    final Token token = node.getOperation();
    p.openTerm("action");
    helper.parseTransitionPredicate(UniversalToken.createToken(token));
    p.closeTerm();
}
Also used : Token(de.be4.ltl.core.ctlparser.node.Token)

Example 42 with Token

use of de.be4.classicalb.core.preparser.node.Token in project probparsers by bendisposto.

the class LtlParser method parseFormula.

protected Start parseFormula(final String formula) throws LtlParseException, IOException {
    StringReader reader = new StringReader(formula);
    PushbackReader r = new PushbackReader(reader);
    Lexer l = new LtlLexer(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;
}
Also used : ParserException(de.be4.ltl.core.parser.parser.ParserException) LtlLexer(de.be4.ltl.core.parser.internal.LtlLexer) Lexer(de.be4.ltl.core.parser.lexer.Lexer) UniversalToken(de.be4.ltl.core.parser.internal.UniversalToken) Start(de.be4.ltl.core.parser.node.Start) StringReader(java.io.StringReader) LexerException(de.be4.ltl.core.parser.lexer.LexerException) LtlLexer(de.be4.ltl.core.parser.internal.LtlLexer) PushbackReader(java.io.PushbackReader) Parser(de.be4.ltl.core.parser.parser.Parser)

Example 43 with Token

use of de.be4.classicalb.core.preparser.node.Token in project probparsers by bendisposto.

the class PrologGenerator method caseAWeakFairLtl.

@Override
public void caseAWeakFairLtl(final AWeakFairLtl node) {
    final Token token = node.getOperation();
    helper.weak_fair(UniversalToken.createToken(token));
}
Also used : Token(de.be4.ltl.core.parser.node.Token)

Example 44 with Token

use of de.be4.classicalb.core.preparser.node.Token in project probparsers by bendisposto.

the class PrologGenerator method caseAAvailableLtl.

@Override
public void caseAAvailableLtl(final AAvailableLtl node) {
    final Token token = node.getOperation();
    helper.available(UniversalToken.createToken(token));
}
Also used : Token(de.be4.ltl.core.parser.node.Token)

Example 45 with Token

use of de.be4.classicalb.core.preparser.node.Token in project probparsers by bendisposto.

the class PrologGenerator method caseAOpActions.

@Override
public void caseAOpActions(AOpActions node) {
    final Token token = node.getOperation();
    helper.parseTransitionPredicate(UniversalToken.createToken(token));
}
Also used : Token(de.be4.ltl.core.parser.node.Token)

Aggregations

Test (org.junit.Test)13 BCompoundException (de.be4.classicalb.core.parser.exceptions.BCompoundException)10 IOException (java.io.IOException)10 PushbackReader (java.io.PushbackReader)10 StringReader (java.io.StringReader)10 Ast2String (util.Ast2String)10 Token (de.be4.classicalb.core.parser.node.Token)8 PreParseException (de.be4.classicalb.core.parser.exceptions.PreParseException)7 Token (de.be4.classicalb.core.preparser.node.Token)7 Token (de.be4.ltl.core.parser.node.Token)7 EOF (de.be4.classicalb.core.parser.node.EOF)5 Start (de.be4.classicalb.core.parser.node.Start)5 IToken (de.hhu.stups.sablecc.patch.IToken)5 Reader (java.io.Reader)5 ArrayList (java.util.ArrayList)4 BLexer (de.be4.classicalb.core.parser.BLexer)3 BParser (de.be4.classicalb.core.parser.BParser)3 BLexerException (de.be4.classicalb.core.parser.exceptions.BLexerException)3 TIdentifierLiteral (de.be4.classicalb.core.parser.node.TIdentifierLiteral)3 ASTPrinter (de.be4.classicalb.core.parser.visualisation.ASTPrinter)3