Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Unicode Emoji properties #546

Merged
merged 2 commits into from
Mar 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,56 @@ public void scan(URL url, UnicodeVersion version) throws IOException {
* code points (old Korean syllables), so the Age property is excluded for those code points in
* following Unicode versions.
*/
@Override
public URL getURL(String version, URL baseURL, String versionedDirectoryListing)
throws MalformedURLException {
return version.startsWith("1.1")
? null
: new URL("http://www.unicode.org/Public/UNIDATA/DerivedAge.txt");
}
},

EMOJI("emoji-data") {
public void scan(URL url, UnicodeVersion version) throws IOException {
try (Reader reader = new InputStreamReader(url.openStream(), "UTF-8")) {
BinaryPropertiesFileScanner scanner = new BinaryPropertiesFileScanner(reader, version);
scanner.scan();
}
}
/**
* Pull Emoji data from the emoji version corresponding to the Unicode version. The most recent
* Emoji Version data is used for each Unicode version. NOTE: Emoji 1.0 data is in a completely
* different format and will not be supported.
*
* <p>From http://unicode.org/reports/tr51/ :
*
* <ul>
* <li>Emoji 1.0 2015-06-09 Unicode 8.0
* <li>Emoji 2.0 2015-11-12 Unicode 8.0
* <li>Emoji 3.0 2016-06-03 Unicode 9.0
* <li>Emoji 4.0 2016-11-22 Unicode 9.0
* <li>Emoji 5.0 2017-06-20 Unicode 10.0
* <li>Emoji 11.0 2018-05-21 Unicode 11.0
* </ul>
*/
@Override
public URL getURL(String version, URL baseURL, String versionedDirectoryListing)
throws MalformedURLException {
URL url = null; // default: not supported for this version of Unicode
String[] versionComponents = version.split("\\.");
int majorVersion = Integer.parseInt(versionComponents[0]);
if (majorVersion >= 11) {
String majorMinorVersion = versionComponents[0] + "." + versionComponents[1];
url = new URL("https://unicode.org/Public/emoji/" + majorMinorVersion + "/emoji-data.txt");
} else if (majorVersion == 8) {
url = new URL("https://unicode.org/Public/emoji/2.0/emoji-data.txt");
} else if (majorVersion == 9) {
url = new URL("https://unicode.org/Public/emoji/4.0/emoji-data.txt");
} else if (majorVersion == 10) {
url = new URL("https://unicode.org/Public/emoji/5.0/emoji-data.txt");
}
return url;
}
};

DataFileType(String fileNamePrefix) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ItemSeparator = {Spaces} ";" {Spaces}
}

