diff --git a/build.gradle b/build.gradle index 2eef9c7..41ff475 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins { group 'com.github.kayjamlang' archivesBaseName = "core" -version '0.1.3.6' +version '0.1.4-dev' dependencies { testCompile group: 'junit', name: 'junit', version: '4.13.2' diff --git a/src/main/java/com/github/kayjamlang/core/KayJamIdentifier.java b/src/main/java/com/github/kayjamlang/core/KayJamIdentifier.java new file mode 100644 index 0000000..12f8a2f --- /dev/null +++ b/src/main/java/com/github/kayjamlang/core/KayJamIdentifier.java @@ -0,0 +1,45 @@ +package com.github.kayjamlang.core; + +import java.util.regex.Pattern; + +public enum KayJamIdentifier { + VAR("var"), + FUNCTION("function|fun"), + NAMED("named"), + PUBLIC("public"), + PRIVATE("private"), + WHILE("while"), + FOR("for"), + CLASS("class"), + OBJECT("object"), + RETURN("return"), + CONSTRUCTOR("constructor"), + COMPANION("companion"), + USE("use"), + CAST("as"), + IS("is"), + IF("if"), + IN("in"), + ELSE("else"), + + ; + + private final Pattern pattern; + + KayJamIdentifier(String regex) { + pattern = Pattern.compile("^" + regex + "$"); + } + + public boolean endOfMatch(String s) { + return pattern.matcher(s).find(); + } + + public static KayJamIdentifier find(String str) { + for(KayJamIdentifier t : KayJamIdentifier.values()) { + if(t.endOfMatch(str)) + return t; + } + + return null; + } +} diff --git a/src/main/java/com/github/kayjamlang/core/KayJamParser.java b/src/main/java/com/github/kayjamlang/core/KayJamParser.java index 9305f01..502b025 100644 --- a/src/main/java/com/github/kayjamlang/core/KayJamParser.java +++ b/src/main/java/com/github/kayjamlang/core/KayJamParser.java @@ -50,8 +50,11 @@ public Expression readExpression() throws LexerException, ParserException { return readExpression(AccessIdentifier.NONE, new ArrayList<>()); } - public Expression readExpression(AccessIdentifier identifier, List annotations) throws LexerException, ParserException { + public Expression readTopExpression() throws LexerException, ParserException { + return readTopExpression(AccessIdentifier.NONE, new ArrayList<>()); + } + public Expression readTopExpression(AccessIdentifier identifier, List annotations) throws LexerException, ParserException { Expression expression = readPrimary(identifier, annotations); if(currentTokenType() == Token.Type.CLOSE_BRACKET) return expression; @@ -77,6 +80,15 @@ public Expression readExpression(AccessIdentifier identifier, List a return expression; } + public Expression readExpression(AccessIdentifier identifier, List annotations) throws LexerException, ParserException { + Expression expression = readTopExpression(identifier, annotations); + if(expression instanceof ClassContainer|| + expression instanceof UseExpression) + throw new ParserException(lexer, "This expression is not allowed to be used in this place."); + + return expression; + } + public Expression readEndExpression(Expression root) throws LexerException { if(currentTokenType()==Token.Type.TK_NOT) { moveAhead(); @@ -114,157 +126,187 @@ public Token requireToken(Token.Type type) throws LexerException, ParserExceptio return lexer.currentToken(); } + public void requireIdentifier(KayJamIdentifier identifier) throws LexerException, ParserException { + Token token = requireToken(Token.Type.IDENTIFIER); + if(KayJamIdentifier.find(token.value)!=identifier) + throw new ParserException(lexer, "expected "+identifier.name()); + + } + public Expression readPrimary(AccessIdentifier identifier, List annotations) throws LexerException, ParserException { Token.Type type = currentTokenType(); int line = lexer.getLine(); - if(type==Token.Type.TK_VAR){ - String name = requireToken(Token.Type.IDENTIFIER).value; - requireToken(Token.Type.TK_ASSIGN); - - moveAhead(); - Expression expression = readExpression(); - - return new VariableExpression(name, expression, identifier, line); - }else if(type == Token.Type.IDENTIFIER){ - String name = lexer.currentToken().value; + if(type == Token.Type.IDENTIFIER){ + KayJamIdentifier keyword = KayJamIdentifier.find(lexer.currentToken().value); + if(keyword!=null){ + if(keyword==KayJamIdentifier.VAR) { + String name = requireToken(Token.Type.IDENTIFIER).value; + requireToken(Token.Type.TK_ASSIGN); - type = moveAhead().type; - if(type==Token.Type.TK_ASSIGN) { - moveAhead(); - Expression expression = readExpression(); - return new VariableSetExpression(name, expression, line); - }else if(type==Token.Type.TK_OPEN){ - List arguments = new ArrayList<>(); - while (moveAhead().type!=Token.Type.TK_CLOSE){ - arguments.add(readExpression()); - - Token token = moveAhead(); - if(token.type==Token.Type.TK_CLOSE) - break; - else if(token.type!=Token.Type.TK_COMMA) - throw new ParserException(lexer, "expected comma \",\""); - } - - return new CallOrCreateExpression(name, arguments, line); - }else if(type==Token.Type.TK_ACCESS){ - moveAhead(); - return new AccessExpression(new VariableLinkExpression(name, line), readExpression(), line); - }else if(type==Token.Type.TK_COMPANION_ACCESS){ - moveAhead(); - return new CompanionAccessExpression(name, readExpression(), line); - }else if(type==Token.Type.OPEN_BRACKET||type==Token.Type.TK_REF){ - if(type==Token.Type.TK_REF) moveAhead(); + Expression expression = readExpression(); - return new NamedExpression(name, readExpression(), line); - }else{ - lexer.input = new StringBuilder(lexer.currentToken().value+lexer.input); - return new VariableLinkExpression(name, line); - } - }else if(type == Token.Type.TK_NAMED){ - requireToken(Token.Type.TK_FUNCTION); - String name = requireToken(Token.Type.IDENTIFIER).value; + return new VariableExpression(name, expression, identifier, line); + }else if(keyword==KayJamIdentifier.FUNCTION){ + String name = requireToken(Token.Type.IDENTIFIER).value; - moveAhead(); - return new NamedExpressionFunctionContainer(name, parseAST(), identifier, line); - }else if(type == Token.Type.TK_FUNCTION){ - String name = requireToken(Token.Type.IDENTIFIER).value; + requireToken(Token.Type.TK_OPEN); - requireToken(Token.Type.TK_OPEN); + List arguments = parseArguments(); - List arguments = parseArguments(); + Type returnType = Type.VOID; + if(moveAhead().type==Token.Type.TK_COLON){ + requireToken(Token.Type.IDENTIFIER); - Type returnType = Type.VOID; - if(moveAhead().type==Token.Type.TK_COLON){ - requireToken(Token.Type.IDENTIFIER); + returnType = parseType(true); + } - returnType = parseType(true); - } + List body = parseAST(); - List body = parseAST(); + return new FunctionContainer(name, body, identifier, arguments, line, returnType, annotations); + }else if(keyword==KayJamIdentifier.NAMED){ + requireIdentifier(KayJamIdentifier.FUNCTION); + String name = requireToken(Token.Type.IDENTIFIER).value; - return new FunctionContainer(name, body, identifier, arguments, line, returnType, annotations); - }else if(type == Token.Type.TK_WHILE){ - requireToken(Token.Type.TK_OPEN); + moveAhead(); + return new NamedExpressionFunctionContainer(name, parseAST(), identifier, line); + }else if(keyword==KayJamIdentifier.PRIVATE) { + moveAhead(); + return readExpression(AccessIdentifier.PRIVATE, annotations); + }else if(keyword==KayJamIdentifier.PUBLIC) { + moveAhead(); + return readExpression(AccessIdentifier.PUBLIC, annotations); + }else if(keyword==KayJamIdentifier.WHILE){ + requireToken(Token.Type.TK_OPEN); - moveAhead(); - Expression condition = readExpression(); + moveAhead(); + Expression condition = readExpression(); - if(currentTokenType()!= Token.Type.TK_CLOSE) - throw new ParserException(lexer, "expected close \")\""); - else moveAhead(); + if(currentTokenType()!= Token.Type.TK_CLOSE) + throw new ParserException(lexer, "expected close \")\""); + else moveAhead(); - moveAhead(); - return new WhileExpression(condition, readExpression(), line); - }else if(type == Token.Type.TK_FOR){ - requireToken(Token.Type.TK_OPEN); + moveAhead(); + return new WhileExpression(condition, readExpression(), line); + }else if(keyword==KayJamIdentifier.FOR){ + requireToken(Token.Type.TK_OPEN); - String name = requireToken(Token.Type.IDENTIFIER).value; - requireToken(Token.Type.TK_KEY_IN); + String name = requireToken(Token.Type.IDENTIFIER).value; + requireIdentifier(KayJamIdentifier.IN); - moveAhead(); - Expression range = readExpression(); + moveAhead(); + Expression range = readExpression(); - if(currentTokenType()!= Token.Type.TK_CLOSE) - throw new ParserException(lexer, "expected close \")\""); - else moveAhead(); + if(currentTokenType()!= Token.Type.TK_CLOSE) + throw new ParserException(lexer, "expected close \")\""); + else moveAhead(); - moveAhead(); - return new ForExpression(name, range, readExpression(), line); - }else if(type == Token.Type.TK_OBJECT){ - Token t = moveAhead(); - if(t.type==Token.Type.OPEN_BRACKET) - return new ObjectContainer(parseAST(), identifier, line); - else if(t.type==Token.Type.IDENTIFIER){ - moveAhead(); - return new ObjectContainer(t.value, - parseAST(), identifier, line); - }else throw new ParserException(lexer, "expected name of object or open bracket"); - }else if(type == Token.Type.TK_CLASS){ - moveAhead(); - type = lexer.currentToken().type; - if(type == Token.Type.IDENTIFIER){ - String name = lexer.currentToken().value; - String extendsClass = null; - List implementsClass = new ArrayList<>(); - - while (moveAhead().type!=Token.Type.OPEN_BRACKET){ - if(currentTokenType()==Token.Type.TK_COMPANION_ACCESS) - implementsClass.add(requireToken(Token.Type.IDENTIFIER).value); - else if(currentTokenType()==Token.Type.TK_COLON&&extendsClass==null) - extendsClass = requireToken(Token.Type.IDENTIFIER).value; - else throw new ParserException(lexer, "expected open bracket or extends/implements token"); - } - - return new ClassContainer(name, extendsClass, implementsClass, - parseAST(), identifier, line); - }else throw new ParserException(lexer, "expected identifier of class"); - }else if(type == Token.Type.TK_RETURN){ - moveAhead(); - return new ReturnExpression(readExpression(), line); - }else if(type == Token.Type.TK_KEY_IF){ - requireToken(Token.Type.TK_OPEN); + moveAhead(); + return new ForExpression(name, range, readExpression(), line); + }else if(keyword==KayJamIdentifier.OBJECT){ + Token t = moveAhead(); + if(t.type==Token.Type.OPEN_BRACKET) + return new ObjectContainer(parseAST(), identifier, line); + else if(t.type==Token.Type.IDENTIFIER){ + moveAhead(); + return new ObjectContainer(t.value, + parseAST(), identifier, line); + }else throw new ParserException(lexer, "expected name of object or open bracket"); + }else if(keyword==KayJamIdentifier.CLASS){ + moveAhead(); + type = lexer.currentToken().type; + if(type == Token.Type.IDENTIFIER){ + String name = lexer.currentToken().value; + String extendsClass = null; + List implementsClass = new ArrayList<>(); + + while (moveAhead().type!=Token.Type.OPEN_BRACKET){ + if(currentTokenType()==Token.Type.TK_COMPANION_ACCESS) + implementsClass.add(requireToken(Token.Type.IDENTIFIER).value); + else if(currentTokenType()==Token.Type.TK_COLON&&extendsClass==null) + extendsClass = requireToken(Token.Type.IDENTIFIER).value; + else throw new ParserException(lexer, "expected open bracket or extends/implements token"); + } + + return new ClassContainer(name, extendsClass, implementsClass, + parseAST(), identifier, line); + }else throw new ParserException(lexer, "expected identifier of class"); + }else if(keyword==KayJamIdentifier.RETURN){ + moveAhead(); + return new ReturnExpression(readExpression(), line); + }else if(keyword==KayJamIdentifier.CONSTRUCTOR){ + requireToken(Token.Type.TK_OPEN); + List arguments = parseArguments(); - moveAhead(); - Expression condition = readExpression(); + moveAhead(); + return new ConstructorContainer(arguments, parseAST(), identifier, line); + }else if(keyword==KayJamIdentifier.USE){ + moveAhead(); + return new UseExpression(readExpression(), line); + }else if(keyword==KayJamIdentifier.COMPANION) { + moveAhead(); + return readExpression(AccessIdentifier.COMPANION, annotations); + }else if(keyword==KayJamIdentifier.IF){ + requireToken(Token.Type.TK_OPEN); - requireToken(Token.Type.TK_CLOSE); + moveAhead(); + Expression condition = readExpression(); - moveAhead(); - Expression ifTrue = readExpression(); - Expression ifFalse = null; + requireToken(Token.Type.TK_CLOSE); - if(moveAhead().type == Token.Type.TK_KEY_ELSE){ - moveAhead(); - ifFalse = readExpression(); + moveAhead(); + Expression ifTrue = readExpression(); + Expression ifFalse = null; + + if(KayJamIdentifier.find(moveAhead().value) == KayJamIdentifier.ELSE){ + moveAhead(); + ifFalse = readExpression(); + }else { + lexer.input = new StringBuilder("}"+lexer.currentToken().value+lexer.input); + moveAhead(); + } + + return new IfExpression(condition, ifTrue, ifFalse, line); + } }else { - lexer.input = new StringBuilder("}"+lexer.currentToken().value+lexer.input); - moveAhead(); - } + String name = lexer.currentToken().value; - return new IfExpression(condition, ifTrue, ifFalse, line); + type = moveAhead().type; + if (type == Token.Type.TK_ASSIGN) { + moveAhead(); + Expression expression = readExpression(); + return new VariableSetExpression(name, expression, line); + } else if (type == Token.Type.TK_OPEN) { + List arguments = new ArrayList<>(); + while (moveAhead().type != Token.Type.TK_CLOSE) { + arguments.add(readExpression()); + + Token token = moveAhead(); + if (token.type == Token.Type.TK_CLOSE) + break; + else if (token.type != Token.Type.TK_COMMA) + throw new ParserException(lexer, "expected comma \",\""); + } + + return new CallOrCreateExpression(name, arguments, line); + } else if (type == Token.Type.TK_ACCESS) { + moveAhead(); + return new AccessExpression(new VariableLinkExpression(name, line), readExpression(), line); + } else if (type == Token.Type.TK_COMPANION_ACCESS) { + moveAhead(); + return new CompanionAccessExpression(name, readExpression(), line); + } else if (type == Token.Type.OPEN_BRACKET || type == Token.Type.TK_REF) { + if (type == Token.Type.TK_REF) + moveAhead(); + + return new NamedExpression(name, readExpression(), line); + } else { + lexer.input = new StringBuilder(lexer.currentToken().value + lexer.input); + return new VariableLinkExpression(name, line); + } + } }else if(type == Token.Type.TK_ANNOTATION){ String name = requireToken(Token.Type.IDENTIFIER).value; @@ -308,12 +350,6 @@ else if(currentTokenType()==Token.Type.TK_COLON&&extendsClass==null) }else if(type == Token.Type.TK_NOT){ moveAhead(); return new NegationExpression(readExpression(identifier, annotations), line); - }else if(type == Token.Type.TK_CONSTRUCTOR){ - requireToken(Token.Type.TK_OPEN); - List arguments = parseArguments(); - - moveAhead(); - return new ConstructorContainer(arguments, parseAST(), identifier, line); }else if(type == Token.Type.OPEN_BRACKET){ return new Container(parseAST(), AccessIdentifier.PUBLIC, line); }else if(type == Token.Type.TK_OPEN_SQUARE_BRACKET){ @@ -329,9 +365,6 @@ else if(token.type!=Token.Type.TK_COMMA) } return new ArrayExpression(values, line); - }else if(type == Token.Type.TK_USE){ - moveAhead(); - return new UseExpression(readExpression(), line); }else if(type == Token.Type.STRING){ return new ValueExpression(lexer.currentToken().value.substring(1, lexer.currentToken().value.length()-1)); }else if(type == Token.Type.NULL){ @@ -345,15 +378,6 @@ else if(token.type!=Token.Type.TK_COMMA) return new ValueExpression(Double.parseDouble(lexer.currentToken().value)); }else if(type == Token.Type.BOOL){ return new ValueExpression(lexer.currentToken().value.equals("true")); - }else if(type == Token.Type.TK_PRIVATE) { - moveAhead(); - return readExpression(AccessIdentifier.PRIVATE, annotations); - }else if(type == Token.Type.TK_PUBLIC) { - moveAhead(); - return readExpression(AccessIdentifier.PUBLIC, annotations); - }else if(type == Token.Type.TK_COMPANION) { - moveAhead(); - return readExpression(AccessIdentifier.COMPANION, annotations); }else if(type == Token.Type.TK_SEMI){ moveAhead(); return readPrimary(identifier, annotations); @@ -435,12 +459,14 @@ public Expression parseBinOpRHS(AccessIdentifier identifier, List an } Token binOp = lexer.currentToken(); + + KayJamIdentifier kayJamIdentifier = KayJamIdentifier.find(binOp.value); int line = lexer.getLine(); - if(binOp.type==Token.Type.TK_AS) { + if(kayJamIdentifier==KayJamIdentifier.CAST) { moveAhead(); lhs = new CastExpression(lhs, parseType(false), line); - }else if(binOp.type==Token.Type.TK_IS) { + }else if(kayJamIdentifier==KayJamIdentifier.IS) { moveAhead(); lhs = new IsExpression(lhs, parseType(false), line); }else{ @@ -460,6 +486,20 @@ public Expression parseBinOpRHS(AccessIdentifier identifier, List an } } + public Script parseScript() throws ParserException, LexerException { + List children = new ArrayList<>(); + + while (moveAhead().type != Token.Type.CLOSE_BRACKET) { + children.add(readTopExpression()); + + if (!lexer.isFinished()&&moveAhead().type!=Token.Type.TK_SEMI) + throw new ParserException(lexer, + "A semicolon was expected, but it wasn't there. Please put it on!"); + } + + return new Script(new Container(children, 0)); + } + public List parseAST() throws ParserException, LexerException { if(lexer.currentToken().type!=Token.Type.OPEN_BRACKET) throw new ParserException(lexer, "Expected open bracket"); diff --git a/src/main/java/com/github/kayjamlang/core/KayJamVersion.java b/src/main/java/com/github/kayjamlang/core/KayJamVersion.java index 6879122..93f067b 100644 --- a/src/main/java/com/github/kayjamlang/core/KayJamVersion.java +++ b/src/main/java/com/github/kayjamlang/core/KayJamVersion.java @@ -1,5 +1,5 @@ package com.github.kayjamlang.core; public class KayJamVersion { - public static final Integer VERSION_CODE = 4; + public static final int VERSION_CODE = 5; } diff --git a/src/main/java/com/github/kayjamlang/core/Token.java b/src/main/java/com/github/kayjamlang/core/Token.java index 8dbde4b..2aee0e4 100644 --- a/src/main/java/com/github/kayjamlang/core/Token.java +++ b/src/main/java/com/github/kayjamlang/core/Token.java @@ -19,30 +19,12 @@ public enum Type { TK_REF ("->"), TK_ANNOTATION ("\\@"), TK_NEW_LINE ("\\R"), - TK_PUBLIC ("public "), - TK_PRIVATE ("private "), - TK_COMPANION ("companion "), - TK_RETURN ("return "), - TK_CONSTRUCTOR ("constructor"), - TK_FUNCTION ("(function|fun)"), - TK_CLASS ("class"), - TK_OBJECT ("object"), - TK_USE ("use "), - TK_WHILE ("while"), - TK_NAMED ("named "), - TK_FOR ("for"), TK_COMPANION_ACCESS ("::"), TK_COLON (":"), TK_OPEN ("\\("), TK_CLOSE ("\\)"), TK_SEMI (";"), TK_COMMA (","), - TK_VAR ("var"), - TK_AS("as"), - TK_IS("is"), - TK_KEY_IN ("in "), - TK_KEY_IF ("if"), - TK_KEY_ELSE ("else"), TK_NULLABLE ("\\?"), TK_OPEN_SQUARE_BRACKET("\\["), TK_CLOSE_SQUARE_BRACKET("\\]"), @@ -90,7 +72,7 @@ public enum Type { pattern = Pattern.compile("^" + regex); } - int endOfMatch(String s) { + public int endOfMatch(String s) { Matcher m = pattern.matcher(s); if (m.find()) { diff --git a/src/main/java/com/github/kayjamlang/core/containers/Container.java b/src/main/java/com/github/kayjamlang/core/containers/Container.java index 3fb343b..8988757 100644 --- a/src/main/java/com/github/kayjamlang/core/containers/Container.java +++ b/src/main/java/com/github/kayjamlang/core/containers/Container.java @@ -20,6 +20,10 @@ public Container(List children, AccessIdentifier identifier, int lin } } + public Container(List children, int line) { + this(children, AccessIdentifier.NONE, line); + } + @Override public String toString() { return "Container{" + diff --git a/src/main/java/com/github/kayjamlang/core/containers/Script.java b/src/main/java/com/github/kayjamlang/core/containers/Script.java new file mode 100644 index 0000000..c7b63c4 --- /dev/null +++ b/src/main/java/com/github/kayjamlang/core/containers/Script.java @@ -0,0 +1,36 @@ +package com.github.kayjamlang.core.containers; + +import com.github.kayjamlang.core.exceptions.ParserException; +import com.github.kayjamlang.core.expressions.Expression; +import com.github.kayjamlang.core.expressions.UseExpression; +import com.github.kayjamlang.core.opcodes.AccessIdentifier; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class Script extends Container { + public final Map classes = new HashMap<>(); + public final List usages = new ArrayList<>(); + + public Script(Container container) throws ParserException { + super(new ArrayList<>(), AccessIdentifier.NONE, 0); + functions.addAll(container.functions); + + boolean usagesHeadFinished = false; + for(Expression expression: container.children){ + if(expression instanceof UseExpression){ + if(usagesHeadFinished) + throw new ParserException(expression.line, "All use expressions must be above the rest!"); + + usages.add((UseExpression) expression); + }else usagesHeadFinished = true; + + if(expression instanceof ClassContainer){ + ClassContainer clazz = (ClassContainer) expression; + classes.put(clazz.name, clazz); + } + } + } +} diff --git a/src/main/java/com/github/kayjamlang/core/expressions/UseExpression.java b/src/main/java/com/github/kayjamlang/core/expressions/UseExpression.java index d189aae..8a5c111 100644 --- a/src/main/java/com/github/kayjamlang/core/expressions/UseExpression.java +++ b/src/main/java/com/github/kayjamlang/core/expressions/UseExpression.java @@ -3,13 +3,26 @@ import com.github.kayjamlang.core.opcodes.AccessIdentifier; public class UseExpression extends Expression { + + public final String from; + + public UseExpression(String from, int line){ + super(AccessIdentifier.NONE, line); + this.from = from; + expression = null; + } + + @Deprecated public final Expression expression; + @Deprecated public UseExpression(Expression expression, int line) { super(AccessIdentifier.NONE, line); this.expression = expression; + this.from = null; } + @Deprecated public interface UseInterface{ Expression getExpression(String path) throws Exception; } diff --git a/src/test/java/com/github/kayjamlang/tests/containers/classes/AnonymousObjectContainerTest.java b/src/test/java/com/github/kayjamlang/tests/containers/classes/AnonymousObjectContainerTest.java index ff6d827..97dbd6c 100644 --- a/src/test/java/com/github/kayjamlang/tests/containers/classes/AnonymousObjectContainerTest.java +++ b/src/test/java/com/github/kayjamlang/tests/containers/classes/AnonymousObjectContainerTest.java @@ -20,7 +20,7 @@ public static void prepare(){ @Test public void test() throws Exception { - Expression expression = parser.readExpression(); + Expression expression = parser.readTopExpression(); assertNotNull(expression); assertSame(ObjectContainer.class, expression.getClass()); diff --git a/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassContainerTest.java b/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassContainerTest.java index 6c382d2..f9719e9 100644 --- a/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassContainerTest.java +++ b/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassContainerTest.java @@ -20,7 +20,7 @@ public static void prepare(){ @Test public void test() throws Exception { - Expression expression = parser.readExpression(); + Expression expression = parser.readTopExpression(); assertNotNull(expression); assertSame(ClassContainer.class, expression.getClass()); diff --git a/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassExtendsContainerTest.java b/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassExtendsContainerTest.java index 53197fb..fe50789 100644 --- a/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassExtendsContainerTest.java +++ b/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassExtendsContainerTest.java @@ -20,7 +20,7 @@ public static void prepare(){ @Test public void test() throws Exception { - Expression expression = parser.readExpression(); + Expression expression = parser.readTopExpression(); assertNotNull(expression); assertSame(ClassContainer.class, expression.getClass()); diff --git a/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassExtendsImplementsContainerTest.java b/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassExtendsImplementsContainerTest.java index b4d1290..984a466 100644 --- a/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassExtendsImplementsContainerTest.java +++ b/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassExtendsImplementsContainerTest.java @@ -20,7 +20,7 @@ public static void prepare(){ @Test public void test() throws Exception { - Expression expression = parser.readExpression(); + Expression expression = parser.readTopExpression(); assertNotNull(expression); assertSame(ClassContainer.class, expression.getClass()); diff --git a/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassImplementsContainerTest.java b/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassImplementsContainerTest.java index 5387f68..c33e62c 100644 --- a/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassImplementsContainerTest.java +++ b/src/test/java/com/github/kayjamlang/tests/containers/classes/ClassImplementsContainerTest.java @@ -20,7 +20,7 @@ public static void prepare(){ @Test public void test() throws Exception { - Expression expression = parser.readExpression(); + Expression expression = parser.readTopExpression(); assertNotNull(expression); assertSame(ClassContainer.class, expression.getClass()); diff --git a/src/test/java/com/github/kayjamlang/tests/containers/classes/CloneClassContainerTest.java b/src/test/java/com/github/kayjamlang/tests/containers/classes/CloneClassContainerTest.java index d89e525..fa28043 100644 --- a/src/test/java/com/github/kayjamlang/tests/containers/classes/CloneClassContainerTest.java +++ b/src/test/java/com/github/kayjamlang/tests/containers/classes/CloneClassContainerTest.java @@ -20,7 +20,7 @@ public static void prepare(){ @Test public void test() throws Exception { - Expression expression = parser.readExpression(); + Expression expression = parser.readTopExpression(); assertNotNull(expression); assertSame(ClassContainer.class, expression.getClass()); diff --git a/src/test/java/com/github/kayjamlang/tests/containers/classes/ObjectContainerTest.java b/src/test/java/com/github/kayjamlang/tests/containers/classes/ObjectContainerTest.java index 787f31a..e436cdc 100644 --- a/src/test/java/com/github/kayjamlang/tests/containers/classes/ObjectContainerTest.java +++ b/src/test/java/com/github/kayjamlang/tests/containers/classes/ObjectContainerTest.java @@ -20,7 +20,7 @@ public static void prepare(){ @Test public void test() throws Exception { - Expression expression = parser.readExpression(); + Expression expression = parser.readTopExpression(); assertNotNull(expression); assertSame(ObjectContainer.class, expression.getClass()); diff --git a/src/test/java/com/github/kayjamlang/tests/expressions/UseExpressionTest.java b/src/test/java/com/github/kayjamlang/tests/expressions/UseExpressionTest.java index 555e1f0..1da8fdd 100644 --- a/src/test/java/com/github/kayjamlang/tests/expressions/UseExpressionTest.java +++ b/src/test/java/com/github/kayjamlang/tests/expressions/UseExpressionTest.java @@ -21,7 +21,7 @@ public static void prepare(){ @Test public void test() throws Exception { - Expression expression = parser.readExpression(); + Expression expression = parser.readTopExpression(); assertNotNull(expression); assertSame(UseExpression.class, expression.getClass());