Exemplo n.º 1
0
        public Node Proc()
        {
            var result = new ProcDeclaration()
            {
                AnchorToken = Expect(TokenCategory.PROC)
            };

            result.Add(new Identifier()
            {
                AnchorToken = Expect(TokenCategory.IDENTIFIER)
            });
            Expect(TokenCategory.PARENTHESIS_OPEN);
            var param = new ProcParam();

            while (CurrentToken == TokenCategory.IDENTIFIER)
            {
                param.Add(ParamDeclaration());
            }
            Expect(TokenCategory.PARENTHESIS_CLOSE);
            result.Add(param);
            var type = new ProcType();

            if (CurrentToken == TokenCategory.TWOPOINTS)
            {
                Expect(TokenCategory.TWOPOINTS);
                type.Add(ChimeraType());
            }
            result.Add(type);
            var con = new ProcConst();

            Expect(TokenCategory.SEMICOL);
            if (CurrentToken == TokenCategory.CONST)
            {
                con.Add(Const());
            }
            result.Add(con);
            var va = new ProcVar();

            if (CurrentToken == TokenCategory.VAR)
            {
                va.Add(Var());
            }
            result.Add(va);
            var procStatement = new ProcStatement()
            {
                AnchorToken = Expect(TokenCategory.BEGIN)
            };

            while (firstOfStatement.Contains(CurrentToken))
            {
                procStatement.Add(Statement());
            }
            Expect(TokenCategory.END);
            Expect(TokenCategory.SEMICOL);
            result.Add(procStatement);
            return(result);
        }
Exemplo n.º 2
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            ProcTypeModel pmodel = new ProcTypeModel();

            if (0 != proctype.Get_Item("Name", ProcNameText.Text, ConditionType.Equal).Id)
            {
                MessageBox.Show("Такая процедура уже существует");
                ProcNameText.Clear();
            }
            else
            {
                ProcTypeModel model = new ProcTypeModel();
                model.Name   = ProcNameText.Text;
                model.Job_Id = job.Get_Item("Name", JobBox.SelectedItem.ToString(), ConditionType.Equal).Id;
                proctype.Add(model);
                MessageBox.Show("Запись внесена");
                ProcNameText.Clear();
            }
        }