@@ -563,13 +563,11 @@ private static void propertywiseCorrespondenceLine(
563563 final List <String > errorMessageLines = new ArrayList <>();
564564 final List <UnicodeSet > sets = new ArrayList <>();
565565 sets .add (firstSet );
566- expectToken (":" , pp , source );
567566
568- // Index of the first set of multi-character strings (and of the first multi-character
569- // reference string) .
567+ // Index of the first set of value-only sets (prefixed by ⧴ rather than :).
568+ // Only value-only sets may contain multi-character strings .
570569 // This is `m` in the documentation in UnicodeInvariantTest.txt.
571- int firstMultiCharacterIndex = -1 ;
572- do {
570+ while (Lookahead .oneToken (pp , source ).accept (":" )) {
573571 final var set = parseUnicodeSet (source , pp );
574572 if (set .size () != firstSet .size ()) {
575573 throw new BackwardParseException (
@@ -580,24 +578,29 @@ private static void propertywiseCorrespondenceLine(
580578 + ")" ,
581579 pp .getIndex ());
582580 }
583- if (set .hasStrings () && set . strings (). size () != set . size () ) {
581+ if (set .hasStrings ()) {
584582 throw new BackwardParseException (
585- "Sets should be all strings or all code points for property correspondence " ,
583+ "Strings are only allowed in value-only sets (prefixed by ⧴ rather than :) " ,
586584 pp .getIndex ());
587585 }
588- if (firstMultiCharacterIndex == -1 ) {
589- if (set .hasStrings ()) {
590- firstMultiCharacterIndex = sets .size ();
591- }
592- } else if (!set .hasStrings ()) {
586+ sets .add (set );
587+ }
588+ // Index of the first set of value-only sets (prefixed by ⧴ rather than :).
589+ // Only value-only sets may contain multi-character strings.
590+ // This is `m` in the documentation in UnicodeInvariantTest.txt.
591+ final int firstValueOnlyIndex = sets .size ();
592+ while (Lookahead .oneToken (pp , source ).accept ("⧴" )) {
593+ final var set = parseUnicodeSet (source , pp );
594+ if (set .size () != firstSet .size ()) {
593595 throw new BackwardParseException (
594- "Code points should come before strings in property correspondence" ,
596+ "Sets should have the same size for property correspondence (got "
597+ + set .size ()
598+ + ", expected "
599+ + firstSet .size ()
600+ + ")" ,
595601 pp .getIndex ());
596602 }
597603 sets .add (set );
598- } while (Lookahead .oneToken (pp , source ).accept (":" ));
599- if (firstMultiCharacterIndex == -1 ) {
600- firstMultiCharacterIndex = sets .size ();
601604 }
602605 final List <String > referenceCodePoints = new ArrayList <>();
603606 expectToken ("CorrespondTo" , pp , source );
@@ -608,14 +611,14 @@ private static void propertywiseCorrespondenceLine(
608611 "reference should be a single code point or string for property correspondence" ,
609612 pp .getIndex ());
610613 }
611- if (referenceSet .hasStrings ()
612- != (referenceCodePoints .size () >= firstMultiCharacterIndex )) {
614+ if (referenceSet .hasStrings () && referenceCodePoints .size () < firstValueOnlyIndex ) {
613615 throw new BackwardParseException (
614- "Strings should correspond to strings for property correspondence " ,
616+ "Strings are only allowed in value-only sets (prefixed by ⧴ rather than :) " ,
615617 pp .getIndex ());
616618 }
617619 referenceCodePoints .add (referenceSet .iterator ().next ());
618- } while (Lookahead .oneToken (pp , source ).accept (":" ));
620+ } while (Lookahead .oneToken (pp , source )
621+ .accept (referenceCodePoints .size () >= firstValueOnlyIndex ? "⧴" : ":" ));
619622 if (referenceCodePoints .size () != sets .size ()) {
620623 throw new BackwardParseException (
621624 "Property correspondence requires as many reference code points as sets under test" ,
@@ -638,8 +641,14 @@ public ExpectedPropertyDifference(String actualValueAlias, String referenceValue
638641 String property = Lookahead .oneToken (pp , source ).consume ();
639642 expectToken ("(" , pp , source );
640643 String actualValueAlias = Lookahead .oneToken (pp , source ).consume ();
644+ while (Lookahead .oneToken (pp , source ).accept ("|" )) {
645+ actualValueAlias += "|" + Lookahead .oneToken (pp , source ).consume ();
646+ }
641647 expectToken ("vs" , pp , source );
642648 String referenceValueAlias = Lookahead .oneToken (pp , source ).consume ();
649+ while (Lookahead .oneToken (pp , source ).accept ("|" )) {
650+ referenceValueAlias += "|" + Lookahead .oneToken (pp , source ).consume ();
651+ }
643652 expectToken (")" , pp , source );
644653 expectedPropertyDifferences .put (
645654 property ,
@@ -657,7 +666,7 @@ public ExpectedPropertyDifference(String actualValueAlias, String referenceValue
657666 expectedDifference = expectedPropertyDifferences .get (alias );
658667 }
659668 if (expectedDifference != null ) {
660- for (int k = 0 ; k < firstMultiCharacterIndex ; ++k ) {
669+ for (int k = 0 ; k < firstValueOnlyIndex ; ++k ) {
661670 final int rk = referenceCodePoints .get (k ).codePointAt (0 );
662671 final String pRk = property .getValue (rk );
663672 if (!Objects .equals (pRk , expectedDifference .referenceValueAlias )) {
@@ -687,7 +696,7 @@ public ExpectedPropertyDifference(String actualValueAlias, String referenceValue
687696 }
688697 }
689698 } else {
690- for (int k = 0 ; k < firstMultiCharacterIndex ; ++k ) {
699+ for (int k = 0 ; k < firstValueOnlyIndex ; ++k ) {
691700 final UnicodeSet set = sets .get (k );
692701 final int rk = referenceCodePoints .get (k ).codePointAt (0 );
693702 final String pRk = property .getValue (rk );
0 commit comments