unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 75b6dce39f1ff1c55cb2d7d50e4d1e4125c9a987 1694 bytes (raw)
name: packages/patches/java-antlr4-Add-standalone-generator.patch 	 # note: path name is non-authoritative(*)

 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 
From 3b43b79da15be994348f13035474925ba592fe1f Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Fri, 15 Sep 2017 10:06:42 +0200
Subject: [PATCH] Add standalone template generator

---
 tool/src/org/antlr/v4/unicode/UnicodeRenderer.java | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 tool/src/org/antlr/v4/unicode/UnicodeRenderer.java

diff --git a/tool/src/org/antlr/v4/unicode/UnicodeRenderer.java b/tool/src/org/antlr/v4/unicode/UnicodeRenderer.java
new file mode 100644
index 0000000..9e53213
--- /dev/null
+++ b/tool/src/org/antlr/v4/unicode/UnicodeRenderer.java
@@ -0,0 +1,33 @@
+package org.antlr.v4.unicode;
+
+import org.stringtemplate.v4.*;
+import org.stringtemplate.v4.misc.ErrorBuffer;
+import org.antlr.v4.unicode.UnicodeDataTemplateController;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Map.Entry;
+
+public class UnicodeRenderer extends UnicodeDataTemplateController {
+    public static void main(String[] arg)
+        throws IOException {
+        String inputdir =  arg[0];
+        String input =     arg[1];
+        String output =    arg[2];
+
+        FileWriter fileWriter = new FileWriter(new File(output));
+        ErrorBuffer listener = new ErrorBuffer();
+
+        STGroupDir group = new STGroupDir(inputdir);
+        ST st = group.getInstanceOf(input);
+
+        for(Entry<String, Object> entry : getProperties().entrySet())
+        	st.add(entry.getKey(), entry.getValue());
+
+        st.write(new AutoIndentWriter(fileWriter), listener);
+        fileWriter.flush();
+        fileWriter.close();
+    }
+}
-- 
2.13.5


debug log:

solving 75b6dce39f1ff1c55cb2d7d50e4d1e4125c9a987 ...
found 75b6dce39f1ff1c55cb2d7d50e4d1e4125c9a987 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).