Example #1
0
 /// <summary>
 /// checks condition of the concatenation of two strings </summary>
 // note: this is pretty stupid, we really should subtract strip from the condition up front and just check the stem
 // but this is a little bit more complicated.
 private bool CheckCondition(int condition, char[] c1, int c1off, int c1len, char[] c2, int c2off, int c2len)
 {
     if (condition != 0)
     {
         CharacterRunAutomaton pattern = dictionary.patterns[condition];
         int state = pattern.InitialState;
         for (int i = c1off; i < c1off + c1len; i++)
         {
             state = pattern.Step(state, c1[i]);
             if (state == -1)
             {
                 return(false);
             }
         }
         for (int i = c2off; i < c2off + c2len; i++)
         {
             state = pattern.Step(state, c2[i]);
             if (state == -1)
             {
                 return(false);
             }
         }
         return(pattern.IsAccept(state));
     }
     return(true);
 }
Example #2
0
 protected internal virtual bool IsTokenChar(int c)
 {
     if (state < 0)
     {
         state = RunAutomaton.InitialState;
     }
     state = RunAutomaton.Step(state, c);
     if (state < 0)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }