summaryrefslogtreecommitdiff
path: root/RGens/src/main/java/bjc/rgens/newparser/RGrammarTest.java
blob: 14b29e77481efbe9cbdcbf29ec40ad459e84b4fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package bjc.rgens.newparser;

import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;

/**
 * Test for new grammar syntax.
 * 
 * @author EVE
 *
 */
public class RGrammarTest {
	/**
	 * Main method.
	 * 
	 * @param args
	 *                Unused CLI args.
	 */
	public static void main(String[] args) {
		URL rsc = RGrammarTest.class.getResource("/server-config-sample.cfg");

		try {
			RGrammarSet gramSet = RGrammarSet.fromConfigFile(Paths.get(rsc.toURI()));

			for(String exportName : gramSet.getExportedRules()) {
				RGrammar grammar = gramSet.getExportSource(exportName);

				grammar.generate(exportName);
			}
		} catch(IOException ioex) {
			ioex.printStackTrace();
		} catch(URISyntaxException urisex) {
			urisex.printStackTrace();
		}
	}
}