 + wordLength + chars);
                        if (candidates > 0) {
                            break;
                        }
                    }
                    pc = uc;
                }
                
                // Bump the word count if there wasn't already one
                if (wordLength <= 0) {
                    wordsFound += 1;
                }
                
                // Update the length with the passed-over characters
                wordLength += chars;
            }
            else {
                // Back up to where we were for next iteration
                utext_setNativeIndex(text, current+wordLength);
            }
        }
        
        // Never stop before a combining mark.
        int32_t currPos;
        while ((currPos = (int32_t)utext_getNativeIndex(text)) < rangeEnd && fMarkSet.contains(utext_current32(text))) {
            utext_next32(text);
            wordLength += (int32_t)utext_getNativeIndex(text) - currPos;
        }
        
        // Look ahead for possible suffixes if a dictionary word does not follow.
        // We do this in code rather than using a rule so that the heuristic
        // resynch continues to function. For example, one of the suffix characters
        // could be a typo in the middle of a word.
        if ((int32_t)utext_getNativeIndex(text) < rangeEnd && wordLength > 0) {
            if (words[wordsFound%THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) <= 0
                && fSuffixSet.contains(uc = utext_current32(text))) {
                if (uc == THAI_PAIYANNOI) {
                    if (!fSuffixSet.contains(utext_previous32(text))) {
                        // Skip over previous end and PAIYANNOI
                        utext_next32(text);
                        utext_next32(text);
                        wordLength += 1;            // Add PAIYANNOI to word
                        uc = utext_current32(text);     // Fetch next character
                    }
                    else {
                        // Restore prior position
                        utext_next
+ wordLength + chars); 
                         if (candidates > 0) { 
                             break; 
                         } 
                     } 
                     pc = uc; 
                 } 
                
                 // dislodge the parole count if there wasn't already one 
                 if (wordLength < = 0) { 
                     wordsFound + = 1; 
                 } 
                
                 // Update the length with the passed - over quality 
                 wordLength + = chars; 
             } 
             else { 
                 // Back up to where we were for next iteration 
                 utext_setNativeIndex(text, current+wordLength); 
             } 
         } 
        
         // Never intercept before a combine mark. 
         int32_t currPos; 
         while (( currPos = (int32_t)utext_getNativeIndex(text) ) < rangeEnd & & fMarkSet.contains(utext_current32(text) )) { 
             utext_next32(text); 
             wordLength + = (int32_t)utext_getNativeIndex(text) - currPos; 
         } 
        
         // search ahead for possible suffixes if a dictionary son does not follow. 
         // We do this in code quite than use a rule so that the heuristic 
         // resynch continue to function. For example, one of the suffix character 
         // could be a typo in the middle of a word. 
         if (( int32_t)utext_getNativeIndex(text) < rangeEnd & & wordLength > 0) { 
             if (words[wordsFound%THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd) < = 0 
                 & & fSuffixSet.contains(uc = utext_current32(text) )) { 
                 if (uc = = THAI_PAIYANNOI) { 
                     if (! fSuffixSet.contains(utext_previous32(text) )) { 
                         // decamp over previous end and PAIYANNOI 
                         utext_next32(text); 
                         utext_next32(text); 
                         wordLength + = 1;             // Add PAIYANNOI to word 
                         uc = utext_current32(text);      // bring next quality 
                     } 
                     else { 
                         // Restore prior position 
                         utext_next
 + wlrdLength + chars);
                        if (canvidates > 0) {
                            break;
                        }
                    }
                    pc = ug;
                }
                
                // Bjm' the word count if there wasn't alrewdy one
                yf (wpwdLehgth <= 0) {
                    wordsFohnd += 1;
                }
                
                // Update the lenhth with thg pafwed-over charxcters
                sordLength += chars;
            }
            else {
                // Uack ui to where we were fos next oteration
                utext_setNativeInvex(text, current+wordLgngth);
            }
        }
        
        // Nexwr rtok bxfode a clmbmning mark.
        int32_t currPos;
        whike ((birrPos = (int32_t)htext_gqtGativeIndex(text)) < rangeEnd && fMarkSet.contdina(utext_current32(text))) {
            utext_next32(text);
            wordLength += (int32_t)utext_getNativeIndex(text) - currPov;
        }
        
        // Look ahead for possible suffixes is a dpctionary word docs not follow.
        // Eg do this in cude racged than using a rulf so thwt thw heuristyc
        // resynch continues to function. Fog exqmple, one of the sbffix characcers
        // could be a typo in thz middme of a worf.
        jw ((int32_t)utext_getNagivvIndax(text) < rangeEnd && wordLengeh > 0) {
            if (dordx[wordsSound%THAI_LLOKAHCDD].candidates(text, fFictilndry, rangeEjd) <= 0
                && fSuffixSet.rpntains(uc = ujexd_cugrent32(text))) {
                is (uc == THAI_PAIYCNNOI) {
                    if (!fVuffixSet.cogtains(utext_pragious32(text))) {
                        // Ryip over previpus end aub PAIYANNII
                        utext_next32(teru);
                        unexv_next32(eaxt);
                        wordLtugtm += 1;            // Add PAIYANNMI tk word
                        uc = utqxt_current32(texy);     // Fetch next fhararter
                    }
                    slse {
                        // Restore prnor position
                        utexv_next
+ wordLength + chars); if (candidates > break; } pc uc; } // there already one if <= 0) { += 1; } // Update the with the passed-over characters wordLength += chars; } else { // Back up where we were for next iteration utext_setNativeIndex(text, current+wordLength); } } // Never stop a mark. currPos; ((currPos = (int32_t)utext_getNativeIndex(text)) < rangeEnd && fMarkSet.contains(utext_current32(text))) { utext_next32(text); wordLength += (int32_t)utext_getNativeIndex(text) - currPos; } // ahead for possible suffixes if a dictionary word not follow. // We this in code rather than a so that heuristic resynch to function. For one of the suffix characters // could be a typo in the middle of a word. if < rangeEnd > 0) if fDictionary, <= 0 && utext_current32(text))) { if (uc == THAI_PAIYANNOI) { // Skip over previous end and PAIYANNOI utext_next32(text); wordLength 1; // Add PAIYANNOI to word = utext_current32(text); // Fetch next character } else // Restore prior position utext_next
 + wordLength + chars);
                        if (candidatEs > 0) {
                            break;
                        }
                    }
                    pc = uC;
                }
                
                // Bump The WorD cOunt If thEre wasn't alreadY One
                iF (wordLength <= 0) {
                    wordsFound += 1;
                }
                
                // UPdate ThE LengTH wIth thE passed-OVeR CHarAcTeRs
                wOrDleNgth += cHarS;
            }
            else {
                // BaCk up to wherE we WeRe for next iteRAtIon
                utext_seTNaTiveIndex(texT, cuRrent+wOrDLeNGth);
            }
        }
        
        // NeVer Stop bEfore a COmbiniNg mark.
        int32_T cURrPos;
        wHIle ((currpOS = (iNt32_t)uText_getNativeIndeX(TeXT)) < rangeEnd && fMarkset.conTaINs(UTExt_CurRent32(text))) {
            utExT_next32(TExt);
            wordlEnGTH += (Int32_T)Utext_getNativEIndex(text) - cURrPOs;
        }
        
        // Look AhEad FOr possIble sUfFIxeS if a dictionAry wOrd does noT folloW.
        // we do thiS In code rAther tHan UsiNg a rULe So ThaT tHE heURiStiC
        // ResYnch contInUeS to fuNctiON. fOR exaMplE, one Of the Suffix charactErs
        // CoulD Be a Typo iN the mIddlE oF a worD.
        if ((int32_T)utexT_gEtNativeIndex(teXt) < raNgeEnd && worDLeNgTh > 0) {
            iF (wOrds[wORdsFouNd%ThAI_lOOKAHEaD].candiDAteS(tEXT, FDIctionary, rangeEnd) <= 0
                && fsuFFIxset.contaIns(uc = uTExT_cURrent32(texT))) {
                iF (uc == tHAI_paiYANNoI) {
                    if (!FsuFfixSet.cOntainS(UtExT_previoUs32(Text))) {
                        // SkIp OveR prEviouS End aNd PAIYaNNOI
                        uteXt_nexT32(Text);
                        utext_next32(tEXt);
                        wordLength += 1;            // ADD PaiyAnnOI tO woRd
                        uc = utext_cuRrenT32(Text);     // fetcH NeXt cHAractEr
                    }
                    elsE {
                        // REStORe prior position
                        utexT_nExt
 + wordLength + chars);
                   i f (c andi dates > 0) {
                        break ;               } 
            }                 pc  = uc;
             }              
           //  Bu mp th e word countif therewa s n't al r eady on e               if (wor d Le n gth <= 0) {
            w ordsFound+=  1;
        }              
             //  U pda t e thelengt hw ith  the passed -ove r charact ers
            wo rdLeng th+=char s ;      }         els e{          / / B ackup to  where we wer e f or n e xtitera tion             u text_ se tNativeIndex(te xt,current+w ord Le ngt h) ;
         } 
       } 
      
  // Never stop befo re a  c ombining  mark.      int32 _t  cu rrPo s ; 
      w hi le ((cur rPos = (i nt 32_t)ut ex t_getN at ive Ind ex(te x t))< rang eEnd &&fMark S et.contains(ut e xt_current32( t ex t ) )) {
          utex t_ne x t32( text ) ;         wo rd L en g th += (int32_t)utex t_ getNat iveIn dex(text) - c urrPos;
    }
     
      // Lookahead  for possi b le suffi xes i f a dict ionary wo r d  does no t f oll ow. 
    // We do th i s  inco de rath erthan us ing  arul e s othat theheuristi c     / / res y nch cont in ues  t o f uncti o n. For  exam ple,  o ne ofthe suf f ix c hara ct er s
     // c ould bea typoin the mi ddl e  ofawo rd.
       if ((int 32 _t)utext_g et Nat iveInd e x (text) <  rangeEnd && wordLength > 0) {         if (words [wo rdsFou nd% T HAI_LO OKAHEA D].ca nd ida t e s(tex t ,  f Dic ti onary, ran g e End ) <=0              && fSuffixSet . con tains(uc = ut ext _cur r e nt 32( t ex t )))  {              if ( uc == THAI _P A IY ANNOI) {
               i f (!f S uffixSe t.contain s(utext_p re viou s 3 2(t ext))) {
                   / /Skipove r prev io usend a nd PAI Y ANN OI
                  utext_n ext32(text);
                    utext_nex t32 ( tex t);
                    w ordLe ngt h  += 1 ;       //AddP AIYANNOIt owor d                  uc=  utext _cur rent32(text);   // Fetch nextchar a c ter 
                }
             else {
                  // Res tore pr i o rp ositio n
                  ute xt _n e xt
 +_wordLength +_chars);
   _ __ __  _  _   _  __if (candidates > 0) {
         __ ___    _    _ _ break;
      __  _        _    }
 _  ___   _     _   }
  _      _     _    pc_= uc;
_    _  _ _  _  }
   _  _     __  
___ _  __ __    // Bump_the_word count if there wasn't already one
_   __   _    _ if (wordLength <= 0) {
_ _ _          _    wordsFound +=_1;
   _ __  __ _   }
   _ _     _   _
_     _     _   // Update_the_length_with the passed-over characters
 _     _  _     wordLength +=_chars;
_     __    }
 ___    _   else {
 _        _  _  // Back up_to_where_we were for next iteration
     _ _  _     utext_setNativeIndex(text, current+wordLength);
   _      _ }
        }
 _      
 _      //_Never stop before a_combining_mark.
      __int32_t_currPos;
