Search in sources :

Example 6 with SourcePosition

use of de.hhu.stups.sablecc.patch.SourcePosition in project probparsers by bendisposto.

the class PrologExceptionPrinter method printCheckException.

private static void printCheckException(final IPrologTermOutput pto, final CheckException cause, final String filename, final boolean useIndentation, final boolean lineOneOff) {
    final Node[] nodes = cause.getNodes();
    final SourcePosition startPos;
    if (nodes != null && nodes.length > 0) {
        startPos = nodes[0].getStartPos();
    } else {
        startPos = null;
    }
    printExceptionWithSourcePosition(pto, cause, filename, startPos, useIndentation, lineOneOff);
}
Also used : Node(de.be4.classicalb.core.parser.node.Node) SourcePosition(de.hhu.stups.sablecc.patch.SourcePosition)

Example 7 with SourcePosition

use of de.hhu.stups.sablecc.patch.SourcePosition in project probparsers by bendisposto.

the class PrologExceptionPrinter method printBParseException.

private static void printBParseException(final IPrologTermOutput pto, final BParseException e, final String filename, final boolean useIndentation, final boolean lineOneOff) {
    final Token token = e.getToken();
    final SourcePosition pos = token == null ? null : new SourcePosition(token.getLine(), token.getPos());
    printExceptionWithSourcePosition(pto, e, filename, pos, useIndentation, lineOneOff);
}
Also used : SourcePosition(de.hhu.stups.sablecc.patch.SourcePosition) Token(de.be4.classicalb.core.parser.node.Token)

Aggregations

SourcePosition (de.hhu.stups.sablecc.patch.SourcePosition)7 Test (org.junit.Test)3 BParser (de.be4.classicalb.core.parser.BParser)2 AExpressionParseUnit (de.be4.classicalb.core.parser.node.AExpressionParseUnit)2 Node (de.be4.classicalb.core.parser.node.Node)2 PExpression (de.be4.classicalb.core.parser.node.PExpression)2 Start (de.be4.classicalb.core.parser.node.Start)2 Token (de.be4.classicalb.core.parser.node.Token)2 AAddExpression (de.be4.classicalb.core.parser.node.AAddExpression)1