Parser v0 & hide void

This commit is contained in:
jeffcheasey88 2023-02-23 13:51:28 +01:00
parent d23abb4379
commit 48727370d7
3 changed files with 16 additions and 1 deletions

View file

@ -13,6 +13,7 @@ public class Class {
private String name; private String name;
private List<Variable>vars; private List<Variable>vars;
private List<Function>functions;
public Class(){} public Class(){}
@ -27,6 +28,7 @@ public class Class {
this.name = split[split.length-1]; this.name = split[split.length-1];
this.vars = new ArrayList<>(); this.vars = new ArrayList<>();
this.functions = new ArrayList<>();
content = matcher.group(3); content = matcher.group(3);
Pattern empty = Pattern.compile("^\\s*$"); Pattern empty = Pattern.compile("^\\s*$");
@ -46,6 +48,7 @@ public class Class {
}else{ }else{
Function func = new Function(); Function func = new Function();
int index = func.parse(content); int index = func.parse(content);
this.functions.add(func);
content = content.substring(index); content = content.substring(index);
} }
} }

View file

@ -43,6 +43,18 @@ public class JavaParser {
content = content.substring(index); content = content.substring(index);
} }
public Package getPackage(){
return this.pack;
}
public List<Import> getImports(){
return this.imports;
}
public Class getClazz(){
return this.clazz;
}
public static int getModifier(String modifier){ public static int getModifier(String modifier){
switch(modifier){ switch(modifier){
case "public": return Modifier.PUBLIC; case "public": return Modifier.PUBLIC;

View file

@ -18,7 +18,7 @@ public class DatabaseRepository {
private static final String SPECIFIC_PUZZLE_QUERY = "SELECT * FROM puzzles WHERE id_puzzle = ?"; private static final String SPECIFIC_PUZZLE_QUERY = "SELECT * FROM puzzles WHERE id_puzzle = ?";
private static final String SPECIFIC_CHAPTER_QUERY = "SELECT * FROM chapters WHERE id_chapter = ?"; private static final String SPECIFIC_CHAPTER_QUERY = "SELECT * FROM chapters WHERE id_chapter = ?";
private static final String PUZZLES_IN_CHAPTER_QUERY = "SELECT * FROM puzzles WHERE fk_chapter = ?"; private static final String PUZZLES_IN_CHAPTER_QUERY = "SELECT * FROM puzzles WHERE fk_chapter = ?";
private static final String ALL_CHAPTERS_QUERY = "SELECT * FROM chapters"; private static final String ALL_CHAPTERS_QUERY = "SELECT * FROM chapters WHERE id_chapter > 0";
private static final String CHECK_PSEUDO_AVAILABLE_QUERY = "SELECT * FROM players WHERE pseudo = ?"; private static final String CHECK_PSEUDO_AVAILABLE_QUERY = "SELECT * FROM players WHERE pseudo = ?";
private static final String CHECK_EMAIL_AVAILABLE_QUERY = "SELECT * FROM players WHERE email = ?"; private static final String CHECK_EMAIL_AVAILABLE_QUERY = "SELECT * FROM players WHERE email = ?";
private static final String REGISTER_QUERY = "INSERT INTO players (pseudo, email, passwd, firstname, lastname, description, sgroup, avatar) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; private static final String REGISTER_QUERY = "INSERT INTO players (pseudo, email, passwd, firstname, lastname, description, sgroup, avatar) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";