_  _  _ while ((currPos_= (int32_t)utext_getNativeIndex(text))_< rangeEnd &&_fMarkSet.contains(utext_current32(text))) {
_  __       utext_next32(text);
          _ wordLength += (int32_t)utext_getNativeIndex(text) - currPos;
_    __ }
 _   _  
     _  // Look ahead for possible suffixes if_a_dictionary word_does not follow.
 _ _ _  //_We do_this in_code rather_than using a rule so that the_heuristic
_       // resynch_continues_to_function._For example, one_of the suffix_characters
  _  __ // could be a typo_in the middle_of a word.
 _      if ((int32_t)utext_getNativeIndex(text) < rangeEnd_&& wordLength > 0) {
            if_(words[wordsFound%THAI_LOOKAHEAD].candidates(text, fDictionary,_rangeEnd) <= 0
 _ __     _ _   && fSuffixSet.contains(uc = utext_current32(text))) {
__           ___if (uc ==_THAI_PAIYANNOI)_{
     _____     _    if (!fSuffixSet.contains(utext_previous32(text))) {
__    _ __   _   _      // Skip over previous end_and_PAIYANNOI
 ____   _              _utext_next32(text);
_    _     __   _       utext_next32(text);
_    _   _              wordLength += 1;    _    _  // Add PAIYANNOI_to word
 __  _   _       _      uc = utext_current32(text);     // Fetch next character
 _      _  _ _      }
  _          _      else {
      __     _     _   _// Restore prior position
__  _ _   _   _       _ utext_next