using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace byyljxfzxt
{
    public partial class Form4 : Form
    {
        // ... (其他代码与之前相同) ...

        private void button8_Click(object sender, EventArgs e)
        {
            // 如果分析已经结束,禁用“下一步”按钮
            if (step == result_parse.Count)
            {
                button8.Enabled = false;
                return;
            }

            // 在界面上展示分析过程的下一步
            ListViewItem item = new ListViewItem(step.ToString());
            item.SubItems.Add(result_analys[step]);
            item.SubItems.Add(result_input[step]);
            item.SubItems.Add(result_parse[step]);
            listView4.Items.Add(item);

            step++;
        }

        private void button9_Click(object sender, EventArgs e)
        {
            // 在界面上展示整个分析过程
            for (int i = step; i < result_parse.Count; i++)
            {
                ListViewItem item = new ListViewItem(i.ToString());
                item.SubItems.Add(result_analys[i]);
                item.SubItems.Add(result_input[i]);
                item.SubItems.Add(result_parse[i]);
                listView4.Items.Add(item);
            }

            // 禁用“下一步”和“查看整个过程”按钮
            button8.Enabled = false;
            button9.Enabled = false;
        }

        // ... (其他代码与之前相同) ...
    }
}
C#实现LL(1)语法分析器:逐步展示分析过程

原文地址: https://www.cveoy.top/t/topic/fXPd 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录