internal char Filter(char ch)
{
UnicodeCategory cat = Char.GetUnicodeCategory(ch);
Charset cs = (Charset)cats[cat];
if (cs==null)
cs = (Charset)cats[m_gencat];
if (cs.m_chars.Contains(ch))
return ch;
return cs.m_generic;
}
// match a Dfa agsint a given string public int Match(string str, int ix, ref int action) { // return number of chars matched int r = 0; Dfa dfa = null; // if there is no arc or the string is exhausted, this is okay at a terminal if (ix >= str.Length || (dfa = ((Dfa)m_map[m_tokens.Filter(str[ix])])) == null || (r = dfa.Match(str, ix + 1, ref action)) < 0) { if (m_actions != null) { action = m_actions.a_act; return(0); } return(-1); } return(r + 1); }