From f1d843df460d985ef5ac2768479e1bb660540151 Mon Sep 17 00:00:00 2001 From: jeffcheasey88 <66554203+jeffcheasey88@users.noreply.github.com> Date: Mon, 14 Aug 2023 13:59:16 +0200 Subject: [PATCH] AutoTest -> 93.78% --- .../peeratcode/parser/java/JavaParser.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/be/jeffcheasey88/peeratcode/parser/java/JavaParser.java b/src/be/jeffcheasey88/peeratcode/parser/java/JavaParser.java index 35d3677..a4daf8b 100644 --- a/src/be/jeffcheasey88/peeratcode/parser/java/JavaParser.java +++ b/src/be/jeffcheasey88/peeratcode/parser/java/JavaParser.java @@ -124,6 +124,7 @@ public class JavaParser extends Parser { type_generic_split.then(type_generic); StateTree type_generic_unknow = type_begin.then((validator) -> validator.validate((token) -> token.getValue().equals("?"))); + type_generic_unknow.then(type_generic_end); StateTree type_generic_unknow_extends = type_generic_unknow.then((validator) -> validator.validate((token) -> token.getValue().equals("extends"))) .then(new RedirectStateTree<>(type, (global, local) -> global.set(null))); type_generic_unknow_extends.then(type_generic_end); @@ -226,6 +227,9 @@ public class JavaParser extends Parser { .then((validator) -> validator.validate((token) -> token.getValue().equals(":"))) .then(new RedirectStateTree<>(value_container, (global, local) -> global.set(null))) .end((a,b) -> a); + value_left.then((validator) -> validator.validate((token) -> token.getValue().equals("instanceof"))) + .then(new RedirectStateTree<>(type, (global, local) -> global.set(null))) + .end((a,b) -> a); StateTree value_instance = value.then((validator) -> validator.validate((token) -> token.getValue().equals("new"))); StateTree value_name = new StateTree(); @@ -322,6 +326,7 @@ public class JavaParser extends Parser { return false; }).end((a,b) -> a); + braces_container.then(clazz_container); StateTree braces_array = braces_container.then(new RedirectStateTree<>(value_container, (global, local) -> global.set(null))); braces_array.then((validator) -> validator.validate((token) -> token.getValue().equals(","))) .then(braces_array); @@ -535,8 +540,11 @@ public class JavaParser extends Parser { function_static.multiple(function_container); function_static.unique((validator) -> validator.validate((token) -> token.getValue().equals("}"))).end((a,b) -> a); StateTree function_mod = function.then(new RedirectStateTree<>(modifier, (global, local) -> global.set("modifier", local))); + StateTree function_generic = function.then(new RedirectStateTree<>(type_begin, (global, local) -> global.set("generic", local))); StateTree function_type = function.then(new RedirectStateTree<>(type, (global, local) -> global.set("type", local))); + function_mod.then(function_generic); function_mod.then(function_type); + function_generic.then(function_type); StateTree function_name = function_type.then((validator) -> validator.validate( (token) -> token.getType().equals(TokenType.NAME), @@ -726,7 +734,7 @@ public class JavaParser extends Parser { } public static void main(String[] args) throws Exception{ - File file = new File("C:\\Users\\jeffc\\eclipse-workspace\\B2MATH-1S2122-LhoistXavier\\src\\crypto\\Adfgvx.java"); + File file = new File("C:\\Users\\jeffc\\eclipse-workspace\\BotDiscordSql\\src\\be\\jeffcheasey\\challenge\\bot\\parser\\region\\RegionContainer.java"); BufferedReader reader = new BufferedReader(new FileReader(file));