Compare commits

...
4 Commits
Author SHA1 Message Date
dholle 77a3ede7e0 Files
Build and Test with Maven / Build-and-test-with-Maven (push) Failing after 1m28s
2026-12-01 16:13:31 +01:00
dholle f691d43be3 LLParser
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 30m36s
2026-12-01 15:45:26 +01:00
dholle 9e15f051b9 Minor fixes
SonarQube Scan / SonarQube Trigger (push) Successful in 2m24s
2026-11-25 17:06:45 +01:00
dholle cbfda2da47 Merge pull request 'Fix #436' (#469) from fix-436 into master
SonarQube Scan / SonarQube Trigger (push) Successful in 2m26s
Reviewed-on: #469
2026-11-17 10:41:44 +00:00
4 changed files with 104 additions and 1 deletions

No files matched your search

+88
View File
@@ -0,0 +1,88 @@
import java.lang.Integer;
import java.lang.String;
sealed interface Token permits /*SEMICOLON, COMMA, DOT, ASSIGN, LESSTHEN, GREATERTHAN, LESSEQUALS, GREATEREQUALS, EQUALS, NOTEQUALS, NOT,
ADD, SUB, MUL, DIV, */LBRACE,/* RBRACE, LBRACKET , RBRACKET, SBOPEN, SBCLOSE, ABSTRACT, STATIC, PUBLIC, CLASS, INTERFACE,
FOR, WHILE, */IF/*, ELSE, BREAK, SWITCH, CASE, RETURN, VOID, BOOLEAN, JNULL, INT, CHAR, STRING, LONG, BOOLEANLITERALTRUE, BOOLEANLITERALFALSE,
INTLITERAL, LONGLITERAL, FLOATLITERAL, CHARLITERAL, STRINGLITERAL, MEMORYADRESSLITERAL, NAME, WHITESPACE*/ { }
/*record SEMICOLON() implements Token {}
record COMMA () implements Token {}
record DOT() implements Token {}
record ASSIGN() implements Token {}
record LESSTHEN() implements Token {}
record GREATERTHAN() implements Token {}
record LESSEQUALS() implements Token {}
record GREATEREQUALS() implements Token {}
record EQUALS() implements Token {}
record NOTEQUALS() implements Token {}
record NOT() implements Token {}
record ADD () implements Token {}
record SUB() implements Token {}
record MUL() implements Token {}
record DIV() implements Token {}*/
record LBRACE() implements Token {}
/*record RBRACE() implements Token {}
record LBRACKET () implements Token {}
record RBRACKET() implements Token {}
record SBOPEN() implements Token {}
record SBCLOSE() implements Token {}
record ABSTRACT() implements Token {}
record STATIC() implements Token {}
record PUBLIC() implements Token {}
record CLASS() implements Token {}
record INTERFACE() implements Token {}
record FOR () implements Token {}
record WHILE() implements Token {}*/
record IF() implements Token {}
/*record ELSE() implements Token {}
record BREAK() implements Token {}
record SWITCH() implements Token {}
record CASE() implements Token {}
record RETURN() implements Token {}
record VOID() implements Token {}
record BOOLEAN() implements Token {}
record JNULL() implements Token {}
record INT() implements Token {}
record CHAR() implements Token {}
record STRING() implements Token {}
record LONG() implements Token {}
record BOOLEANLITERALTRUE () implements Token {}
record BOOLEANLITERALFALSE() implements Token {}
record INTLITERAL (Integer i) implements Token {}
record LONGLITERAL (String Str) implements Token {}
record FLOATLITERAL (String Str) implements Token {}
record CHARLITERAL (String Str) implements Token {}
record STRINGLITERAL (String Str) implements Token {}
record MEMORYADRESSLITERAL (String Str) implements Token {}
record NAME (String Str) implements Token {}
record WHITESPACE() implements Token {}*/
public sealed interface List<T> permits Cons, Empty {}
public record Cons<T>(T a, List<T> l) implements List<T> {}
public record Empty<T>() implements List<T> {}
public class LLParser {
public stmt (Cons(fst, List<Token> rest)) {
return switch (fst) {
case IF a -> ifThenElsestatement(rest);
};
}
/*public stmt(IF()) { return new IF(); }
statement (Cons(IF(), rest)) {
return ifThenElsestatement(rest);
}*/
ifThenElsestatement (Empty()) {
return new Empty();
}
ifThenElsestatement (Cons(fst, List<Token> rest)) {
return switch(fst) {
case LBRACE() -> rest;
};
}
}
@@ -57,4 +57,9 @@ public record TargetFunNType(String name, List<TargetType> funNParams, List<Targ
} }
return Objects.equals(name, otfn.name); return Objects.equals(name, otfn.name);
} }
@Override
public String toString() {
return toSignature();
}
} }
@@ -50,7 +50,9 @@ public class Logger {
public static void resetLogs() { public static void resetLogs() {
defaultWriter = null; defaultWriter = null;
try { try {
FileUtils.cleanDirectory(logFolder); FileUtils.cleanDirectory(logFolder);
} catch (FileNotFoundException e) {
// Ignore
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
+8
View File
@@ -1365,6 +1365,14 @@ public class TestComplete {
main.invoke(null, List.of()); main.invoke(null, List.of());
} }
@Test
public void testLLParser() throws Exception {
ConsoleInterface.logLevel = LogLevel.INFO;
var classFiles = generateClassFiles(createClassLoader(), "LLParser.jav");
var clazz = classFiles.get("LLParser");
var instance = clazz.getDeclaredConstructor().newInstance();
}
@Test @Test
public void testBug122() throws Exception { public void testBug122() throws Exception {
var classFiles = generateClassFiles(createClassLoader(), "Bug122.jav"); var classFiles = generateClassFiles(createClassLoader(), "Bug122.jav");