Пример #1
0
        void AddBinaryOpTokens()
        {
            BinaryOpParser bp = new BinaryOpParser();

            foreach (var item in codeTxtBox.Lines)
            {
                lstIdTokens = bp.GenerateTokens(item);
            }
        }
Пример #2
0
 void CodeTokenizer(string[] codeLines)
 {
     try
     {
         NumericParser       np = new NumericParser();
         IdentifierParser    ip = new IdentifierParser();
         BinaryOpParser      bp = new BinaryOpParser();
         UninaryOpParser     up = new UninaryOpParser();
         ReserveWordParser   rp = new ReserveWordParser();
         TerminatorOpParser  tp = new TerminatorOpParser();
         PunctuationOpParser pp = new PunctuationOpParser();
         ConsoleOpParser     cp = new ConsoleOpParser();
         foreach (var item in codeLines)
         {
             lstBinOpTokens      = bp.GenerateTokens(item);
             lstConsoleOpTokens  = cp.GenerateTokens(item);
             lstIdTokens         = ip.GenerateTokens(item);
             lstNumTokens        = np.GenerateTokens(item);
             lstPuncTokens       = pp.GenerateTokens(item);
             lstResTokens        = rp.GenerateTokens(item);
             lstTerminatorTokens = tp.GenerateTokens(item);
             lstUniOpTokens      = up.GenerateTokens(item);
         }
     }
     catch (Exception ex)
     {
         lsterrorText.Add(">" + ex.Message);
     }
     try
     {
         foreach (var item in lstUniOpTokens)
         {
             unLstView.Items.Add(item);
         }
     }
     catch (Exception ex)
     {
         lsterrorText.Add(">" + ex.Message);
     }
     try
     {
         foreach (var item in lstTerminatorTokens)
         {
             TerminatorLstView.Items.Add(item);
         }
     }
     catch (Exception ex)
     {
         lsterrorText.Add(">" + ex.Message);
     }
     try
     {
         foreach (var item in lstResTokens)
         {
             resLstView.Items.Add(item);
         }
     }
     catch (Exception ex)
     {
         lsterrorText.Add(">" + ex.Message);
     }
     try
     {
         foreach (var item in lstPuncTokens)
         {
             PuncLstView.Items.Add(item);
         }
     }
     catch (Exception ex)
     {
         lsterrorText.Add(">" + ex.Message);
     }
     try
     {
         foreach (var item in lstNumTokens)
         {
             numLstView.Items.Add(item);
         }
     }
     catch (Exception ex)
     {
         lsterrorText.Add(">" + ex.Message);
     }
     try
     {
         foreach (var item in lstIdTokens)
         {
             idLstView.Items.Add(item);
         }
     }
     catch (Exception ex)
     {
         lsterrorText.Add(">" + ex.Message);
     }
     try
     {
         foreach (var item in lstConsoleOpTokens)
         {
             conLstView.Items.Add(item);
         }
     }
     catch (Exception ex)
     {
         lsterrorText.Add(">" + ex.Message);
     }
     try
     {
         foreach (var item in lstBinOpTokens)
         {
             binlstView.Items.Add(item);
         }
     }
     catch (Exception ex)
     {
         lsterrorText.Add(">" + ex.Message);
     }
     richTextBox1.Lines = lsterrorText.ToArray();
 }