forked from i21017/JavaTypeUnify
Fix Parser. Add Numbers for Identifiers
This commit is contained in:
parent
af0dad2b09
commit
3c0f0dcf55
@ -17,7 +17,7 @@ tph : '_' IDENTIFIER;
|
||||
namedType : IDENTIFIER params?;
|
||||
params : '<' type (',' type)* '>';
|
||||
|
||||
IDENTIFIER: [A-Za-z.]+;
|
||||
IDENTIFIER: [0-9A-Za-z.]+;
|
||||
|
||||
NEWLINE : [\r\n]+ -> skip;
|
||||
WS: [ \t] -> skip ;
|
@ -6,6 +6,6 @@ tph : 'tph("_' IDENTIFIER '")';
|
||||
type : 'type("' IDENTIFIER '",' params ')';
|
||||
params : 'null' | 'params(' type (',' type)* ')';
|
||||
|
||||
IDENTIFIER: [A-Za-z.]+;
|
||||
IDENTIFIER: [0-9A-Za-z.]+;
|
||||
NEWLINE : [\r\n]+ -> skip;
|
||||
WS: [ \t] -> skip ;
|
@ -21,4 +21,13 @@ public class SolutionParserTest {
|
||||
System.out.println(key + " -> " + sigmas.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseSolution(){
|
||||
String solution ="sigma(tph(\"_O\"),type(\"C1\",null)) sigma(tph(\"_W\"),type(\"C2\",null)) sigma(tph(\"_AM\"),type(\"C1\",null)) sigma(tph(\"_BA\"),type(\"C1\",null)) sigma(tph(\"_AW\"),type(\"C1\",null)) sigma(tph(\"_AO\"),type(\"C1\",null)) sigma(tph(\"_AK\"),type(\"C1\",null)) sigma(tph(\"_AI\"),type(\"C1\",null)) sigma(tph(\"_AQ\"),type(\"C1\",null)) sigma(tph(\"_AY\"),type(\"C1\",null)) sigma(tph(\"_AE\"),type(\"C1\",null)) sigma(tph(\"_BC\"),type(\"C1\",null)) sigma(tph(\"_AU\"),type(\"C1\",null)) sigma(tph(\"_AS\"),type(\"C1\",null)) sigma(tph(\"_V\"),type(\"java.lang.Object\",null)) sigma(tph(\"_N\"),type(\"C1\",null)) sigma(tph(\"_AG\"),type(\"C1\",null)) sigma(tph(\"_AD\"),type(\"C1\",null))\n";
|
||||
Map<String,String> sigmas = SolutionParser.parse(solution);
|
||||
for(var key : sigmas.keySet()){
|
||||
System.out.println(key + " -> " + sigmas.get(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,9 @@ import de.dhbwstuttgart.sat.asp.*;
|
||||
import org.apache.commons.io.output.NullWriter;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
@ -40,6 +43,22 @@ public class UnifyTest {
|
||||
//TODO: Finish Extends Relation parser
|
||||
}
|
||||
|
||||
@Test
|
||||
public void orConsTest() throws IOException {
|
||||
String input =
|
||||
"java.lang.Boolean < java.lang.Object," +
|
||||
"java.lang.String < java.lang.Object," +
|
||||
"java.lang.Integer < java.lang.Object," +
|
||||
"OrConsTest < java.lang.Object," +
|
||||
"MyPair<X,Y> < Pair<X,X>," +
|
||||
"Pair<X,Y> < Object," +
|
||||
"List<X> < Object," +
|
||||
"Integer < Object, String < Object, " +
|
||||
Files.readString(Paths.get("/","tmp","output"));
|
||||
System.out.println(ASPGenerator.generateASP(ConstraintParser.parse(input)));
|
||||
System.out.println(ASPGenerator.generateExtendsRelations(ConstraintParser.parseExtendsRelations(input)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void alotOfOrConstraintsTest(){
|
||||
String input =
|
||||
|
Loading…
Reference in New Issue
Block a user