예제 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ErrorList1.Items.Clear();
            //string File = "Simple";

            AntlrInputStream input = new AntlrInputStream(GetneviseText());

            input.name = "Simple";
            var lexer = new sampleLexer(input);
            CommonTokenStream tokens = new CommonTokenStream(lexer);
            var parser = new sampleParser(tokens);



            var exp = parser.prog();

            for (int i = 0; i < parser.khata_parser.Count(); i++)
            {
                if (parser.khata_parser[i] != null)
                {
                    ErrorList1.Items.Add(new ListViewItem()
                    {
                        Content = parser.khata_parser[i], Foreground = Brushes.DarkRed
                    });
                }
            }
            if (parser.khata_parser.Count() == 0)
            {
                DebugAndRun(parser.cod + "}");
            }
            parser.khata_pakon();
        }
예제 #2
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            ErrorList1.Items.Clear();
            AntlrInputStream input = new AntlrInputStream(GetneviseText());

            var lexer = new sampleLexer(input);
            CommonTokenStream tokens = new CommonTokenStream(lexer);
            var parser = new sampleParser(tokens);
            //CshapTextBox.Document.Blocks.Add(new Paragraph(new Run( parser.cod)));
            var exp = parser.prog();

            CshapTextBox.Document.Text = "";
            CshapTextBox.Document.Text = parser.cod + Environment.NewLine + "}";

            for (int i = 0; i < parser.khata_parser.Count(); i++)
            {
                //Console.BackgroundColor =ConsoleColor.Red;
                ErrorList1.Items.Add(parser.khata_parser[i]);
            }
            parser.khata_pakon();
        }