예제 #1
0
 public static void NameWords(string text)
 {
     FindWords(text);
     foreach (string s in FindWords(text))
     {
         System.Console.WriteLine(s);
         //words.Add(s);
         if (ASCIIGetter.cutForDouble(s) == true)
         {
             OnlyBool.IntOrDouble(s);
         }
         else if ((s.Contains(".") || s.Contains(",")) && ASCIIGetter.cutForDouble(text) == false && (text.Length) > 0)
         {
             //Console.WriteLine("Syntax ERROR");
             ASCIIGetter.CutDobuleAnddot(s);
         }
         else if (OnlyBool.IsIdent(text) == true && (text.Length) > 0)
         {
             Console.WriteLine("IDENT");
         }
         else if (ASCIIGetter.cutForDouble(text) == false)
         {
             ASCIIGetter.CutDobuleAnddot(text);
         }
         else
         {
             Console.WriteLine("Syntax ERROR");
         }
     }
 }
예제 #2
0
 public static void CutDobuleAnddot(string text)
 {
     if (text.Count(c => c == '.') >= 2 && OnlyBool.IsCorrectDouble(text) == true)
     {
         int    lastDotIndex = text.LastIndexOf(".", System.StringComparison.Ordinal);
         string firstPart    = text.Remove(lastDotIndex);
         string secondPart   = text.Substring(lastDotIndex + 1, text.Length - firstPart.Length - 1);
         Console.WriteLine(firstPart + "DOUBLE");
         Console.WriteLine('.' + secondPart + " ERROR");
     }
     else if (text.Count(c => c == ',') >= 2)
     {
         int    lastDotIndex = text.LastIndexOf(",", System.StringComparison.Ordinal);
         string firstPart    = text.Remove(lastDotIndex);
         string secondPart   = text.Substring(lastDotIndex + 1, text.Length - firstPart.Length - 1);
         Console.WriteLine(firstPart + "DOUBLE");
         Console.WriteLine(',' + secondPart + " ERROR");
     }
 }