| 1 | From 56ae699a27eca52cc0bb14cbc9944b62136be52b Mon Sep 17 00:00:00 2001
|
| 2 | From: Julien Lepiller <[email protected]>
|
| 3 | Date: Sun, 20 Sep 2020 21:07:29 +0200
|
| 4 | Subject: [PATCH] Separate addPropertyAliases in two methods
|
| 5 |
|
| 6 | The quantity of data used to generate addPropertyAliases creates a big
|
| 7 | method, that is too big for java and results in "error: code too large".
|
| 8 | This is most likely due to added data between the expected version of
|
| 9 | icu and the actual version of icu in Guix.
|
| 10 | ---
|
| 11 | .../org/antlr/v4/tool/templates/unicodedata.st | 15 ++++++++++++---
|
| 12 | .../unicode/UnicodeDataTemplateController.java | 18 ++++++++++--------
|
| 13 | 2 files changed, 22 insertions(+), 11 deletions(-)
|
| 14 |
|
| 15 | diff --git a/tool/resources/org/antlr/v4/tool/templates/unicodedata.st b/tool/resources/org/antlr/v4/tool/templates/unicodedata.st
|
| 16 | index f5052b7..125d15b 100644
|
| 17 | |
| 18 | |
| 19 | @@ -1,4 +1,4 @@
|
| 20 | -unicodedata(propertyCodePointRanges, propertyAliases) ::= <<
|
| 21 | +unicodedata(propertyCodePointRanges, propertyAliasesA, propertyAliasesB) ::= <<
|
| 22 | package org.antlr.v4.unicode;
|
| 23 |
|
| 24 | import java.util.Arrays;
|
| 25 | @@ -17,7 +17,7 @@ public enum UnicodeData {
|
| 26 | ;
|
| 27 |
|
| 28 | private static final Map\<String, IntervalSet\> propertyCodePointRanges = new HashMap\<String, IntervalSet\>(<length(propertyCodePointRanges)>);
|
| 29 | - private static final Map\<String, String\> propertyAliases = new HashMap\<String, String\>(<length(propertyAliases)>);
|
| 30 | + private static final Map\<String, String\> propertyAliases = new HashMap\<String, String\>(<length(propertyAliasesA)> + <length(propertyAliasesB)>);
|
| 31 |
|
| 32 | // Work around Java 64k bytecode method limit by splitting up static
|
| 33 | // initialization into one method per Unicode property
|
| 34 | @@ -33,8 +33,17 @@ static private void addProperty<i>() {
|
| 35 | \}}; separator="\n\n">
|
| 36 |
|
| 37 | // Property aliases
|
| 38 | + static private void addPropertyAliasesA() {
|
| 39 | + <propertyAliasesA.keys:{ k | propertyAliases.put("<k>".toLowerCase(Locale.US), "<propertyAliasesA.(k)>".toLowerCase(Locale.US)); }; separator="\n">
|
| 40 | + }
|
| 41 | +
|
| 42 | + static private void addPropertyAliasesB() {
|
| 43 | + <propertyAliasesB.keys:{ k | propertyAliases.put("<k>".toLowerCase(Locale.US), "<propertyAliasesB.(k)>".toLowerCase(Locale.US)); }; separator="\n">
|
| 44 | + }
|
| 45 | +
|
| 46 | static private void addPropertyAliases() {
|
| 47 | - <propertyAliases.keys:{ k | propertyAliases.put("<k>".toLowerCase(Locale.US), "<propertyAliases.(k)>".toLowerCase(Locale.US)); }; separator="\n">
|
| 48 | + addPropertyAliasesA();
|
| 49 | + addPropertyAliasesB();
|
| 50 | }
|
| 51 |
|
| 52 | // Put it all together
|
| 53 | diff --git a/tool/src/org/antlr/v4/unicode/UnicodeDataTemplateController.java b/tool/src/org/antlr/v4/unicode/UnicodeDataTemplateController.java
|
| 54 | index 570190c..692cee0 100644
|
| 55 | |
| 56 | |
| 57 | @@ -74,17 +74,19 @@ public abstract class UnicodeDataTemplateController {
|
| 58 | addTR35ExtendedPictographicPropertyCodesToCodePointRanges(propertyCodePointRanges);
|
| 59 | addEmojiPresentationPropertyCodesToCodePointRanges(propertyCodePointRanges);
|
| 60 |
|
| 61 | - Map<String, String> propertyAliases = new LinkedHashMap<String, String>();
|
| 62 | - addUnicodeCategoryCodesToNames(propertyAliases);
|
| 63 | - addUnicodeBinaryPropertyCodesToNames(propertyAliases);
|
| 64 | - addUnicodeScriptCodesToNames(propertyAliases);
|
| 65 | - addUnicodeBlocksToNames(propertyAliases);
|
| 66 | - addUnicodeIntPropertyCodesToNames(propertyAliases);
|
| 67 | - propertyAliases.put("EP", "Extended_Pictographic");
|
| 68 | + Map<String, String> propertyAliasesA = new LinkedHashMap<String, String>();
|
| 69 | + Map<String, String> propertyAliasesB = new LinkedHashMap<String, String>();
|
| 70 | + addUnicodeCategoryCodesToNames(propertyAliasesA);
|
| 71 | + addUnicodeBinaryPropertyCodesToNames(propertyAliasesA);
|
| 72 | + addUnicodeScriptCodesToNames(propertyAliasesA);
|
| 73 | + addUnicodeBlocksToNames(propertyAliasesB);
|
| 74 | + addUnicodeIntPropertyCodesToNames(propertyAliasesB);
|
| 75 | + propertyAliasesB.put("EP", "Extended_Pictographic");
|
| 76 |
|
| 77 | Map<String, Object> properties = new LinkedHashMap<String, Object>();
|
| 78 | properties.put("propertyCodePointRanges", propertyCodePointRanges);
|
| 79 | - properties.put("propertyAliases", propertyAliases);
|
| 80 | + properties.put("propertyAliasesA", propertyAliasesA);
|
| 81 | + properties.put("propertyAliasesB", propertyAliasesB);
|
| 82 | return properties;
|
| 83 | }
|
| 84 |
|
| 85 | --
|
| 86 | 2.28.0
|
| 87 |
|