Exemplo n.º 1
0
 private bool HandleParenthese(string[] ss, HashSet <int> used, IList <StartEnd> startEnd, Dictionary <StartEnd, IClausable> map, IExpParser <T> parser, IExpClause clause)
 {
     for (int i = 0; i < ss.Length; i++)
     {
         if (Right.Equals(ss[i]) && !used.Contains(i))
         {
             for (int j = i - 1; j >= 0; j--)
             {
                 if (Right.Equals(ss[j]) && !used.Contains(j))
                 {
                     break;
                 }
                 if (Left.Equals(ss[j]) && !used.Contains(j))
                 {
                     used.Add(i);
                     used.Add(j);
                     StartEnd   se  = new StartEnd(j, i);
                     IClausable con = ParseNoParenthese(se.GetStrings(ss, Sharpen.Collections.ToArray(startEnd, new StartEnd[] {  })), map, parser, clause);
                     map[se] = con;
                     startEnd.Add(se);
                     foreach (StartEnd sub in se.GetChildren(Sharpen.Collections.ToArray(startEnd, new StartEnd[] {  })))
                     {
                         startEnd.Remove(sub);
                         map.Remove(sub);
                     }
                     return(true);
                 }
             }
         }
     }
     return(false);
 }