Example #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the next paratext segment for import.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void GetNextParatextSegment(out string sText, out string sMarker)
        {
            sMarker = null;
            sText   = string.Empty;
            while (m_ptCurrentToken < m_ptBookTokens.Count)
            {
                UsfmToken token = m_ptBookTokens[m_ptCurrentToken];
                if (token.Type == UsfmTokenType.Text)
                {
                    sText += token.Text;
                }
                else
                {
                    if (sMarker != null)
                    {
                        break;                         // Found another marker so we got all the text for this one
                    }
                    sMarker = @"\" + token.Marker;     // We expect the marker to have the slash
                }
                m_ptParserState.UpdateState(m_ptBookTokens, m_ptCurrentToken);

                if (!ScrImportFileInfo.IsValidMarker(sMarker))
                {
                    throw new ScriptureUtilsException(SUE_ErrorCode.InvalidCharacterInMarker, null, 0,
                                                      sMarker + sText, SegmentFirstRef);
                }
                m_ptCurrentToken++;
            }
        }
Example #2
0
 public void UpdateState(List <IUsfmToken> ptBookTokens, int ptCurrentToken)
 {
     if (wrappedTokenList != ptBookTokens)
     {
         wrappedTokenList = ptBookTokens;
         rawPtTokenList   = new List <UsfmToken>(ptBookTokens.Select(t => (UsfmToken)t.CoreToken));
     }
     ptParserState.UpdateState(rawPtTokenList, ptCurrentToken);
 }