X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/f3c0d7a59d99c2a94c6b8822291f0e42be3773c9..HEAD:/icuSources/tools/toolutil/ppucd.cpp diff --git a/icuSources/tools/toolutil/ppucd.cpp b/icuSources/tools/toolutil/ppucd.cpp index cccde81c..b11efa7f 100644 --- a/icuSources/tools/toolutil/ppucd.cpp +++ b/icuSources/tools/toolutil/ppucd.cpp @@ -98,6 +98,7 @@ static const char *lineTypeStrings[]={ "defaults", "block", "cp", + "unassigned", "algnamesrange" }; @@ -203,8 +204,17 @@ PreparsedUCD::getProps(UnicodeSet &newValues, UErrorCode &errorCode) { UChar32 start, end; if(!parseCodePointRange(field, start, end, errorCode)) { return NULL; } UniProps *props; + UBool insideBlock=FALSE; // TRUE if cp or unassigned range inside the block range. switch(lineType) { case DEFAULTS_LINE: + // Should occur before any block/cp/unassigned line. + if(blockLineIndex>=0) { + fprintf(stderr, + "error in preparsed UCD: default line %ld after one or more block lines\n", + (long)lineNumber); + errorCode=U_PARSE_ERROR; + return NULL; + } if(defaultLineIndex>=0) { fprintf(stderr, "error in preparsed UCD: second line with default properties on line %ld\n", @@ -228,9 +238,22 @@ PreparsedUCD::getProps(UnicodeSet &newValues, UErrorCode &errorCode) { blockLineIndex=lineIndex; break; case CP_LINE: + case UNASSIGNED_LINE: if(blockProps.start<=start && end<=blockProps.end) { - // Code point range fully inside the last block inherits the block properties. - cpProps=blockProps; + insideBlock=TRUE; + if(lineType==CP_LINE) { + // Code point range fully inside the last block inherits the block properties. + cpProps=blockProps; + } else { + // Unassigned line inside the block is based on default properties + // which override block properties. + cpProps=defaultProps; + newValues=blockValues; + // Except, it inherits the one blk=Block property. + int32_t blkIndex=UCHAR_BLOCK-UCHAR_INT_START; + cpProps.intProps[blkIndex]=blockProps.intProps[blkIndex]; + newValues.remove((UChar32)UCHAR_BLOCK); + } } else if(start>blockProps.end || end