Restructure sources for reuse.

This commit is contained in:
Fedor Isakov 2016-05-17 11:51:40 +02:00
parent e1e642deca
commit 0b689858b8
10 changed files with 17 additions and 8 deletions

View File

@ -21,6 +21,7 @@
<orderEntry type="module" module-name="API" />
<orderEntry type="module" module-name="unification-lib" />
<orderEntry type="module" module-name="Core" />
<orderEntry type="module" module-name="tests" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-runtime:1.0.1-2" level="project" />

View File

@ -25,6 +25,11 @@
<artifactId>memreactor-core</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>jetbrains.mps.logic.memreactor</groupId>
<artifactId>unification-tests</artifactId>
<version>${unification.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View File

@ -13,6 +13,7 @@
<artifactId>unification-tests</artifactId>
<packaging>jar</packaging>
<version>1.0.2</version>
<dependencies>
<dependency>
@ -29,7 +30,8 @@
</dependencies>
<build>
<testSourceDirectory>${basedir}/src/</testSourceDirectory>
<testSourceDirectory>${basedir}/test/</testSourceDirectory>
<sourceDirectory>${basedir}/src/</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@ -199,7 +199,7 @@ public class MockTermsParser {
private void emptyTerm() {
String name = termsStack.pop();
Integer label = termLabelsStack.pop();
Term newTerm = term(name);
Term newTerm = MockTerm.term(name);
argumentsStack.peek().add(newTerm);
if (label != null) {
termRefs.put(label, newTerm);
@ -214,7 +214,7 @@ public class MockTermsParser {
List<Term> arguments = argumentsStack.pop();
String name = termsStack.pop();
Integer label = termLabelsStack.pop();
Term newTerm = term(name, arguments.toArray(new Term[arguments.size()]));
Term newTerm = MockTerm.term(name, arguments.toArray(new Term[arguments.size()]));
argumentsStack.peek().add(newTerm);
if (label != null) {
termRefs.put(label, newTerm);
@ -222,21 +222,21 @@ public class MockTermsParser {
}
private void addVar(String name) {
argumentsStack.peek().add(var(name));
argumentsStack.peek().add(MockTerm.var(name));
}
private void addVarRef(String name) {
argumentsStack.peek().add(ref(var(name)));
argumentsStack.peek().add(MockTerm.ref(MockTerm.var(name)));
}
private void addRef(String ref) {
final int label = Integer.parseInt(ref.substring(1));
if (termRefs.containsKey(label) && termRefs.get(label) != null) {
argumentsStack.peek().add(ref(termRefs.get(label)));
argumentsStack.peek().add(MockTerm.ref(termRefs.get(label)));
}
else {
termRefs.put(label, null);
argumentsStack.peek().add(ref(lookupHelper.lookup(label)));
argumentsStack.peek().add(MockTerm.ref(lookupHelper.lookup(label)));
}
}
}

View File

@ -4,7 +4,8 @@
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />