internal void ProcessToken(ITextToken tok, VerseTextToken verseTok)
{
if (tok == null)
throw new ArgumentNullException("tok");
Debug.Assert(!(tok is VerseTextToken));
if (tok.IsParagraphStart)
{
TextTokenSubstring tts = new TextTokenSubstring(tok, 0, 0);
ParaStartToken pstok = new ParaStartToken(tts, tok.ParaStyleName);
m_quotationRelatedTokens.Add(pstok);
}
AddTextToParaStartTokens(tok);
// Find the first non whitespace, non quotation mark character in the token's
// text. This will be used in the following loop to determine what quotation
// marks precede all other characters in the token (i.e. what quotation marks
// begin the paragraph and are possible continuers).
Match match = m_regExNonQuotes.Match(tok.Text);
int iFirstNoneQMarkChar = (match.Success ? match.Index : -1);
// Now find all the quotation marks in the token's text.
MatchCollection mc = m_regExQuotes.Matches(tok.Text);
// Go through all the quotation marks found, creating quotation tokens
// for each.
foreach (Match m in mc)
{
TextTokenSubstring tts = new TextTokenSubstring(tok, m.Index, m.Length);
bool fIsParaStart = verseTok != null ? verseTok.IsParagraphStart : tok.IsParagraphStart;
bool fIsOpener = m_qmCategorizer.IsInitialPunctuation(tts.Text);
bool fPossibleContinuer = (m.Index < iFirstNoneQMarkChar && fIsParaStart);
QuotationMarkToken qmt = new QuotationMarkToken(tts, m_qmCategorizer,
fIsOpener, fPossibleContinuer);
m_quotationRelatedTokens.Add(qmt);
}
}