Skip to content

Commit 6bec34c

Browse files
committed
Bad missing lines
1 parent b5999e9 commit 6bec34c

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed

unicodetools/src/main/java/org/unicode/props/PropertyParsingInfo.java

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.regex.Matcher;
2222
import java.util.regex.Pattern;
2323
import org.unicode.cldr.draft.FileUtilities;
24-
import org.unicode.cldr.util.Rational;
2524
import org.unicode.cldr.util.RegexUtilities;
2625
import org.unicode.idna.Regexes;
2726
import org.unicode.props.IndexUnicodeProperties.DefaultValueType;
@@ -50,9 +49,9 @@ enum SpecialProperty {
5049
public final SpecialProperty special;
5150

5251
/**
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.
5655
*/
5756
TreeMap<VersionInfo, Integer> fieldNumbers;
5857

@@ -130,7 +129,9 @@ private static void fromStrings(String... propertyInfo) {
130129
String last = propertyInfo[propertyInfo.length - 1];
131130

132131
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()) {
134135
temp = Integer.parseInt(propertyInfo[2]);
135136
}
136137
int _fieldNumber = temp;
@@ -209,7 +210,8 @@ public int compareTo(PropertyParsingInfo arg0) {
209210
if (0 != (result = property.toString().compareTo(arg0.property.toString()))) {
210211
return result;
211212
}
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);
213215
}
214216

215217
public static String getFullFileName(UcdProperty prop, VersionInfo ucdVersion) {
@@ -1293,7 +1295,9 @@ private static void parseFields(
12931295
throw new UnicodePropertyException();
12941296
}
12951297
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)];
12971301
if (propInfo.property == UcdProperty.Joining_Group
12981302
&& indexUnicodeProperties.ucdVersion.compareTo(VersionInfo.UNICODE_4_0_1)
12991303
<= 0
@@ -1333,7 +1337,9 @@ private static void parseFields(
13331337
} else {
13341338
for (final PropertyParsingInfo propInfo : propInfoSet) {
13351339
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;
13371343
setPropDefault(
13381344
propInfo.property,
13391345
value,
@@ -1467,6 +1473,24 @@ private static void parseSimpleFieldFile(
14671473
false,
14681474
nextVersion);
14691475
} 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+
}
14701494
setPropDefault(
14711495
propInfo.property,
14721496
line.getParts()[1],

0 commit comments

Comments
 (0)