Commit c2e74e84 authored by Alexander Weigl's avatar Alexander Weigl

compiles again

parent d2f7d565
Pipeline #12980 failed with stage
in 2 minutes and 41 seconds
...@@ -3,9 +3,7 @@ package edu.kit.formal.psdb.termmatcher; ...@@ -3,9 +3,7 @@ package edu.kit.formal.psdb.termmatcher;
import de.uka.ilkd.key.logic.SequentFormula; import de.uka.ilkd.key.logic.SequentFormula;
import de.uka.ilkd.key.logic.Term; import de.uka.ilkd.key.logic.Term;
import org.antlr.v4.runtime.CommonToken; import org.antlr.v4.runtime.CommonToken;
import org.antlr.v4.runtime.Lexer; import org.apache.commons.lang.NotImplementedException;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.Token;
import java.util.*; import java.util.*;
import java.util.stream.IntStream; import java.util.stream.IntStream;
...@@ -116,10 +114,11 @@ class MatcherImpl extends MatchPatternDualVisitor<Matchings, Term> { ...@@ -116,10 +114,11 @@ class MatcherImpl extends MatchPatternDualVisitor<Matchings, Term> {
return m; return m;
} }
protected Matchings visitBinaryOperation(String keyOpName, MatchPatternParser.TermPatternContext ctx, Term peek) { protected Matchings visitBinaryOperation(String keyOpName, MatchPatternParser.TermPatternContext right, MatchPatternParser.TermPatternContext left, Term peek) {
MatchPatternParser.FunctionContext func = new MatchPatternParser.FunctionContext(ctx); MatchPatternParser.FunctionContext func = new MatchPatternParser.FunctionContext(left);
func.func = new CommonToken(MatchPatternLexer.ID, keyOpName); func.func = new CommonToken(MatchPatternLexer.ID, keyOpName);
func.termPattern().add(left);
func.termPattern().add(right);
return accept(func, peek); return accept(func, peek);
} }
...@@ -218,6 +217,7 @@ class MatcherImpl extends MatchPatternDualVisitor<Matchings, Term> { ...@@ -218,6 +217,7 @@ class MatcherImpl extends MatchPatternDualVisitor<Matchings, Term> {
@Override @Override
protected Matchings visitNumber(MatchPatternParser.NumberContext ctx, Term peek) { protected Matchings visitNumber(MatchPatternParser.NumberContext ctx, Term peek) {
return null; return null;
} }
...@@ -230,62 +230,73 @@ class MatcherImpl extends MatchPatternDualVisitor<Matchings, Term> { ...@@ -230,62 +230,73 @@ class MatcherImpl extends MatchPatternDualVisitor<Matchings, Term> {
*/ */
@Override @Override
protected Matchings visitSequentPattern(MatchPatternParser.SequentPatternContext ctx, Term peek) { protected Matchings visitSequentPattern(MatchPatternParser.SequentPatternContext ctx, Term peek) {
return null; throw new NotImplementedException("use the facade!");
} }
@Override @Override
protected Matchings visitPlusMinus(MatchPatternParser.PlusMinusContext ctx, Term peek) { protected Matchings visitPlusMinus(MatchPatternParser.PlusMinusContext ctx, Term peek) {
return null; return visitBinaryOperation(convert(ctx.op.getType()),
ctx.termPattern(0), ctx.termPattern(1), peek);
} }
@Override @Override
protected Matchings visitMult(MatchPatternParser.MultContext ctx, Term peek) { protected Matchings visitMult(MatchPatternParser.MultContext ctx, Term peek) {
return visitBinaryOperation("mul", ctx, peek); return visitBinaryOperation("mul", ctx.termPattern(0), ctx.termPattern(1), peek);
} }
@Override @Override
protected Matchings visitComparison(MatchPatternParser.ComparisonContext ctx, Term peek) { protected Matchings visitComparison(MatchPatternParser.ComparisonContext ctx, Term peek) {
return visitBinaryOperation(convert(ctx.op),ctx, peek); return visitBinaryOperation(convert(ctx.op.getType()), ctx.termPattern(0), ctx.termPattern(1), peek);
} }
@Override @Override
protected Matchings visitOr(MatchPatternParser.OrContext ctx, Term peek) { protected Matchings visitOr(MatchPatternParser.OrContext ctx, Term peek) {
return visitBinaryOperation(convert(ctx.op),ctx, peek); return visitBinaryOperation("or", ctx.termPattern(0), ctx.termPattern(1), peek);
} }
@Override @Override
public Matchings visitExprNot(MatchPatternParser.ExprNotContext ctx, Term peek) { public Matchings visitExprNot(MatchPatternParser.ExprNotContext ctx, Term peek) {
return visitBinaryOperation("not",ctx, peek); return visitBinaryOperation("not", ctx.termPattern(), ctx, peek);
} }
@Override @Override
public Matchings visitExprNegate(MatchPatternParser.ExprNegateContext ctx, Term peek) { public Matchings visitExprNegate(MatchPatternParser.ExprNegateContext ctx, Term peek) {
return visitBinaryOperation("sub",ctx, peek); return visitUnaryOperation("sub", ctx.termPattern(), peek);
}
private Matchings visitUnaryOperation(String unaryOp,
MatchPatternParser.TermPatternContext ctx,
Term peek) {
MatchPatternParser.FunctionContext func = new MatchPatternParser.FunctionContext(ctx);
func.termPattern().add(ctx);;
func.func = new CommonToken(MatchPatternLexer.ID, unaryOp);
return accept(func, peek);
} }
@Override @Override
protected Matchings visitImpl(MatchPatternParser.ImplContext ctx, Term peek) { protected Matchings visitImpl(MatchPatternParser.ImplContext ctx, Term peek) {
return visitBinaryOperation("imp",ctx, peek); return visitBinaryOperation("imp", ctx.termPattern(0), ctx.termPattern(1), peek);
} }
@Override @Override
protected Matchings visitDivMod(MatchPatternParser.DivModContext ctx, Term peek) { protected Matchings visitDivMod(MatchPatternParser.DivModContext ctx, Term peek) {
return visitBinaryOperation(convert(ctx.op), peek); return visitBinaryOperation(convert(ctx.op.getType()), ctx.termPattern(0), ctx.termPattern(1), peek);
} }
@Override @Override
protected Matchings visitAnd(MatchPatternParser.AndContext ctx, Term peek) { protected Matchings visitAnd(MatchPatternParser.AndContext ctx, Term peek) {
return visitBinaryOperation("and", peek); return visitBinaryOperation("and", ctx.termPattern(0), ctx.termPattern(1), peek);
} }
@Override @Override
protected Matchings visitXor(MatchPatternParser.XorContext ctx, Term peek) { protected Matchings visitXor(MatchPatternParser.XorContext ctx, Term peek) {
return visitBinaryOperation("xor", peek); return visitBinaryOperation("xor", ctx.termPattern(0), ctx.termPattern(1), peek);
} }
@Override @Override
protected Matchings visitEquality(MatchPatternParser.EqualityContext ctx, Term peek) { protected Matchings visitEquality(MatchPatternParser.EqualityContext ctx, Term peek) {
return visitBinaryOperation("eq", peek); return visitBinaryOperation("eq", ctx.termPattern(0), ctx.termPattern(1), peek);
} }
private Stream<Term> subTerms(Term peek) { private Stream<Term> subTerms(Term peek) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment