Commit 145e4979 authored by Alexander Weigl's avatar Alexander Weigl
Browse files

Die Axt im Walde ...

parent eef68b1a
Pipeline #13140 failed with stage
in 3 minutes and 36 seconds
package edu.kit.formal.psdb.parser.ast;
package edu.kit.iti.formal.psdbg.parser.ast;
import edu.kit.formal.psdb.parser.NotWelldefinedException;
import edu.kit.formal.psdb.parser.ScriptLanguageParser;
import edu.kit.formal.psdb.parser.Visitor;
import edu.kit.formal.psdb.parser.types.Type;
import edu.kit.formal.psdb.parser.types.TypeFacade;
import edu.kit.iti.formal.psdbg.parser.NotWelldefinedException;
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitor;
import edu.kit.iti.formal.psdbg.parser.types.Type;
import edu.kit.iti.formal.psdbg.parser.types.TypeFacade;
import lombok.Data;
import java.util.LinkedHashMap;
......
package edu.kit.formal.psdb.parser.ast;
package edu.kit.iti.formal.psdbg.parser.ast;
/*-
* #%L
......@@ -24,10 +24,10 @@ package edu.kit.formal.psdb.parser.ast;
import edu.kit.formal.psdb.parser.NotWelldefinedException;
import edu.kit.formal.psdb.parser.Visitor;
import edu.kit.formal.psdb.parser.types.Type;
import edu.kit.formal.psdb.parser.types.TypeFacade;
import edu.kit.iti.formal.psdbg.parser.NotWelldefinedException;
import edu.kit.iti.formal.psdbg.parser.Visitor;
import edu.kit.iti.formal.psdbg.parser.types.Type;
import edu.kit.iti.formal.psdbg.parser.types.TypeFacade;
import lombok.Data;
/**
......
package edu.kit.formal.psdb.parser.ast;
package edu.kit.iti.formal.psdbg.parser.ast;
/*-
* #%L
......@@ -24,8 +24,8 @@ package edu.kit.formal.psdb.parser.ast;
import edu.kit.formal.psdb.parser.ScriptLanguageParser;
import edu.kit.formal.psdb.parser.Visitor;
import edu.kit.iti.formal.psdbg.parser.ScriptLanguageParser;
import edu.kit.iti.formal.psdbg.parser.Visitor;
import lombok.Data;
/**
......
package edu.kit.formal.psdb.parser.ast;
package edu.kit.iti.formal.psdbg.parser.ast;
/*-
* #%L
......@@ -24,9 +24,9 @@ package edu.kit.formal.psdb.parser.ast;
import edu.kit.formal.psdb.parser.NotWelldefinedException;
import edu.kit.formal.psdb.parser.Visitor;
import edu.kit.formal.psdb.parser.types.Type;
import edu.kit.iti.formal.psdbg.parser.NotWelldefinedException;
import edu.kit.iti.formal.psdbg.parser.Visitor;
import edu.kit.iti.formal.psdbg.parser.types.Type;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......
package edu.kit.formal.psdb.parser.ast;
package edu.kit.iti.formal.psdbg.parser.ast;
/*-
* #%L
......@@ -24,9 +24,9 @@ package edu.kit.formal.psdb.parser.ast;
import edu.kit.formal.psdb.parser.NotWelldefinedException;
import edu.kit.formal.psdb.parser.Visitor;
import edu.kit.formal.psdb.parser.types.Type;
import edu.kit.iti.formal.psdbg.parser.NotWelldefinedException;
import edu.kit.iti.formal.psdbg.parser.Visitor;
import edu.kit.iti.formal.psdbg.parser.types.Type;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
......
......@@ -3,14 +3,14 @@
* <p>
* <p>
* <b>How to extend the AST?</b>
* Inherit from {@link edu.kit.formal.psdb.parser.ast.ASTNode} with a proper template argument of the corresponding {@link org.antlr.v4.runtime.ParserRuleContext}.
* You will need to define the {@link edu.kit.formal.psdb.parser.ast.ASTNode#clone()}
* and {@link edu.kit.formal.psdb.parser.ast.ASTNode#accept(edu.kit.formal.psdb.parser.Visitor)} method.
* Inherit from {@link edu.kit.iti.formal.psdbg.parser.ast.ASTNode} with a proper template argument of the corresponding {@link org.antlr.v4.runtime.ParserRuleContext}.
* You will need to define the {@link edu.kit.iti.formal.psdbg.parser.ast.ASTNode#clone()}
* and {@link edu.kit.iti.formal.psdbg.parser.ast.ASTNode#accept(edu.kit.iti.formal.psdbg.parser.Visitor)} method.
*
* @author Alexander Weigl
* @version 1 (01.05.17)
*/
package edu.kit.formal.psdb.parser.ast;
package edu.kit.iti.formal.psdbg.parser.ast;
/*-
* #%L
......
package edu.kit.formal.psdb.interpreter.data;
package edu.kit.iti.formal.psdbg.parser.data;
import edu.kit.formal.psdb.parser.ast.*;
import edu.kit.formal.psdb.parser.types.SimpleType;
import edu.kit.formal.psdb.parser.types.Type;
import edu.kit.formal.psdb.parser.types.TypeFacade;
import edu.kit.iti.formal.psdbg.parser.ast.*;
import edu.kit.iti.formal.psdbg.parser.types.SimpleType;
import edu.kit.iti.formal.psdbg.parser.types.Type;
import edu.kit.iti.formal.psdbg.parser.types.TypeFacade;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
......
......@@ -2,7 +2,7 @@
* @author Alexander Weigl
* @version 1 (01.05.17)
*/
package edu.kit.formal.psdb.parser;
package edu.kit.iti.formal.psdbg.parser;
/*-
* #%L
......
package edu.kit.formal.psdb.parser.types;
package edu.kit.iti.formal.psdbg.parser.types;
import lombok.AllArgsConstructor;
import lombok.Data;
......
package edu.kit.formal.psdb.parser.types;
package edu.kit.iti.formal.psdbg.parser.types;
/**
* @author Alexander Weigl
......
package edu.kit.formal.psdb.parser.types;
package edu.kit.iti.formal.psdbg.parser.types;
import java.util.Arrays;
......@@ -10,7 +10,10 @@ public final class TypeFacade {
public static final Type ANY_TERM = new TermType();
public static TermType getTermType(String symbol) {
if (symbol.startsWith("Term<") && symbol.endsWith(">")) {
if ("TERM".equalsIgnoreCase(symbol)) {
return new TermType();
}
if (symbol.toLowerCase().startsWith("term<") && symbol.endsWith(">")) {
TermType tt = new TermType();
String n = symbol.substring(6, symbol.length() - 2);
for (String term : n.split(",")) {
......@@ -18,6 +21,7 @@ public final class TypeFacade {
}
return tt;
}
return null;
}
......
package edu.kit.formal.psdb.parser;
package edu.kit.iti.formal.psdbg.parser;
/*-
* #%L
......@@ -24,7 +24,7 @@ package edu.kit.formal.psdb.parser;
import edu.kit.formal.psdb.parser.ast.ProofScript;
import edu.kit.iti.formal.psdbg.parser.ast.ProofScript;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
......
package edu.kit.formal.psdb.parser;
package edu.kit.iti.formal.psdbg.parser;
/*-
* #%L
......@@ -24,6 +24,7 @@ package edu.kit.formal.psdb.parser;
import edu.kit.iti.formal.psdbg.TestHelper;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -35,7 +36,7 @@ import java.io.IOException;
public class BadExpressionTest {
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> getBadExpressions() throws IOException {
return TestHelper.loadLines("badexpr.txt", 1);
return TestHelper.loadLines("parser/badexpr.txt", 1);
}
@Parameterized.Parameter
......
package edu.kit.formal.psdb.parser;
package edu.kit.iti.formal.psdbg.parser;
/*-
* #%L
......@@ -24,7 +24,8 @@ package edu.kit.formal.psdb.parser;
import edu.kit.formal.psdb.parser.ast.Expression;
import edu.kit.iti.formal.psdbg.TestHelper;
import edu.kit.iti.formal.psdbg.parser.ast.Expression;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -40,7 +41,7 @@ import java.io.IOException;
public class BadlyTypedExpression {
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> getBadExpressions() throws IOException {
return TestHelper.loadLines("badlytypedexpr.txt", 1);
return TestHelper.loadLines("scripts/badlytypedexpr.txt", 1);
}
@Parameterized.Parameter
......
package edu.kit.formal.psdb.parser;
package edu.kit.iti.formal.psdbg.parser;
/*-
* #%L
......@@ -23,14 +23,14 @@ package edu.kit.formal.psdb.parser;
*/
import edu.kit.formal.psdb.parser.ast.ProofScript;
import edu.kit.formal.psdb.parser.ast.Variable;
import edu.kit.iti.formal.psdbg.parser.ast.ProofScript;
import edu.kit.iti.formal.psdbg.parser.ast.Variable;
import org.antlr.v4.runtime.CharStreams;
import org.junit.Assert;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
/**
......@@ -38,9 +38,10 @@ import java.util.List;
* @version 1 (01.05.17)
*/
public class EqualsTest {
@Test public void test() throws IOException {
List<ProofScript> list = Facade
.getAST(new File("src/test/resources/edu/kit/formal/parser/scripts/justarithmetic.txt"));
@Test
public void test() throws IOException {
InputStream stream = getClass().getResourceAsStream("scripts/justarithmetic.txt");
List<ProofScript> list = Facade.getAST(CharStreams.fromStream(stream));
ProofScript a = list.get(0);
ProofScript b = a.copy();
......
package edu.kit.formal.psdb.parser;
package edu.kit.iti.formal.psdbg.parser;
/*-
* #%L
......@@ -24,10 +24,11 @@ package edu.kit.formal.psdb.parser;
import edu.kit.formal.psdb.parser.ast.Expression;
import edu.kit.formal.psdb.parser.ast.Signature;
import edu.kit.formal.psdb.parser.types.SimpleType;
import edu.kit.formal.psdb.parser.ast.Variable;
import edu.kit.iti.formal.psdbg.TestHelper;
import edu.kit.iti.formal.psdbg.parser.ast.Expression;
import edu.kit.iti.formal.psdbg.parser.ast.Signature;
import edu.kit.iti.formal.psdbg.parser.types.SimpleType;
import edu.kit.iti.formal.psdbg.parser.ast.Variable;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -39,7 +40,7 @@ import java.io.IOException;
public class GoodExpressionTest {
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> getGoodExpressions() throws IOException {
return TestHelper.loadLines("goodexpr.txt", 1);
return TestHelper.loadLines("scripts/goodexpr.txt", 1);
}
@Parameterized.Parameter
......
package edu.kit.formal.psdb.parser;
package edu.kit.iti.formal.psdbg.parser;
/*-
* #%L
......@@ -24,6 +24,7 @@ package edu.kit.formal.psdb.parser;
import edu.kit.iti.formal.psdbg.TestHelper;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -40,7 +41,7 @@ import java.io.IOException;
public class ScriptTest {
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> getScripts() throws IOException {
return TestHelper.getResourcesAsParameters("edu/kit/formal/parser/scripts");
return TestHelper.getResourcesAsParameters("edu/kit/iti/formal/psdbg/parser/scripts");
}
@Parameterized.Parameter
......
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