]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/TestCommandParsing.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / TestCommandParsing.java
1 package org.simantics.scl.compiler.tests;
2
3 import java.io.Reader;
4 import java.io.StringReader;
5
6 import org.junit.Test;
7 import org.simantics.scl.compiler.internal.parsing.parser.SCLParser;
8 import org.simantics.scl.compiler.internal.parsing.parser.SCLParserImpl;
9
10 public class TestCommandParsing {
11     @Test
12     public void testCommandParsing() throws Exception {
13         Reader reader = new StringReader("import \"asdasd\";a = 1\nb = 2");
14         SCLParser parser = new SCLParserImpl(reader) {
15             @Override
16             protected Object reduceStatementCommand() {
17                 System.out.println("statement " + get(0));
18                 return null;
19             }
20             
21             @Override
22             protected Object reduceImport() {
23                 System.out.println("import " + get(0));
24                 return null;
25             }
26         };
27         parser.parseCommands();
28     }
29 }