summaryrefslogtreecommitdiff
path: root/chapter01/src/test/java/com/seaofnodes
diff options
context:
space:
mode:
authordibyendumajumdar <mobile@majumdar.org.uk>2023-09-07 19:33:52 +0100
committerdibyendumajumdar <mobile@majumdar.org.uk>2023-09-07 19:33:52 +0100
commit85e5d41217d27fd481a21d17f061d31dc120873b (patch)
tree96e3fe2d316cf5a8fd78b6734054c23d3251cb54 /chapter01/src/test/java/com/seaofnodes
parent867405ea40d3c8acd93e5e0e6030e8ad96eb2470 (diff)
downloadSimple-85e5d41217d27fd481a21d17f061d31dc120873b.tar.gz
Simple-85e5d41217d27fd481a21d17f061d31dc120873b.zip
Removed all external code.
Removed the common chapter. Reimplemented Lexer. Revised the list of chapters to something more accurate.
Diffstat (limited to 'chapter01/src/test/java/com/seaofnodes')
-rw-r--r--chapter01/src/test/java/com/seaofnodes/simple/parser/TestParser.java (renamed from chapter01/src/test/java/com/seaofnodes/simple/lexer/TestParser.java)12
1 files changed, 4 insertions, 8 deletions
diff --git a/chapter01/src/test/java/com/seaofnodes/simple/lexer/TestParser.java b/chapter01/src/test/java/com/seaofnodes/simple/parser/TestParser.java
index 3f65e0f9..356420eb 100644
--- a/chapter01/src/test/java/com/seaofnodes/simple/lexer/TestParser.java
+++ b/chapter01/src/test/java/com/seaofnodes/simple/parser/TestParser.java
@@ -13,12 +13,8 @@
* http://www.apache.org/licenses/LICENSE-2.0
*/
-package com.seaofnodes.simple.lexer;
+package com.seaofnodes.simple.parser;
-import com.seaofnodes.simple.lexer.ecstasy.ErrorListener;
-import com.seaofnodes.simple.lexer.ecstasy.Lexer;
-import com.seaofnodes.simple.lexer.ecstasy.Source;
-import com.seaofnodes.simple.parser.Parser;
import org.junit.Assert;
import org.junit.Test;
@@ -28,7 +24,7 @@ public class TestParser {
public void testParseSingleDecl()
{
final String source = "int i;";
- Lexer lexer = new Lexer(new Source(source), new ErrorListener());
+ Lexer lexer = new Lexer(source);
Parser parser = new Parser();
var ast = parser.parse(lexer);
Assert.assertEquals("{int i;}", ast.toString());
@@ -37,7 +33,7 @@ public class TestParser {
@Test
public void testParseTwoDecls() {
final String source = "int i;\nint j;";
- Lexer lexer = new Lexer(new Source(source), new ErrorListener());
+ Lexer lexer = new Lexer(source);
Parser parser = new Parser();
var ast = parser.parse(lexer);
Assert.assertEquals("{int i;int j;}", ast.toString());
@@ -58,7 +54,7 @@ public class TestParser {
if ( i >= j ) break;
}
""";
- Lexer lexer = new Lexer(new Source(source), new ErrorListener());
+ Lexer lexer = new Lexer(source);
Parser parser = new Parser();
var ast = parser.parse(lexer);
Assert.assertEquals("{int i;int j;i=0;j=100;while(1) {i=(i+1);j=(j-1);if((i>=j)) break;}}", ast.toString());