Compare commits
No commits in common. "800ad9a4e91f75d5382286aecd2ae4b9180cc6c2" and "77f075abdc99b7930837c0a018d9e3e4ad66f290" have entirely different histories.
800ad9a4e9
...
77f075abdc
10 changed files with 70 additions and 328 deletions
|
@ -34,8 +34,6 @@ public class CleanerPool{
|
|||
if(matcher.matches()){
|
||||
String key = matcher.group(2);
|
||||
String zip = cleaner.getConstant(key);
|
||||
String modified = modifier.apply(zip, cleaner.getPattern());
|
||||
if(modified == null) continue;
|
||||
map.put(key, cleaner.open+zip+cleaner.close);
|
||||
tmp = matcher.group(1)+cleaner.open+zip+cleaner.close+matcher.group(3);
|
||||
edited = true;
|
||||
|
@ -59,7 +57,7 @@ public class CleanerPool{
|
|||
String key = matcher.group(2);
|
||||
String zip = cleaner.getConstant(key);
|
||||
String modified = modifier.apply(zip, cleaner.getPattern());
|
||||
if(modified == null) continue;
|
||||
if(modified == null) modified = zip;
|
||||
value = matcher.group(1)+cleaner.open+modified+cleaner.close+matcher.group(3);
|
||||
edited = true;
|
||||
}
|
||||
|
|
|
@ -8,9 +8,12 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool.Cleaner;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.operations.OperationContainer;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.Variable.MultipleDeclaratedVariable;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.operations.OperationFactory;
|
||||
|
||||
public class Function extends OperationContainer{
|
||||
public class Function extends JavaElement{
|
||||
|
||||
private static OperationFactory FACTORY = new OperationFactory();
|
||||
|
||||
private static Pattern PATTERN = Pattern.compile("^(\\s*([^(]*)\\(([^)]*)\\)\\s*([^{]*)\\{)(.*)$");
|
||||
|
||||
|
@ -20,10 +23,11 @@ public class Function extends OperationContainer{
|
|||
private List<Variable> parameters;
|
||||
private String exceptions;
|
||||
|
||||
private boolean constructor;
|
||||
private List<JavaElement> childs;
|
||||
|
||||
public Function(){
|
||||
this.parameters = new ArrayList<>();
|
||||
this.childs = new ArrayList<>();
|
||||
}
|
||||
|
||||
public int parse(String content, CleanerPool cleaner) throws Exception{
|
||||
|
@ -38,13 +42,7 @@ public class Function extends OperationContainer{
|
|||
String zip = generic.clean("{"+matcher.group(5));
|
||||
String body = generic.unzipOne(zip, (s,p) -> s);
|
||||
String unzip = body.substring(1, body.indexOf('}'));
|
||||
System.out.println("----------Before------------");
|
||||
show(0);
|
||||
System.out.println("----------------------------");
|
||||
parse(unzip, cleaner, generic);
|
||||
System.out.println("----------After------------");
|
||||
show(0);
|
||||
System.out.println("---------------------------");
|
||||
body(unzip, generic);
|
||||
|
||||
return matcher.group(1).length()+generic.unzip(unzip, ((s,p) -> s)).length()+1;
|
||||
}
|
||||
|
@ -75,7 +73,6 @@ public class Function extends OperationContainer{
|
|||
if(this.returnType == null){
|
||||
this.returnType = value;
|
||||
if(values.hasNext()) value = values.next();
|
||||
else constructor = true;
|
||||
}
|
||||
if(this.name == null){
|
||||
this.name = value;
|
||||
|
@ -95,14 +92,50 @@ public class Function extends OperationContainer{
|
|||
}while(quote);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void body(String content, CleanerPool cleaner) throws Exception{
|
||||
while(!(content.replaceAll("\\s+", "").isEmpty())){
|
||||
System.out.println("BODY "+content);
|
||||
|
||||
JavaElement operation = FACTORY.buildOperation(content);
|
||||
|
||||
System.out.println("got "+operation.getClass().getSimpleName());
|
||||
int index = operation.parse(content, cleaner);
|
||||
content = content.substring(index);
|
||||
if(operation instanceof Variable){
|
||||
if(content.startsWith(",")){
|
||||
Variable variable = (Variable)operation;
|
||||
MultipleDeclaratedVariable multiple = new MultipleDeclaratedVariable(variable.getModifier(), variable.getType());
|
||||
multiple.addVariable(variable.getName(), variable.getValue());
|
||||
|
||||
operation = multiple;
|
||||
|
||||
boolean quote;
|
||||
do{
|
||||
variable = new Variable(variable.getModifier(), variable.getType());
|
||||
index = variable.parse(content, cleaner);
|
||||
multiple.addVariable(variable.getName(), variable.getValue());
|
||||
content = content.substring(index);
|
||||
quote = content.startsWith(",");
|
||||
content = content.substring(1);
|
||||
}while(quote);
|
||||
}else content = content.substring(1);
|
||||
}
|
||||
|
||||
this.childs.add(operation);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void show(int tab){
|
||||
String start = "";
|
||||
for(int i = 0; i < tab; i++) start+="\t";
|
||||
String param = "";
|
||||
for(Variable v : this.parameters) param+=","+v.getType()+" "+v.getName()+"";
|
||||
if(!param.isEmpty()) param = param.substring(1);
|
||||
System.out.println(start+Modifier.toString(modifier)+" "+(constructor ? "" : returnType+" ")+name+"("+param+") "+exceptions+"{");
|
||||
for(JavaElement child : getChilds()) child.show(tab+1);
|
||||
System.out.println(start+Modifier.toString(modifier)+" "+returnType+" "+name+"("+param+") "+exceptions+"{");
|
||||
for(JavaElement child : this.childs) child.show(tab+1);
|
||||
System.out.println(start+"}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import be.jeffcheasey88.peeratcode.parser.java.CleanerPool.Cleaner;
|
|||
public class JavaParser{
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
File file = new File("C:\\Users\\jeffc\\eclipse-workspace\\peer-at-code-backend\\src\\be\\jeffcheasey88\\peeratcode\\parser\\java\\Variable.java");
|
||||
File file = new File("C:\\Users\\jeffc\\eclipse-workspace\\peer-at-code-backend\\src\\be\\jeffcheasey88\\peeratcode\\parser\\java\\Import.java");
|
||||
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
|
||||
JavaParser parser = new JavaParser(reader);
|
||||
|
|
|
@ -16,7 +16,7 @@ public class Variable extends JavaElement{
|
|||
private int modifier;
|
||||
private String name;
|
||||
private String type;
|
||||
private Variable value; //Change into operation or JavaElement
|
||||
private Variable value; //Change into operation
|
||||
|
||||
public Variable(){}
|
||||
|
||||
|
@ -126,7 +126,7 @@ public class Variable extends JavaElement{
|
|||
public void show(int tab){
|
||||
String start = "";
|
||||
for(int i = 0; i < tab; i++) start+="\t";
|
||||
System.out.println(start+Modifier.toString(modifier)+(modifier > 0 ? " ":"")+type+" "+name+(value == null ? ";":" = "+value+";"));
|
||||
System.out.println(start+Modifier.toString(modifier)+" "+type+" "+name+(value == null ? ";":" = "+value+";"));
|
||||
}
|
||||
|
||||
public static class Value extends Variable{
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
package be.jeffcheasey88.peeratcode.parser.java.operations;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.JavaElement;
|
||||
|
||||
public class AssigmentOperation extends JavaElement{
|
||||
|
||||
private static Pattern PATTERN = Pattern.compile("^(\\s*([^\\s]+)\\s*=\\s*([^;]+);).*$");
|
||||
|
||||
private String variable;
|
||||
private String value;
|
||||
|
||||
public AssigmentOperation(){}
|
||||
|
||||
@Override
|
||||
public int parse(String content, CleanerPool cleaner) throws Exception{
|
||||
Matcher matcher = PATTERN.matcher(content);
|
||||
matcher.matches();
|
||||
|
||||
this.variable = matcher.group(2);
|
||||
this.value = matcher.group(3);
|
||||
|
||||
return matcher.group(1).length();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(int tab){
|
||||
String start = "";
|
||||
for(int i = 0; i < tab; i++) start+="\t";
|
||||
System.out.println(start+variable+" = "+value+";");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
package be.jeffcheasey88.peeratcode.parser.java.operations;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.JavaElement;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool.Cleaner;
|
||||
|
||||
public class ConditionalOperation extends OperationContainer{
|
||||
|
||||
private Pattern pattern;
|
||||
private String condition;
|
||||
|
||||
public ConditionalOperation(Pattern pattern){
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int parse(String content, CleanerPool cleaner) throws Exception{
|
||||
CleanerPool generic = new CleanerPool(
|
||||
new Cleaner("GENERIC_PARENTHESIS",'(',')'),
|
||||
new Cleaner("GENERIC_FUNCTION", '{','}'));
|
||||
content = generic.clean(content);
|
||||
|
||||
Matcher matcher = this.pattern.matcher(content);
|
||||
matcher.matches();
|
||||
|
||||
this.condition = generic.unzip(matcher.group(2), (s,p) -> s);
|
||||
|
||||
int index = generic.unzip(matcher.group(1), (s,p) -> s).length();
|
||||
content = generic.unzip(content, (s,p) -> s).substring(index);
|
||||
int bodysize;
|
||||
if(content.startsWith("{")){
|
||||
bodysize = content.indexOf('}')+1;
|
||||
content = content.substring(1, bodysize-1);
|
||||
parse(content, cleaner, generic);
|
||||
}else{
|
||||
bodysize = parseOne(content, cleaner, generic);
|
||||
}
|
||||
|
||||
return index+bodysize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(int tab) {
|
||||
String start = "";
|
||||
for(int i = 0; i < tab; i++) start+="\t";
|
||||
System.out.println(start+"Condition??"+condition+"{");
|
||||
for(JavaElement child : getChilds()) child.show(tab+1);
|
||||
System.out.println(start+"}");
|
||||
}
|
||||
|
||||
public static class IfOperation extends ConditionalOperation{
|
||||
|
||||
private static Pattern PATTERN = Pattern.compile("^(\\s*if\\s*(\\^GENERIC_PARENTHESIS\\d+)).*$");
|
||||
|
||||
public IfOperation(){
|
||||
super(PATTERN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(int tab) {
|
||||
String start = "";
|
||||
for(int i = 0; i < tab; i++) start+="\t";
|
||||
System.out.println(start+"if"+super.condition+"{");
|
||||
for(JavaElement child : getChilds()) child.show(tab+1);
|
||||
System.out.println(start+"}");
|
||||
}
|
||||
}
|
||||
|
||||
public static class ForOperation extends ConditionalOperation{
|
||||
|
||||
private static Pattern PATTERN = Pattern.compile("^(\\s*for\\s*(\\^GENERIC_PARENTHESIS\\d+)).*$");
|
||||
|
||||
public ForOperation(){
|
||||
super(PATTERN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(int tab) {
|
||||
String start = "";
|
||||
for(int i = 0; i < tab; i++) start+="\t";
|
||||
System.out.println(start+"for"+super.condition+"{");
|
||||
for(JavaElement child : getChilds()) child.show(tab+1);
|
||||
System.out.println(start+"}");
|
||||
}
|
||||
}
|
||||
|
||||
public static class WhileOperation extends ConditionalOperation{
|
||||
|
||||
private static Pattern PATTERN = Pattern.compile("^(\\s*while\\s*(\\^GENERIC_PARENTHESIS\\d+)).*$");
|
||||
|
||||
public WhileOperation(){
|
||||
super(PATTERN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(int tab) {
|
||||
String start = "";
|
||||
for(int i = 0; i < tab; i++) start+="\t";
|
||||
System.out.println(start+"while"+super.condition+"{");
|
||||
for(JavaElement child : getChilds()) child.show(tab+1);
|
||||
System.out.println(start+"}");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package be.jeffcheasey88.peeratcode.parser.java.operations;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.JavaElement;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool.Cleaner;
|
||||
|
||||
public class ElseOperation extends OperationContainer{
|
||||
|
||||
private static Pattern PATTERN = Pattern.compile("^(\\s*else\\s*).*$");
|
||||
|
||||
public ElseOperation(){}
|
||||
|
||||
@Override
|
||||
public int parse(String content, CleanerPool cleaner) throws Exception{
|
||||
System.out.println("ELSE STATEMENT");
|
||||
CleanerPool generic = new CleanerPool(
|
||||
new Cleaner("GENERIC_PARENTHESIS",'(',')'),
|
||||
new Cleaner("GENERIC_FUNCTION", '{','}'));
|
||||
content = generic.clean(content);
|
||||
|
||||
Matcher matcher = PATTERN.matcher(content);
|
||||
matcher.matches();
|
||||
|
||||
int index = generic.unzip(matcher.group(1), (s,p) -> s).length();
|
||||
content = generic.unzipOne(content, (s,p) -> s).substring(index);
|
||||
System.out.println("INSIDE "+content);
|
||||
int bodysize;
|
||||
if(content.startsWith("{")){
|
||||
bodysize = content.indexOf('}')+1;
|
||||
content = content.substring(1, bodysize-1);
|
||||
parse(content, cleaner, generic);
|
||||
}else{
|
||||
bodysize = parseOne(content, cleaner, generic);
|
||||
}
|
||||
|
||||
return index+bodysize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(int tab) {
|
||||
String start = "";
|
||||
for(int i = 0; i < tab; i++) start+="\t";
|
||||
System.out.println(start+"else{");
|
||||
for(JavaElement child : getChilds()) child.show(tab+1);
|
||||
System.out.println(start+"}");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
package be.jeffcheasey88.peeratcode.parser.java.operations;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.JavaElement;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.Variable;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.Variable.MultipleDeclaratedVariable;
|
||||
|
||||
public abstract class OperationContainer extends JavaElement{
|
||||
|
||||
private static OperationFactory FACTORY = OperationFactory.getFactory();
|
||||
|
||||
private List<JavaElement> childs;
|
||||
|
||||
public OperationContainer(){
|
||||
this.childs = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void parse(String content, CleanerPool global, CleanerPool local) throws Exception{
|
||||
content = local.unzip(content, (s,p) -> s);
|
||||
System.out.println("CONTAINER "+content);
|
||||
while(!(content.replaceAll("\\s+", "").isEmpty())) content = internalParse(content, global, local);
|
||||
}
|
||||
|
||||
public int parseOne(String content, CleanerPool global, CleanerPool local) throws Exception{
|
||||
content = local.unzip(content, (s,p) -> s);
|
||||
String modify = internalParse(content, global, local);
|
||||
return content.length()-modify.length();
|
||||
}
|
||||
|
||||
private String internalParse(String content, CleanerPool global, CleanerPool local) throws Exception{
|
||||
System.out.println("BODY "+content);
|
||||
|
||||
JavaElement operation = FACTORY.buildOperation(content);
|
||||
|
||||
System.out.println("got "+operation.getClass().getSimpleName());
|
||||
int index = operation.parse(content, local);
|
||||
content = content.substring(index);
|
||||
if(operation instanceof Variable){
|
||||
if(content.startsWith(",")){
|
||||
Variable variable = (Variable)operation;
|
||||
MultipleDeclaratedVariable multiple = new MultipleDeclaratedVariable(variable.getModifier(), variable.getType());
|
||||
multiple.addVariable(variable.getName(), variable.getValue());
|
||||
|
||||
operation = multiple;
|
||||
|
||||
boolean quote;
|
||||
do{
|
||||
variable = new Variable(variable.getModifier(), variable.getType());
|
||||
index = variable.parse(content, local);
|
||||
multiple.addVariable(variable.getName(), variable.getValue());
|
||||
content = content.substring(index);
|
||||
quote = content.startsWith(",");
|
||||
content = content.substring(1);
|
||||
}while(quote);
|
||||
}else content = content.substring(1);
|
||||
}
|
||||
|
||||
this.childs.add(operation);
|
||||
return content;
|
||||
}
|
||||
|
||||
public List<JavaElement> getChilds(){
|
||||
return this.childs;
|
||||
}
|
||||
}
|
|
@ -6,53 +6,39 @@ import java.util.Map.Entry;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool.Cleaner;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.JavaElement;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.Variable;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.operations.ConditionalOperation.ForOperation;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.operations.ConditionalOperation.IfOperation;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.operations.ConditionalOperation.WhileOperation;
|
||||
import be.jeffcheasey88.peeratcode.parser.java.CleanerPool.Cleaner;
|
||||
|
||||
public class OperationFactory{
|
||||
|
||||
private static final OperationFactory SINGLETON = new OperationFactory();
|
||||
|
||||
public static OperationFactory getFactory(){
|
||||
return SINGLETON;
|
||||
}
|
||||
|
||||
private Map<Pattern, Class<? extends JavaElement>> patterns;
|
||||
|
||||
private OperationFactory(){
|
||||
public OperationFactory(){
|
||||
this.patterns = new LinkedHashMap<>();
|
||||
|
||||
this.patterns.put(Pattern.compile("^\\s*return\\s*[^;]*;.*$"), ReturnOperation.class);
|
||||
this.patterns.put(Pattern.compile("^\\s*if\\s*\\^GENERIC_PARENTHESIS\\d+.*$"), IfOperation.class);
|
||||
this.patterns.put(Pattern.compile("^\\s*for\\s*\\^GENERIC_PARENTHESIS\\d+.*$"), ForOperation.class);
|
||||
this.patterns.put(Pattern.compile("^\\s*while\\s*\\^GENERIC_PARENTHESIS\\d+.*$"), WhileOperation.class);
|
||||
this.patterns.put(Pattern.compile("^\\s*else\\s*.*$"), ElseOperation.class);
|
||||
this.patterns.put(Pattern.compile("^\\s*return\\s+[^;]*;.*$"), ReturnOperation.class);
|
||||
this.patterns.put(Pattern.compile("^\\s*([^;=]*;).*$"), MethodCallOperation.class);
|
||||
|
||||
this.patterns.put(Pattern.compile("^\\s*([^;=]+;).*$"), MethodCallOperation.class);
|
||||
|
||||
this.patterns.put(Pattern.compile("^\\s*[^\\s]+\\s+[^\\s]+\\s*=\\s*[^;]+;.*$"), Variable.class);
|
||||
this.patterns.put(Pattern.compile("^\\s*[^\\s]+\\s*=\\s*[^;]+;.*$"), AssigmentOperation.class);
|
||||
//if not types ??
|
||||
this.patterns.put(Pattern.compile("^\\s*[^\\s]*\\s+[^\\s]*\\s+=\\s+[^\\s]*;.*$"), Variable.class);
|
||||
}
|
||||
|
||||
/*
|
||||
* variable OK
|
||||
* assignation OK
|
||||
* exec method OK
|
||||
* for OK
|
||||
* variable
|
||||
* assignation
|
||||
* exec method
|
||||
* for
|
||||
* do while
|
||||
* while OK
|
||||
* if OK
|
||||
* while
|
||||
* if
|
||||
* switch case
|
||||
* return OK
|
||||
* return
|
||||
* continue
|
||||
* break
|
||||
* try catch finally
|
||||
* throw
|
||||
* else OK
|
||||
* else
|
||||
* synchronized
|
||||
* instance of
|
||||
*
|
||||
|
@ -60,19 +46,17 @@ public class OperationFactory{
|
|||
*
|
||||
* assert ??
|
||||
* Goto ??
|
||||
* Const ??
|
||||
*/
|
||||
|
||||
public JavaElement buildOperation(String content) throws Exception{
|
||||
CleanerPool generic = new CleanerPool(
|
||||
new Cleaner("GENERIC_FUNCTION", '{','}'),
|
||||
new Cleaner("GENERIC_PARENTHESIS",'(',')'),
|
||||
new Cleaner("GENERIC_TYPE_",'<','>'),
|
||||
new Cleaner("GENERIC_ARRAY",'[',']'),
|
||||
new Cleaner("GENERIC_TYPE_",'<','>'));
|
||||
new Cleaner("GENERIC_FUNCTION", '{','}'),
|
||||
new Cleaner("GENERIC_PARENTHESIS",'(',')'));
|
||||
content = generic.clean(content);
|
||||
content = generiqueTypes(content, generic);
|
||||
generiqueTypes(content, generic);
|
||||
|
||||
System.out.println("look for "+content);
|
||||
for(Entry<Pattern, Class<? extends JavaElement>> entries : this.patterns.entrySet()){
|
||||
if(entries.getKey().matcher(content).matches()) return entries.getValue().newInstance();
|
||||
}
|
||||
|
@ -87,25 +71,16 @@ public class OperationFactory{
|
|||
private static Pattern UNZIP_EQUALS_RIGHT = Pattern.compile("=(?<e>[^=\\s])");
|
||||
|
||||
private String generiqueTypes(String content, CleanerPool cleaner){
|
||||
System.out.println("base on "+content);
|
||||
String unzip = cleaner.unzip(content, (value, pattern) -> {
|
||||
System.out.println("unzip pattern "+pattern);
|
||||
if(pattern.equals("^GENERIC_FUNCTION")) return null;
|
||||
if(pattern.equals("^GENERIC_PARENTHESIS")) return null;
|
||||
System.out.println("let pass "+pattern);
|
||||
if(pattern.equals("^GENERIC_PARENTHESIS")) return value.replace("\\s+", " ");
|
||||
return value.replaceAll("\\s+", "");
|
||||
});
|
||||
System.out.println("generiqueTypes on "+unzip);
|
||||
unzip = UNZIP_STICK.matcher(unzip).replaceAll("${e}");
|
||||
System.out.println("g => "+unzip);
|
||||
unzip = UNZIP_MAJ.matcher(unzip).replaceAll("> ${e}");
|
||||
System.out.println("g => "+unzip);
|
||||
unzip = UNZIP_ARRAY.matcher(unzip).replaceAll("] ${e}");
|
||||
System.out.println("g => "+unzip);
|
||||
unzip = UNZIP_EQUALS_LEFT.matcher(unzip).replaceAll("${e} =");
|
||||
System.out.println("g => "+unzip);
|
||||
unzip = UNZIP_EQUALS_RIGHT.matcher(unzip).replaceAll("= ${e}");
|
||||
System.out.println("g => "+unzip);
|
||||
return unzip;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import be.jeffcheasey88.peeratcode.parser.java.JavaElement;
|
|||
|
||||
public class ReturnOperation extends JavaElement{
|
||||
|
||||
private static Pattern PATTERN = Pattern.compile("^(\\s*return\\s*([^;]*);).*$");
|
||||
private static Pattern PATTERN = Pattern.compile("^(\\s*return\\s+([^;]*);)\\s*$");
|
||||
|
||||
private String value;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue