• R/O
  • SSH

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Commit MetaInfo

Revision8694f68f84f866b6636b099a55cb1a2cdfb5129c (tree)
Zeit2015-10-21 11:54:12
AutorMirrgieRiana
CommiterMirrgieRiana

Log Message

TestLithiumBromide: source: -> file(test.libr)

Ändern Zusammenfassung

Diff

diff -r ad9ce0b4b32b -r 8694f68f84f8 projects/mirrg.compile.lithiumbromide/src/main/resources/mirrg/compile/lithiumbromide/test.libr
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/projects/mirrg.compile.lithiumbromide/src/main/resources/mirrg/compile/lithiumbromide/test.libr Wed Oct 21 11:54:12 2015 +0900
@@ -0,0 +1,22 @@
1+comment := {
2+ "[ \t\r\n]+"
3+ | "//[^\r\n]*"
4+ | "/\*((.|\r|\n)(?<!\*/))*\*/"};
5+integer := comment "[0-9]+"<string> : <INTEGER>;
6+double := comment "[0-9]+\.[0-9]+"<string> : <DOUBLE>;
7+real :=
8+ integer
9+ | double;
10+imaginary := real<real> comment 'i' : <IMAGINARY>;
11+bracket := comment '(' expression<expression> comment ')' : <BRACKET>;
12+factor :=
13+ real
14+ | imaginary
15+ | bracket;
16+term := [factor,
17+ comment '*'<operator> : <OPERATOR>
18+ | comment '/'<operator> : <OPERATOR>]<operations> : <OPERATIONS>;
19+expression := [term,
20+ comment '+' <operator> : <OPERATOR>
21+ | comment '-' <operator> : <OPERATOR>]<operations> : <OPERATIONS>;
22+root := expression<expression> comment "$" : <ROOT>;
diff -r ad9ce0b4b32b -r 8694f68f84f8 projects/mirrg.compile.lithiumbromide/src/main/resources/org/gradle/resource.xml
--- a/projects/mirrg.compile.lithiumbromide/src/main/resources/org/gradle/resource.xml Wed Oct 21 11:43:36 2015 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
1-<some-element/>
diff -r ad9ce0b4b32b -r 8694f68f84f8 projects/mirrg.compile.lithiumbromide/src/test/java/mirrg/compile/lithiumbromide/SampleFrame.java
--- a/projects/mirrg.compile.lithiumbromide/src/test/java/mirrg/compile/lithiumbromide/SampleFrame.java Wed Oct 21 11:43:36 2015 +0900
+++ b/projects/mirrg.compile.lithiumbromide/src/test/java/mirrg/compile/lithiumbromide/SampleFrame.java Wed Oct 21 11:54:12 2015 +0900
@@ -6,6 +6,7 @@
66 import java.awt.Dimension;
77 import java.awt.Font;
88 import java.awt.GraphicsEnvironment;
9+import java.io.IOException;
910 import java.util.Locale;
1011 import java.util.stream.Stream;
1112
@@ -26,10 +27,10 @@
2627 public class SampleFrame
2728 {
2829
29- public static void main(String[] args)
30+ public static void main(String[] args) throws IOException
3031 {
3132 CompilerBromine<INodeExpressionBase> compiler = TestLithiumBromide.createCompiler(
32- TestLithiumBromide.createNodeLines(TestLithiumBromide.source));
33+ TestLithiumBromide.createNodeLines(TestLithiumBromide.getSource()));
3334
3435 HSwing.setWindowsLookAndFeel();
3536
diff -r ad9ce0b4b32b -r 8694f68f84f8 projects/mirrg.compile.lithiumbromide/src/test/java/mirrg/compile/lithiumbromide/TestLithiumBromide.java
--- a/projects/mirrg.compile.lithiumbromide/src/test/java/mirrg/compile/lithiumbromide/TestLithiumBromide.java Wed Oct 21 11:43:36 2015 +0900
+++ b/projects/mirrg.compile.lithiumbromide/src/test/java/mirrg/compile/lithiumbromide/TestLithiumBromide.java Wed Oct 21 11:54:12 2015 +0900
@@ -2,8 +2,12 @@
22
33 import static org.junit.Assert.*;
44
5+import java.io.BufferedReader;
6+import java.io.IOException;
7+import java.io.InputStreamReader;
58 import java.util.Hashtable;
69 import java.util.function.Supplier;
10+import java.util.stream.Collectors;
711
812 import org.junit.Test;
913
@@ -20,29 +24,12 @@
2024 public class TestLithiumBromide
2125 {
2226
23- public static final String source = ""
24- + "comment := {\n"
25- + " \"[ \\t\\r\\n]+\"\n"
26- + " | \"//[^\\r\\n]*\"\n"
27- + " | \"/\\*((.|\\r|\\n)(?<!\\*/))*\\*/\"};\n"
28- + "integer := comment \"[0-9]+\"<string> : <INTEGER>;\n"
29- + "double := comment \"[0-9]+\\.[0-9]+\"<string> : <DOUBLE>;\n"
30- + "real :=\n"
31- + " integer\n"
32- + " | double;\n"
33- + "imaginary := real<real> comment 'i' : <IMAGINARY>;\n"
34- + "bracket := comment '(' expression<expression> comment ')' : <BRACKET>;\n"
35- + "factor :=\n"
36- + " real\n"
37- + " | imaginary\n"
38- + " | bracket;\n"
39- + "term := [factor,\n"
40- + " comment '*'<operator> : <OPERATOR>\n"
41- + " | comment '/'<operator> : <OPERATOR>]<operations> : <OPERATIONS>;\n"
42- + "expression := [term,\n"
43- + " comment '+' <operator> : <OPERATOR>\n"
44- + " | comment '-' <operator> : <OPERATOR>]<operations> : <OPERATIONS>;\n"
45- + "root := expression<expression> comment \"$\" : <ROOT>;\n";
27+ public static String getSource() throws IOException
28+ {
29+ return new BufferedReader(new InputStreamReader(
30+ TestLithiumBromide.class.getResource("test.libr").openStream())).lines()
31+ .collect(Collectors.joining(System.lineSeparator()));
32+ }
4633
4734 public static Hashtable<String, Supplier<ITNode>> getTableCreator()
4835 {
@@ -108,8 +95,10 @@
10895 }
10996
11097 @Test
111- public void test()
98+ public void test() throws IOException
11299 {
100+ String source = getSource();
101+
113102 System.out.println(source);
114103 System.out.println();
115104