Compare commits
No commits in common. "111eecd929bdf77fa540b2259a5dbcc87d4127b0" and "12d9f5b6cd258254f969322eb2b9596c3f06bd56" have entirely different histories.
111eecd929
...
12d9f5b6cd
4 changed files with 11 additions and 29 deletions
|
@ -1,6 +1,5 @@
|
|||
package be.jeffcheasey88.peeratcode.parser.java;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import be.jeffcheasey88.peeratcode.parser.Token;
|
||||
|
@ -31,8 +30,6 @@ public class Function extends JavaElement implements Annotable, VariableContaine
|
|||
this.mod = mod;
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.annotations = new ArrayList<>();
|
||||
this.elements = new ArrayList<>();
|
||||
}
|
||||
|
||||
public Function(int mod, Token generic, Token type, Token name){
|
||||
|
|
|
@ -175,17 +175,10 @@ public class JavaParser extends Parser<JavaElement> {
|
|||
|
||||
//VALUE
|
||||
BiFunction<JavaElement, Bag, JavaElement> value_builder = (parent, bag) -> {
|
||||
// if(bag.has("right")){
|
||||
//
|
||||
// BiValue result = new BiValue(
|
||||
//
|
||||
// bag.get("left"),
|
||||
//
|
||||
// bag.get("action"),
|
||||
//
|
||||
// bag.get("right"));
|
||||
// bag.set(result);
|
||||
// }
|
||||
if(bag.has("right")){
|
||||
BiValue result = new BiValue(bag.get("left"), bag.get("action"), bag.get("right"));
|
||||
bag.set(result);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
|
@ -450,7 +443,7 @@ public class JavaParser extends Parser<JavaElement> {
|
|||
(token) -> token.getType().equals(TokenType.NAME),
|
||||
(bag, token) -> bag.set("index", token)));
|
||||
StateTree<JavaElement> annotation_value = annotation_var.then((validator) -> validator.validate((token) -> token.getValue().equals("=")))
|
||||
.then(new RedirectStateTree<>(value, (global, local) -> {
|
||||
.then(new RedirectStateTree<>(ValueTests.get(), (global, local) -> {
|
||||
Map<Token, Value> map = global.get("values");
|
||||
if(map == null){
|
||||
map = new LinkedHashMap<>();
|
||||
|
@ -504,7 +497,7 @@ public class JavaParser extends Parser<JavaElement> {
|
|||
variable_split.then(variable_name);
|
||||
StateTree<JavaElement> variable_value = variable_name.then((validator) -> validator.validate((token) -> token.getValue().equals("=")))
|
||||
.then(new RedirectStateTree<>(value_container, (global, local) -> {
|
||||
// global.<Map<Token, Value>>get("vars").put(global.get("last"), local.get());
|
||||
global.<Map<Token, Value>>get("vars").put(global.get("last"), local.get());
|
||||
}));
|
||||
variable_value.then(variable_split);
|
||||
variable_value.then((validator) -> validator.validate((token) -> token.getValue().equals(";")))
|
||||
|
@ -928,10 +921,7 @@ public class JavaParser extends Parser<JavaElement> {
|
|||
return validator.validate((token) -> token.getValue().equals(";"));
|
||||
}
|
||||
return false;
|
||||
}).<JavaElement>end((parent, bag) -> {
|
||||
((JavaFile)parent).addImport(bag);
|
||||
return parent;
|
||||
});
|
||||
}).<JavaElement>end((javafile, bag) -> javafile);
|
||||
|
||||
|
||||
InitialStateTree<JavaElement> main = new InitialStateTree<>();
|
||||
|
@ -949,10 +939,7 @@ public class JavaParser extends Parser<JavaElement> {
|
|||
return validator.validate((token) -> token.getValue().equals(";"));
|
||||
}
|
||||
return false;
|
||||
}).end((parent, bag) -> {
|
||||
((JavaFile)parent).setPackage(bag);
|
||||
return parent;
|
||||
});
|
||||
}).end((javafile, bag) -> javafile);
|
||||
main.multiple(pack);
|
||||
main.multiple(importState);
|
||||
main.multiple(annotation);
|
||||
|
@ -1008,14 +995,14 @@ public class JavaParser extends Parser<JavaElement> {
|
|||
}
|
||||
|
||||
public static void main(String[] args) throws Exception{
|
||||
File file = new File("C:\\Users\\jeffc\\eclipse-workspace\\peer-at-code-backend\\src\\dev\\peerat\\backend\\Configuration.java");
|
||||
File file = new File("C:\\Users\\jeffc\\eclipse-workspace\\Eclipse_Lhoist_Xavier_plan2Track_IT1\\app\\src\\main\\java\\be\\helmo\\plan2track\\planner\\domain\\Assembly.java");
|
||||
|
||||
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
|
||||
time = System.currentTimeMillis();
|
||||
|
||||
Parser<JavaElement> parser = new JavaParser();
|
||||
JavaFile jFile = new JavaFile();
|
||||
JavaElement jFile = new JavaElement();
|
||||
parser.parse(reader, jFile);
|
||||
|
||||
System.out.println((System.currentTimeMillis()-time)+"ms");
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package be.jeffcheasey88.peeratcode.parser.java;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import be.jeffcheasey88.peeratcode.parser.Token;
|
||||
|
@ -26,7 +25,6 @@ public class Variable extends JavaElement implements Annotable{
|
|||
this.mod = mod;
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.annotations = new ArrayList<>();
|
||||
}
|
||||
|
||||
public Variable(int mod, Token type, Token name, boolean elips){
|
||||
|
|
Loading…
Add table
Reference in a new issue