@@ -490,6 +490,7 @@ enum FileType {
490490 NameAliases ,
491491 StandardizedVariants ,
492492 Confusables ,
493+ NamesList ,
493494 }
494495
495496 static Map <String , FileType > file2Type = new HashMap <String , FileType >();
@@ -616,6 +617,13 @@ static void parseSourceFile(
616617 parseUnicodeDataFile (
617618 parser , indexUnicodeProperties , nextProperties , propInfoSet );
618619 break ;
620+ case NamesList :
621+ parseNamesListFile (
622+ FileUtilities .in ("" , fullFilename ),
623+ indexUnicodeProperties ,
624+ nextProperties ,
625+ propInfoSet );
626+ break ;
619627 case Field :
620628 if (propInfoSet .size () == 1
621629 && (propInfo = propInfoSet .iterator ().next ()).special
@@ -754,6 +762,122 @@ static void parseSourceFile(
754762 }
755763 }
756764
765+ private static void parseNamesListFile (
766+ Iterable <String > lines ,
767+ IndexUnicodeProperties indexUnicodeProperties ,
768+ IndexUnicodeProperties nextProperties ,
769+ Set <PropertyParsingInfo > propInfoSet ) {
770+ final var namesListChar = Pattern .compile ("[0-9A-F]{4,6}" );
771+ final var subheaderPropInfo = property2PropertyInfo .get (UcdProperty .Names_List_Subheader );
772+ final var nextSubheader =
773+ nextProperties == null
774+ ? null
775+ : nextProperties .getProperty (UcdProperty .Names_List_Subheader );
776+ final UnicodeMap <String > subheaderData =
777+ indexUnicodeProperties .property2UnicodeMap .get (UcdProperty .Names_List_Subheader );
778+ final var subheaderNoticePropInfo =
779+ property2PropertyInfo .get (UcdProperty .Names_List_Subheader_Notice );
780+ final var nextSubheaderNotice =
781+ nextProperties == null
782+ ? null
783+ : nextProperties .getProperty (UcdProperty .Names_List_Subheader_Notice );
784+ final UnicodeMap <String > subheaderNoticeData =
785+ indexUnicodeProperties .property2UnicodeMap .get (
786+ UcdProperty .Names_List_Subheader_Notice );
787+ final var crossReferencePropInfo =
788+ property2PropertyInfo .get (UcdProperty .Names_List_Cross_Ref );
789+ final var nextCrossReference =
790+ nextProperties == null
791+ ? null
792+ : nextProperties .getProperty (UcdProperty .Names_List_Cross_Ref );
793+ final UnicodeMap <String > crossReferenceData =
794+ indexUnicodeProperties .property2UnicodeMap .get (UcdProperty .Names_List_Cross_Ref );
795+ final var commentPropInfo = property2PropertyInfo .get (UcdProperty .Names_List_Comment );
796+ final var nextComment =
797+ nextProperties == null
798+ ? null
799+ : nextProperties .getProperty (UcdProperty .Names_List_Comment );
800+ final UnicodeMap <String > commentData =
801+ indexUnicodeProperties .property2UnicodeMap .get (UcdProperty .Names_List_Comment );
802+ final var aliasPropInfo = property2PropertyInfo .get (UcdProperty .Names_List_Alias );
803+ final var nextAlias =
804+ nextProperties == null
805+ ? null
806+ : nextProperties .getProperty (UcdProperty .Names_List_Alias );
807+ final UnicodeMap <String > aliasData =
808+ indexUnicodeProperties .property2UnicodeMap .get (UcdProperty .Names_List_Alias );
809+
810+ aliasPropInfo .multivaluedSplit = NO_SPLIT ;
811+ commentPropInfo .multivaluedSplit = NO_SPLIT ;
812+
813+ String subheader = null ;
814+ String subheaderNotice = null ;
815+ IntRange codePoint = null ;
816+ for (String line : lines ) {
817+ String [] parts = line .split ("\t +" );
818+ if (parts .length == 2 && namesListChar .matcher (parts [0 ]).matches ()) {
819+ codePoint = new IntRange ();
820+ codePoint .set (parts [0 ]);
821+ if (subheader != null ) {
822+ subheaderPropInfo .put (subheaderData , codePoint , subheader , nextSubheader );
823+ }
824+ if (subheaderNotice != null ) {
825+ subheaderNoticePropInfo .put (
826+ subheaderNoticeData , codePoint , subheaderNotice , nextSubheaderNotice );
827+ }
828+ } else if (codePoint != null
829+ && parts .length == 2
830+ && (parts [0 ].isEmpty ()
831+ || (parts [0 ].equals ("@+" ) && parts [1 ].startsWith ("* " )))) {
832+ if (parts [1 ].startsWith ("x " )) {
833+ String crossReference ;
834+ if (parts [1 ].charAt (2 ) == '(' ) {
835+ crossReference = parts [1 ].split (" \\ - |\\ )" )[1 ];
836+ } else {
837+ crossReference = parts [1 ].split (" " )[1 ];
838+ }
839+ crossReferencePropInfo .put (
840+ crossReferenceData ,
841+ codePoint ,
842+ crossReference ,
843+ IndexUnicodeProperties .MULTIVALUED_JOINER ,
844+ nextCrossReference );
845+ } else if (parts [1 ].startsWith ("* " )) {
846+ commentPropInfo .put (
847+ commentData ,
848+ codePoint ,
849+ parts [1 ].substring (2 ),
850+ IndexUnicodeProperties .MULTIVALUED_JOINER ,
851+ nextComment );
852+ } else if (parts [1 ].startsWith ("= " )) {
853+ aliasPropInfo .put (
854+ aliasData ,
855+ codePoint ,
856+ parts [1 ].substring (2 ),
857+ IndexUnicodeProperties .MULTIVALUED_JOINER ,
858+ nextAlias );
859+ }
860+ }
861+ if (parts .length == 2 && parts [0 ].equals ("@" )) {
862+ subheader = parts [1 ];
863+ subheaderNotice = null ;
864+ codePoint = null ;
865+ }
866+ if (parts .length == 4 && parts [0 ].equals ("@@" )) {
867+ // New block header, clear the current subheader.
868+ subheader = null ;
869+ subheaderNotice = null ;
870+ codePoint = null ;
871+ }
872+ if (parts .length == 2
873+ && parts [0 ].equals ("@+" )
874+ && codePoint == null
875+ && subheader != null ) {
876+ subheaderNotice = parts [1 ];
877+ }
878+ }
879+ }
880+
757881 private static void parseCJKRadicalsFile (
758882 UcdLineParser parser ,
759883 PropertyParsingInfo propInfo ,
0 commit comments