Exemplo n.º 1
0
 public void FormatCode(object sender, RoutedEventArgs e)
 {
     try
     {
         Temp.Clear();
         string SourceCode = CodeEditor.Text;
         Parser parser     = new Parser();
         var    root       = parser.Parse(SourceCode);
         if (parser.GetNumofErrors() > 0)
         {
             StatusContent.Text = "代码格式化之前请改正所有错误";
             return;
         }
         GenerateCode(root, null, 0);
         Temp.Append("\n.");
         CodeEditor.Text = Temp.ToString();
     }
     catch (Exception) { }
 }