@@ -9,11 +9,10 @@ public enum UsfmVersificationMismatchType
99 {
1010 MissingChapter ,
1111 MissingVerse ,
12- MissingVerseSegment ,
13- ExtraVerseSegment ,
1412 ExtraVerse ,
15- UnknownVersification ,
16- InvalidVerseRange
13+ InvalidVerseRange ,
14+ MissingVerseSegment ,
15+ ExtraVerseSegment
1716 }
1817
1918 public class UsfmVersificationMismatch
@@ -47,7 +46,8 @@ public UsfmVersificationMismatch(
4746 // Returns true if there is a mismatch
4847 public bool CheckMismatch ( )
4948 {
50- if ( _expectedChapter > _actualChapter )
49+ //A non-empty chapter is expected
50+ if ( _expectedChapter > _actualChapter && _expectedVerse != 0 )
5151 {
5252 Type = UsfmVersificationMismatchType . MissingChapter ;
5353 return true ;
@@ -57,9 +57,6 @@ public bool CheckMismatch()
5757 Type = UsfmVersificationMismatchType . MissingVerse ;
5858 return true ;
5959 }
60- // VerseRef's internal validation covers the other cases as well,
61- // but in order to provide a user-friendly taxonomy, the others
62- // have been checked separately
6360 if ( _verseRef != null )
6461 {
6562 if ( string . IsNullOrEmpty ( _verseRef . Value . Segment ( ) ) && _verseRef . Value . HasSegmentsDefined )
@@ -85,8 +82,6 @@ private static UsfmVersificationMismatchType Map(VerseRef.ValidStatusType validS
8582 {
8683 switch ( validStatus )
8784 {
88- case VerseRef . ValidStatusType . UnknownVersification :
89- return UsfmVersificationMismatchType . UnknownVersification ;
9085 case VerseRef . ValidStatusType . OutOfRange :
9186 return UsfmVersificationMismatchType . ExtraVerse ;
9287 case VerseRef . ValidStatusType . VerseRepeated :
@@ -177,7 +172,7 @@ public override void StartBook(UsfmParserState state, string marker, string code
177172 var versificationMismatch = new UsfmVersificationMismatch (
178173 _currentBook ,
179174 _versification . GetLastChapter ( _currentBook ) ,
180- _versification . GetLastVerse ( _currentBook , _currentChapter ) ,
175+ _versification . GetLastVerse ( _currentBook , _versification . GetLastChapter ( _currentBook ) ) ,
181176 _currentChapter ,
182177 _currentVerse . AllVerses ( ) . Last ( ) . VerseNum
183178 ) ;
0 commit comments