aboutsummaryrefslogtreecommitdiffstats
path: root/test/core/parser
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/parser')
-rw-r--r--test/core/parser/ParserTest.java21
1 files changed, 9 insertions, 12 deletions
diff --git a/test/core/parser/ParserTest.java b/test/core/parser/ParserTest.java
index 913896e..9dc51e3 100644
--- a/test/core/parser/ParserTest.java
+++ b/test/core/parser/ParserTest.java
@@ -1,8 +1,9 @@
package com.jantuomi.interpreter.test.core.parser;
import com.jantuomi.interpreter.main.core.parser.Parser;
-import com.jantuomi.interpreter.main.core.parser.ast.ASTNode;
import com.jantuomi.interpreter.main.core.tokenizer.token.Token;
+import com.jantuomi.interpreter.main.core.tokenizer.token.types.AdditionToken;
+import com.jantuomi.interpreter.main.core.tokenizer.token.types.IntegerLiteralToken;
import org.junit.Test;
import java.util.Arrays;
@@ -14,21 +15,17 @@ import java.util.List;
public class ParserTest {
@Test
- public void parseAssignment() throws Exception {
+ public void testParseAddition() throws Exception {
List<Token> tokens = Arrays.asList(
- new Token(Token.Type.SymbolToken, "x"),
- new Token(Token.Type.AssignmentToken),
- new Token(Token.Type.SymbolToken, "y"),
- new Token(Token.Type.AdditionToken),
- new Token(Token.Type.SymbolToken, "x"),
- new Token(Token.Type.AdditionToken),
- new Token(Token.Type.IntegerLiteralToken, "1")
+ new IntegerLiteralToken("1"),
+ new IntegerLiteralToken("2"),
+ new AdditionToken()
);
Parser parser = Parser.getInstance();
- List<ASTNode> sequence = parser.parse(tokens);
- for (ASTNode e : sequence) {
- parser.printTree(e);
+ List<Token> sequence = parser.parse(tokens);
+ for (Token t : sequence) {
+ parser.printTree(t);
}
}
} \ No newline at end of file