|
21 | 21 | import java.util.regex.Matcher; |
22 | 22 | import java.util.regex.Pattern; |
23 | 23 | import org.unicode.cldr.draft.FileUtilities; |
24 | | -import org.unicode.cldr.util.Rational; |
25 | 24 | import org.unicode.cldr.util.RegexUtilities; |
26 | 25 | import org.unicode.idna.Regexes; |
27 | 26 | import org.unicode.props.IndexUnicodeProperties.DefaultValueType; |
@@ -50,9 +49,9 @@ enum SpecialProperty { |
50 | 49 | public final SpecialProperty special; |
51 | 50 |
|
52 | 51 | /** |
53 | | - * Maps from Unicode versions to field number. A property whose field number depends on the version has more |
54 | | - * than one entry. A particular field number applies to the Unicode versions after the previous-version |
55 | | - * entry, up to and including its own version. |
| 52 | + * Maps from Unicode versions to field number. A property whose field number depends on the |
| 53 | + * version has more than one entry. A particular field number applies to the Unicode versions |
| 54 | + * after the previous-version entry, up to and including its own version. |
56 | 55 | */ |
57 | 56 | TreeMap<VersionInfo, Integer> fieldNumbers; |
58 | 57 |
|
@@ -130,7 +129,9 @@ private static void fromStrings(String... propertyInfo) { |
130 | 129 | String last = propertyInfo[propertyInfo.length - 1]; |
131 | 130 |
|
132 | 131 | int temp = 1; |
133 | | - if (propertyInfo.length > 2 && !propertyInfo[2].isEmpty() && !VERSION.matcher(propertyInfo[2]).matches()) { |
| 132 | + if (propertyInfo.length > 2 |
| 133 | + && !propertyInfo[2].isEmpty() |
| 134 | + && !VERSION.matcher(propertyInfo[2]).matches()) { |
134 | 135 | temp = Integer.parseInt(propertyInfo[2]); |
135 | 136 | } |
136 | 137 | int _fieldNumber = temp; |
@@ -209,7 +210,8 @@ public int compareTo(PropertyParsingInfo arg0) { |
209 | 210 | if (0 != (result = property.toString().compareTo(arg0.property.toString()))) { |
210 | 211 | return result; |
211 | 212 | } |
212 | | - return fieldNumbers.get(Settings.LATEST_VERSION_INFO) - arg0.fieldNumbers.get(Settings.LATEST_VERSION_INFO); |
| 213 | + return fieldNumbers.get(Settings.LATEST_VERSION_INFO) |
| 214 | + - arg0.fieldNumbers.get(Settings.LATEST_VERSION_INFO); |
213 | 215 | } |
214 | 216 |
|
215 | 217 | public static String getFullFileName(UcdProperty prop, VersionInfo ucdVersion) { |
@@ -1293,7 +1295,9 @@ private static void parseFields( |
1293 | 1295 | throw new UnicodePropertyException(); |
1294 | 1296 | } |
1295 | 1297 | String value = |
1296 | | - propInfo.getFieldNumber(indexUnicodeProperties.ucdVersion) >= parts.length ? null : parts[propInfo.getFieldNumber(indexUnicodeProperties.ucdVersion)]; |
| 1298 | + propInfo.getFieldNumber(indexUnicodeProperties.ucdVersion) >= parts.length |
| 1299 | + ? null |
| 1300 | + : parts[propInfo.getFieldNumber(indexUnicodeProperties.ucdVersion)]; |
1297 | 1301 | if (propInfo.property == UcdProperty.Joining_Group |
1298 | 1302 | && indexUnicodeProperties.ucdVersion.compareTo(VersionInfo.UNICODE_4_0_1) |
1299 | 1303 | <= 0 |
@@ -1333,7 +1337,9 @@ private static void parseFields( |
1333 | 1337 | } else { |
1334 | 1338 | for (final PropertyParsingInfo propInfo : propInfoSet) { |
1335 | 1339 | final String value = |
1336 | | - propInfo.getFieldNumber(indexUnicodeProperties.ucdVersion) < parts.length ? parts[propInfo.getFieldNumber(indexUnicodeProperties.ucdVersion)] : null; |
| 1340 | + propInfo.getFieldNumber(indexUnicodeProperties.ucdVersion) < parts.length |
| 1341 | + ? parts[propInfo.getFieldNumber(indexUnicodeProperties.ucdVersion)] |
| 1342 | + : null; |
1337 | 1343 | setPropDefault( |
1338 | 1344 | propInfo.property, |
1339 | 1345 | value, |
@@ -1467,6 +1473,24 @@ private static void parseSimpleFieldFile( |
1467 | 1473 | false, |
1468 | 1474 | nextVersion); |
1469 | 1475 | } else { |
| 1476 | + if (propInfo.property == UcdProperty.Numeric_Value |
| 1477 | + && line.getParts().length == 3 |
| 1478 | + && line.getParts()[1].isEmpty() |
| 1479 | + && line.getParts()[2].equals("NaN")) { |
| 1480 | + // 5.1..6.1 have an improper line |
| 1481 | + // # @missing: 0000..10FFFF; ; NaN |
| 1482 | + // compare 6.2 and 6.3 |
| 1483 | + // # @missing: 0000..10FFFF; NaN; ; NaN |
| 1484 | + // This causes the default for field 1 (which we use as the key for |
| 1485 | + // Numeric_Value, with some |
| 1486 | + // subsequent chicanery to actually get the data from UnicodeData) to be the |
| 1487 | + // empty string, rather |
| 1488 | + // than NaN. |
| 1489 | + // Before 5.1, there is no @missing line. After 6.3, the @missing line is in |
| 1490 | + // PropertyValueAliases, |
| 1491 | + // where it is independent of the format of the file specifying the property. |
| 1492 | + line.getParts()[1] = "NaN"; |
| 1493 | + } |
1470 | 1494 | setPropDefault( |
1471 | 1495 | propInfo.property, |
1472 | 1496 | line.getParts()[1], |
|
0 commit comments