<PROPERTY_NAME> {
[^ \t\r\n]+ { propertyName = yytext(); }
[^ \t\r\n#]+ { propertyName = yytext(); }

{Spaces} ("#" .*)? {NL} { addCurrentInterval(); yybegin(YYINITIAL); }
}
Expand Down
1 change: 1 addition & 0 deletions jflex/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [JFlex 1.8.0](https://github.com/jflex-de/jflex/milestone/11)
- Unicode 10.0 is supported (#540)
- Unicode Emoji properties are supported for Unicode versions 8.0+ (#546)

## [JFlex 1.7.0](https://github.com/jflex-de/jflex/milestone/10) (September 21, 2018)
- Unicode 8.0 and 9.0 are supported (#209)
Expand Down
266 changes: 265 additions & 1 deletion jflex/src/main/java/jflex/core/unicode/data/Unicode_10_0.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ public class Unicode_10_0 {
"cherokee", "cn", "co", "common", "coptic",
"cuneiform", "cypriot", "cyrillic", "dash", "defaultignorablecodepoint",
"deprecated", "deseret", "devanagari", "diacritic", "duployan",
"egyptianhieroglyphs", "elbasan", "ethiopic", "extender", "georgian",
"egyptianhieroglyphs", "elbasan", "emoji", "emojicomponent", "emojimodifier",
"emojimodifierbase", "emojipresentation", "ethiopic", "extender", "georgian",
"glagolitic", "gothic", "grantha", "graph", "graphemebase",
"graphemeclusterbreak=control", "graphemeclusterbreak=cr", "graphemeclusterbreak=ebase",
"graphemeclusterbreak=ebasegaz", "graphemeclusterbreak=emodifier",
Expand Down Expand Up @@ -16827,6 +16828,269 @@ public class Unicode_10_0 {
"\ud80c\udc00\ud80d\udc2e",
// Unicode 10.0 property value: {elbasan}
"\ud801\udd00\ud801\udd27",
// Unicode 10.0 property value: {emoji}
"\u0023\u0023"
+ "\u002a\u002a"
+ "\u0030\u0039"
+ "\u00a9\u00a9"
+ "\u00ae\u00ae"
+ "\u203c\u203c"
+ "\u2049\u2049"
+ "\u2122\u2122"
+ "\u2139\u2139"
+ "\u2194\u2199"
+ "\u21a9\u21aa"
+ "\u231a\u231b"
+ "\u2328\u2328"
+ "\u23cf\u23cf"
+ "\u23e9\u23f3"
+ "\u23f8\u23fa"
+ "\u24c2\u24c2"
+ "\u25aa\u25ab"
+ "\u25b6\u25b6"
+ "\u25c0\u25c0"
+ "\u25fb\u25fe"
+ "\u2600\u2604"
+ "\u260e\u260e"
+ "\u2611\u2611"
+ "\u2614\u2615"
+ "\u2618\u2618"
+ "\u261d\u261d"
+ "\u2620\u2620"
+ "\u2622\u2623"
+ "\u2626\u2626"
+ "\u262a\u262a"
+ "\u262e\u262f"
+ "\u2638\u263a"
+ "\u2640\u2640"
+ "\u2642\u2642"
+ "\u2648\u2653"
+ "\u2660\u2660"
+ "\u2663\u2663"
+ "\u2665\u2666"
+ "\u2668\u2668"
+ "\u267b\u267b"
+ "\u267f\u267f"
+ "\u2692\u2697"
+ "\u2699\u2699"
+ "\u269b\u269c"
+ "\u26a0\u26a1"
+ "\u26aa\u26ab"
+ "\u26b0\u26b1"
+ "\u26bd\u26be"
+ "\u26c4\u26c5"
+ "\u26c8\u26c8"
+ "\u26ce\u26cf"
+ "\u26d1\u26d1"
+ "\u26d3\u26d4"
+ "\u26e9\u26ea"
+ "\u26f0\u26f5"
+ "\u26f7\u26fa"
+ "\u26fd\u26fd"
+ "\u2702\u2702"
+ "\u2705\u2705"
+ "\u2708\u270d"
+ "\u270f\u270f"
+ "\u2712\u2712"
+ "\u2714\u2714"
+ "\u2716\u2716"
+ "\u271d\u271d"
+ "\u2721\u2721"
+ "\u2728\u2728"
+ "\u2733\u2734"
+ "\u2744\u2744"
+ "\u2747\u2747"
+ "\u274c\u274c"
+ "\u274e\u274e"
+ "\u2753\u2755"
+ "\u2757\u2757"
+ "\u2763\u2764"
+ "\u2795\u2797"
+ "\u27a1\u27a1"
+ "\u27b0\u27b0"
+ "\u27bf\u27bf"
+ "\u2934\u2935"
+ "\u2b05\u2b07"
+ "\u2b1b\u2b1c"
+ "\u2b50\u2b50"
+ "\u2b55\u2b55"
+ "\u3030\u3030"
+ "\u303d\u303d"
+ "\u3297\u3297"
+ "\u3299\u3299"
+ "\ud83c\udc04\ud83c\udc04"
+ "\ud83c\udccf\ud83c\udccf"
+ "\ud83c\udd70\ud83c\udd71"
+ "\ud83c\udd7e\ud83c\udd7f"
+ "\ud83c\udd8e\ud83c\udd8e"
+ "\ud83c\udd91\ud83c\udd9a"
+ "\ud83c\udde6\ud83c\uddff"
+ "\ud83c\ude01\ud83c\ude02"
+ "\ud83c\ude1a\ud83c\ude1a"
+ "\ud83c\ude2f\ud83c\ude2f"
+ "\ud83c\ude32\ud83c\ude3a"
+ "\ud83c\ude50\ud83c\ude51"
+ "\ud83c\udf00\ud83c\udf21"
+ "\ud83c\udf24\ud83c\udf93"
+ "\ud83c\udf96\ud83c\udf97"
+ "\ud83c\udf99\ud83c\udf9b"
+ "\ud83c\udf9e\ud83c\udff0"
+ "\ud83c\udff3\ud83c\udff5"
+ "\ud83c\udff7\ud83d\udcfd"
+ "\ud83d\udcff\ud83d\udd3d"
+ "\ud83d\udd49\ud83d\udd4e"
+ "\ud83d\udd50\ud83d\udd67"
+ "\ud83d\udd6f\ud83d\udd70"
+ "\ud83d\udd73\ud83d\udd7a"
+ "\ud83d\udd87\ud83d\udd87"
+ "\ud83d\udd8a\ud83d\udd8d"
+ "\ud83d\udd90\ud83d\udd90"
+ "\ud83d\udd95\ud83d\udd96"
+ "\ud83d\udda4\ud83d\udda5"
+ "\ud83d\udda8\ud83d\udda8"
+ "\ud83d\uddb1\ud83d\uddb2"
+ "\ud83d\uddbc\ud83d\uddbc"
+ "\ud83d\uddc2\ud83d\uddc4"
+ "\ud83d\uddd1\ud83d\uddd3"
+ "\ud83d\udddc\ud83d\uddde"
+ "\ud83d\udde1\ud83d\udde1"
+ "\ud83d\udde3\ud83d\udde3"
+ "\ud83d\udde8\ud83d\udde8"
+ "\ud83d\uddef\ud83d\uddef"
+ "\ud83d\uddf3\ud83d\uddf3"
+ "\ud83d\uddfa\ud83d\ude4f"
+ "\ud83d\ude80\ud83d\udec5"
+ "\ud83d\udecb\ud83d\uded2"
+ "\ud83d\udee0\ud83d\udee5"
+ "\ud83d\udee9\ud83d\udee9"
+ "\ud83d\udeeb\ud83d\udeec"
+ "\ud83d\udef0\ud83d\udef0"
+ "\ud83d\udef3\ud83d\udef8"
+ "\ud83e\udd10\ud83e\udd3a"
+ "\ud83e\udd3c\ud83e\udd3e"
+ "\ud83e\udd40\ud83e\udd45"
+ "\ud83e\udd47\ud83e\udd4c"
+ "\ud83e\udd50\ud83e\udd6b"
+ "\ud83e\udd80\ud83e\udd97"
+ "\ud83e\uddc0\ud83e\uddc0"
+ "\ud83e\uddd0\ud83e\udde6",
// Unicode 10.0 property value: {emojicomponent}
"\u0023\u0023"
+ "\u002a\u002a"
+ "\u0030\u0039"
+ "\ud83c\udde6\ud83c\uddff"
+ "\ud83c\udffb\ud83c\udfff",
// Unicode 10.0 property value: {emojimodifier}
"\ud83c\udffb\ud83c\udfff",
// Unicode 10.0 property value: {emojimodifierbase}
"\u261d\u261d"
+ "\u26f9\u26f9"
+ "\u270a\u270d"
+ "\ud83c\udf85\ud83c\udf85"
+ "\ud83c\udfc2\ud83c\udfc4"
+ "\ud83c\udfc7\ud83c\udfc7"
+ "\ud83c\udfca\ud83c\udfcc"
+ "\ud83d\udc42\ud83d\udc43"
+ "\ud83d\udc46\ud83d\udc50"
+ "\ud83d\udc66\ud83d\udc69"
+ "\ud83d\udc6e\ud83d\udc6e"
+ "\ud83d\udc70\ud83d\udc78"
+ "\ud83d\udc7c\ud83d\udc7c"
+ "\ud83d\udc81\ud83d\udc83"
+ "\ud83d\udc85\ud83d\udc87"
+ "\ud83d\udcaa\ud83d\udcaa"
+ "\ud83d\udd74\ud83d\udd75"
+ "\ud83d\udd7a\ud83d\udd7a"
+ "\ud83d\udd90\ud83d\udd90"
+ "\ud83d\udd95\ud83d\udd96"
+ "\ud83d\ude45\ud83d\ude47"
+ "\ud83d\ude4b\ud83d\ude4f"
+ "\ud83d\udea3\ud83d\udea3"
+ "\ud83d\udeb4\ud83d\udeb6"
+ "\ud83d\udec0\ud83d\udec0"
+ "\ud83d\udecc\ud83d\udecc"
+ "\ud83e\udd18\ud83e\udd1c"
+ "\ud83e\udd1e\ud83e\udd1f"
+ "\ud83e\udd26\ud83e\udd26"
+ "\ud83e\udd30\ud83e\udd39"
+ "\ud83e\udd3d\ud83e\udd3e"
+ "\ud83e\uddd1\ud83e\udddd",
// Unicode 10.0 property value: {emojipresentation}
"\u231a\u231b"
+ "\u23e9\u23ec"
+ "\u23f0\u23f0"
+ "\u23f3\u23f3"
+ "\u25fd\u25fe"
+ "\u2614\u2615"
+ "\u2648\u2653"
+ "\u267f\u267f"
+ "\u2693\u2693"
+ "\u26a1\u26a1"
+ "\u26aa\u26ab"
+ "\u26bd\u26be"
+ "\u26c4\u26c5"
+ "\u26ce\u26ce"
+ "\u26d4\u26d4"
+ "\u26ea\u26ea"
+ "\u26f2\u26f3"
+ "\u26f5\u26f5"
+ "\u26fa\u26fa"
+ "\u26fd\u26fd"
+ "\u2705\u2705"
+ "\u270a\u270b"
+ "\u2728\u2728"
+ "\u274c\u274c"
+ "\u274e\u274e"
+ "\u2753\u2755"
+ "\u2757\u2757"
+ "\u2795\u2797"
+ "\u27b0\u27b0"
+ "\u27bf\u27bf"
+ "\u2b1b\u2b1c"
+ "\u2b50\u2b50"
+ "\u2b55\u2b55"
+ "\ud83c\udc04\ud83c\udc04"
+ "\ud83c\udccf\ud83c\udccf"
+ "\ud83c\udd8e\ud83c\udd8e"
+ "\ud83c\udd91\ud83c\udd9a"
+ "\ud83c\udde6\ud83c\uddff"
+ "\ud83c\ude01\ud83c\ude01"
+ "\ud83c\ude1a\ud83c\ude1a"
+ "\ud83c\ude2f\ud83c\ude2f"
+ "\ud83c\ude32\ud83c\ude36"
+ "\ud83c\ude38\ud83c\ude3a"
+ "\ud83c\ude50\ud83c\ude51"
+ "\ud83c\udf00\ud83c\udf20"
+ "\ud83c\udf2d\ud83c\udf35"
+ "\ud83c\udf37\ud83c\udf7c"
+ "\ud83c\udf7e\ud83c\udf93"
+ "\ud83c\udfa0\ud83c\udfca"
+ "\ud83c\udfcf\ud83c\udfd3"
+ "\ud83c\udfe0\ud83c\udff0"
+ "\ud83c\udff4\ud83c\udff4"
+ "\ud83c\udff8\ud83d\udc3e"
+ "\ud83d\udc40\ud83d\udc40"
+ "\ud83d\udc42\ud83d\udcfc"
+ "\ud83d\udcff\ud83d\udd3d"
+ "\ud83d\udd4b\ud83d\udd4e"
+ "\ud83d\udd50\ud83d\udd67"
+ "\ud83d\udd7a\ud83d\udd7a"
+ "\ud83d\udd95\ud83d\udd96"
+ "\ud83d\udda4\ud83d\udda4"
+ "\ud83d\uddfb\ud83d\ude4f"
+ "\ud83d\ude80\ud83d\udec5"
+ "\ud83d\udecc\ud83d\udecc"
+ "\ud83d\uded0\ud83d\uded2"
+ "\ud83d\udeeb\ud83d\udeec"
+ "\ud83d\udef4\ud83d\udef8"
+ "\ud83e\udd10\ud83e\udd3a"
+ "\ud83e\udd3c\ud83e\udd3e"
+ "\ud83e\udd40\ud83e\udd45"
+ "\ud83e\udd47\ud83e\udd4c"
+ "\ud83e\udd50\ud83e\udd6b"
+ "\ud83e\udd80\ud83e\udd97"
+ "\ud83e\uddc0\ud83e\uddc0"
+ "\ud83e\uddd0\ud83e\udde6",
// Unicode 10.0 property value: {ethiopic}
"\u1200\u1248"
+ "\u124a\u124d"
Expand Down
Loading