Merci pour le rappel Mr Hendrikx
This commit is contained in:
parent
3c17c823fe
commit
b0da444be1
2 changed files with 22 additions and 2 deletions
|
@ -24,7 +24,9 @@ public class Variable {
|
||||||
|
|
||||||
public int parse(String content, CleanerPool cleaner) throws Exception{
|
public int parse(String content, CleanerPool cleaner) throws Exception{
|
||||||
System.out.println("parse "+content);
|
System.out.println("parse "+content);
|
||||||
CleanerPool generic = new CleanerPool(new Cleaner("GENERIC_TYPE_",'<','>'));
|
CleanerPool generic = new CleanerPool(
|
||||||
|
new Cleaner("GENERIC_TYPE_",'<','>'),
|
||||||
|
new Cleaner("GENERIC_ARRAY",'[',']'));
|
||||||
content = generic.clean(content);
|
content = generic.clean(content);
|
||||||
System.out.println("clean "+content);
|
System.out.println("clean "+content);
|
||||||
|
|
||||||
|
@ -72,7 +74,10 @@ public class Variable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generiqueTypes(String content, CleanerPool cleaner){
|
private String generiqueTypes(String content, CleanerPool cleaner){
|
||||||
return cleaner.unzip(content, (s) -> s.replaceAll("\\s+", "")).replaceAll(">(?<varname>[^>\\d,;])", "> ${varname}");
|
return cleaner.
|
||||||
|
unzip(content, (s) -> s.replaceAll("\\s+", "")).
|
||||||
|
replaceAll(">(?<varname>[^>\\d,;])", "> ${varname}").
|
||||||
|
replaceAll("](?<varname>[^\\[\\d,;])", "] ${varname}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private int indexOf(String value, String target){
|
private int indexOf(String value, String target){
|
||||||
|
|
|
@ -152,4 +152,19 @@ class VariableTest{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void case8(){
|
||||||
|
try {
|
||||||
|
Variable variable = new Variable();
|
||||||
|
variable.parse(cleaner.clean("int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]t; "), cleaner);
|
||||||
|
|
||||||
|
assertEquals(0, variable.getModifier());
|
||||||
|
assertEquals("int[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", variable.getType());
|
||||||
|
assertEquals("t", variable.getName());
|
||||||
|
assertNull(variable.getValue());
|
||||||
|
}catch(Exception e){
|
||||||
|
fail(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue