private void button_OK_Click(object sender, EventArgs e)
 {
     if (element != null)
     {
         for (int i = 0; i < manager.getElementCount(); i++)
         {
             FunctionElement elementExist = (FunctionElement)manager.getElement(i);
             if (elementExist.Equals(element))
             {
                 continue;
             }
             if (elementExist.name.Equals(textBox_name.Text))
             {
                 MessageBox.Show("存在相同的单元名称!", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
         }
         element.name   = textBox_name.Text;
         element.commet = textBox_Commet.Text;
         ArrayList paramsList      = new ArrayList();
         ArrayList paramsValue     = new ArrayList();
         ArrayList paramsValueRest = new ArrayList();
         for (int i = 0; i < (int)numericUpDown_Value.Value; i++)
         {
             paramsList.Add((byte)(((ComboBox)FLP_params.Controls[i]).SelectedIndex));
         }
         for (int i = 0; i < (int)numericUpDown_Value.Value; i++)
         {
             if (FLP_defValue.Controls[i] is NumericUpDown)
             {
                 paramsValue.Add((int)(((NumericUpDown)FLP_defValue.Controls[i]).Value));
             }
             else if (FLP_defValue.Controls[i] is ComboBox)
             {
                 paramsValue.Add((int)(((ComboBox)FLP_defValue.Controls[i]).SelectedIndex));
             }
             else
             {
                 paramsValue.Add(0);
                 MessageBox.Show("格式错误");
             }
         }
         for (int i = 0; i < (int)numericUpDown_Value.Value; i++)
         {
             paramsValueRest.Add((bool)(((CheckBox)FLP_Modify.Controls[i]).Checked));
         }
         if (beUsedTime == 0)
         {
             element.setValue(paramsList);
         }
         else if (beUsedTime > 0)
         {
             if (checkBox_Modify.Checked)
             {
                 element.configValue(paramsList, paramsValue, paramsValueRest);
             }
         }
     }
     this.Close();
 }
        public static FunctionElement createElement(FunctionsManager managerT, String title)
        {
            manager = managerT;
            element = new FunctionElement(manager);
            SmallDialog_FunctionsConfig dialog = new SmallDialog_FunctionsConfig(title);

            dialog.ShowDialog();
            return(element);
        }
        /// <summary>
        /// Verify Metadata.Core.4271
        /// </summary>
        /// <param name="context">Service context</param>
        /// <param name="info">out parameter to return violation information when rule fail</param>
        /// <returns>true if rule passes; false otherwise</returns>
        public override bool?Verify(ServiceContext context, out ExtensionRuleViolationInfo info)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            bool?passed = null;

            info = null;
            var    metadata    = XElement.Parse(context.MetadataDocument);
            string xPath       = "//*[local-name()='Schema']";
            var    schemaElems = metadata.XPathSelectElements(xPath, ODataNamespaceManager.Instance);
            var    namespaces  = schemaElems
                                 .Where(schemaElem => null != schemaElem.Attribute("Namespace"))
                                 .Select(schemaElem => schemaElem.GetAttributeValue("Namespace"));

            foreach (var @namespace in namespaces)
            {
                xPath = string.Format("//*[local-name()='Schema' and @Namespace='{0}']/*[local-name()='Function']", @namespace);
                var functionElems = metadata.XPathSelectElements(xPath, ODataNamespaceManager.Instance)
                                    .Where(f => null == f.Attribute("IsBound") || "false" == f.GetAttributeValue("IsBound"))
                                    .Select(f => f);;
                var functionElements = new List <FunctionElement>();
                if (null != functionElems && functionElems.Any())
                {
                    foreach (var functionElem in functionElems)
                    {
                        var functionElement = FunctionElement.Parse(functionElem);
                        functionElements.Add(functionElement);
                    }
                }

                foreach (var functionElement in functionElements)
                {
                    if (FunctionElement.Unique(functionElement, functionElements, VerifiedParamType.UnorderedSetOfParamNames))
                    {
                        passed = true;
                    }
                    else
                    {
                        passed = false;
                        break;
                    }
                }

                if (false == passed)
                {
                    break;
                }
            }

            info = new ExtensionRuleViolationInfo(this.ErrorMessage, context.Destination, context.ResponsePayload);

            return(passed);
        }
예제 #4
0
        /// <summary>
        /// 将tokens按照函数的形式整理
        /// </summary>
        public void arrange()
        {
            int      depth = -1;
            Function tmp   = null;
            int      i     = 0;

            for (; i < tokens.Count; i++)
            {
                if (tokens[i].deepth < depth)  //根据制表符\t判断该条语句是否已经离开函数定义
                {
                    try {
                        functionlist.Add(tmp.functionname, tmp);
                        depth = tokens[i].deepth;
                        i--;
                        continue;
                    } catch (ArgumentNullException) {
                        Console.WriteLine("arrange函数出现bug,tokens[" + i + "].deepth=" + tokens[i].deepth + ";deepth=" + depth);
                    }
                }
                else
                {
                    if (tokens[i].toks[0].value == "function")
                    {
                        tmp              = new Function();
                        depth            = tokens[i].deepth + 1;
                        tmp.functionname = tokens[i].toks[1].value;
                        FunctionElement tmpele = tokens[i].toks[1] as FunctionElement;
                        if (tmpele == null)
                        {
                            throw new SyntaxErrorException("语法错误,函数名的后面应该有括号");
                        }
                        List <string> paraname = new List <string>();
                        foreach (List <Element> ele in tmpele.paras)
                        {
                            if (ele != null && ele.Count > 0 && ele[0] != null)
                            {
                                paraname.Add(ele[0].value);
                            }
                        }
                        tmp.parametername = paraname;
                        int j = i + 1;
                        for (; (j < tokens.Count) && (tokens[j].deepth >= depth); j++)
                        {
                        }
                        tmp.sentences = CalcSentences(tokens.GetRange(i + 1, j - i - 1));
                        i             = j - 1;
                    }
                }
            }
            //循环结束如果存在函数,则执行CalcSentences
            try {
                functionlist.Add(tmp.functionname, tmp);
            } catch (ArgumentNullException) {
                Console.WriteLine("arrange函数出现bug,tokens[" + i + "].deepth=" + tokens[i].deepth + ";deepth=" + depth);
            }
        }
        //设置地图单元
        public static void configElement(FunctionElement elementT, String title)
        {
            if (elementT == null)
            {
                Console.WriteLine("error in configElement");
                return;
            }
            manager = (FunctionsManager)elementT.parent;
            element = elementT;
            SmallDialog_FunctionsConfig dialog = new SmallDialog_FunctionsConfig(title);

            dialog.textBox_name.Text   = element.name;
            dialog.textBox_Commet.Text = element.commet;
            dialog.showParamsList();
            dialog.ShowDialog();
        }
예제 #6
0
        public override Verb CreateVerb(string[] tokens)
        {
            Color(tokens[1].Length, Whitespaces);
            var functionName = tokens[2];

            Color(functionName.Length, Variables);
            Color(1, Structures);
            if (GetExpression(source, NextPosition, CloseParenthesis()).If(out var block, out var index))
            {
                var arguments = new Arguments(block);
                Element          = new FunctionElement(functionName, arguments);
                overridePosition = index;
                return(new NullOp());
            }

            return(null);
        }
예제 #7
0
파일: Lexer.cs 프로젝트: jakl/hashite
 /// <summary>
 /// Transfering a list of strings to a list of token elements
 /// </summary>
 /// <param name="ListS"> list of strings </param>
 /// <returns> list of token elements </returns>
 static List<Element> StringsToElements(List<string> ListS)
 {
     List<Element> ListE = new List<Element>();
     foreach (string s in ListS)
     {
         Element n = new Element(s);
         switch (n.Type)
         {
             case C.Operation: n = new Operation(n); break;
             case C.Number: n = new Number(n); break;
             case C.Function: n = new FunctionElement(n); break;
             case C.Control: n = new Control(n); break;
         }
         ListE.Add(n);
     }
     return ListE;
 }
예제 #8
0
 //增加单元
 private void addElement()
 {
     if (tabControl_Lists.SelectedIndex == 0)//增加整型单元
     {
         VarElement element = SmallDialog_NewVar_INT.createElement(form_main.varIntManager);
         if (element != null)
         {
             form_main.varIntManager.addElement(element);
         }
     }
     if (tabControl_Lists.SelectedIndex == 1)//增加字符单元
     {
         VarElement element = SmallDialog_NewVar_String.createElement(form_main.varStringManager);
         if (element != null)
         {
             form_main.varStringManager.addElement(element);
         }
     }
     if (tabControl_Lists.SelectedIndex == 2)//增加触发器函数单元
     {
         FunctionElement element = SmallDialog_FunctionsConfig.createElement(form_main.triggerFunctionManager, "新建触发函数单元");
         if (element != null)
         {
             form_main.triggerFunctionManager.addElement(element);
         }
     }
     if (tabControl_Lists.SelectedIndex == 3)//增加环境函数单元
     {
         FunctionElement element = SmallDialog_FunctionsConfig.createElement(form_main.contextFunctionManager, "新建环境函数单元");
         if (element != null)
         {
             form_main.contextFunctionManager.addElement(element);
         }
     }
     if (tabControl_Lists.SelectedIndex == 4)//增加执行函数单元
     {
         FunctionElement element = SmallDialog_FunctionsConfig.createElement(form_main.executionFunctionManager, "新建执行函数单元");
         if (element != null)
         {
             form_main.executionFunctionManager.addElement(element);
         }
     }
 }
예제 #9
0
 //生成函数体
 private void genFunctionToHead(FileStream fs, FunctionsManager functionManager)
 {
     for (int i = 0; i < functionManager.getElementCount(); i++)
     {
         FunctionElement fun       = (FunctionElement)functionManager.getElement(i);
         String          strParams = " (";
         ArrayList       paramList = (ArrayList)fun.getValue();
         for (int j = 0; j < paramList.Count; j++)
         {
             strParams += "p" + j;
             if (j < paramList.Count - 1)
             {
                 strParams += ",";
             }
         }
         strParams += ");";
         IOUtil.writeTextLine(fs, "host " + fun.name + strParams);
     }
 }
예제 #10
0
        protected void SetFromFunctionElement(object target, IHeterogeneousConfigurationElement heterogeneousElem)
        {
            FunctionElement value        = (FunctionElement)heterogeneousElem;
            PropertyInfo    propertyInfo = target.GetType().GetProperty(value.Key);

            if (propertyInfo != null)
            {
                if (value.Type != null)
                {
                    if (!string.IsNullOrEmpty(value.Method))
                    {
                        object result = value.Type.GetMethod(value.Method).Invoke(null, null);
                        propertyInfo.SetValue(target, Convert.ChangeType(result, propertyInfo.PropertyType));
                    }
                    else
                    {
                        object result = value.Type.GetProperty(value.Property).GetValue(null, null);
                        propertyInfo.SetValue(target, Convert.ChangeType(result, propertyInfo.PropertyType));
                    }
                }
            }
        }
예제 #11
0
 /// <summary>
 /// 首先进行词法分析,生成tokens序列。
 /// </summary>
 /// <param name="code">含有代码的字符串</param>
 public void Lexer(string code)
 {
     string[] tmpcode = code.Split('\n');//将代码按照换行符分割成若干行
     for (int i = 0; i < tmpcode.Length; i++)
     {
         if (tmpcode[i] == null || tmpcode[i].Length == 0)
         {
             continue;
         }
         int j = 0;
         for (; tmpcode[i][j] == '\t'; j++)
         {
         }
         List <string> tmptok = AdcancedSplit(tmpcode[i].Trim('\t', '\r'));
         //整理代码,中缀运算符改后缀
         List <Element> restok   = new List <Element>();
         Stack <string> elestack = new Stack <string>();
         int            k;
         if (IsKeyword(tmptok[0]))  //第一个字符串是关键字
         {
             k = 1;
             restok.Add(new Element(tmptok[0], Element.Keyword));
         }
         else
         {
             k = 0;
         }
         for (; k < tmptok.Count; k++)
         {
             Element tmpEle;
             if (tmptok[k].Contains("(") && tmptok[k].Contains(")"))  //是函数
             {
                 tmpEle = new FunctionElement(tmptok[k], Element.Function);
                 restok.Add(tmpEle);
             }
             else if (tmptok[k].Contains("[") && tmptok[k].Contains("]"))    //是数组
             {
                 tmpEle = new Element(tmptok[k], Element.Array);
                 restok.Add(tmpEle);
             }
             else if (tmptok[k][0] >= '0' && tmptok[k][0] <= '9')    //是数字
             {
                 tmpEle = new Element(tmptok[k], Element.Number);
                 restok.Add(tmpEle);
             }
             else if (tmptok[k][0] >= 'a' && tmptok[k][0] <= 'z' || tmptok[k][0] >= 'A' && tmptok[k][0] <= 'Z')    //是一个变量
             {
                 tmpEle = new Element(tmptok[k], Element.Variable);
                 restok.Add(tmpEle);
             }
             else if (tmptok[k][0] == '"')    //是字符串
             {
                 tmpEle = new Element(tmptok[k], Element.String);
                 restok.Add(tmpEle);
             }
             else    //是符号
             {
                 if (elestack.Count == 0 || tmptok[k] == "(")
                 {
                     elestack.Push(tmptok[k]);
                 }
                 else
                 {
                     if (tmptok[k] == ")")
                     {
                         while (elestack.Peek() != "(" && elestack.Count > 0)
                         {
                             restok.Add(new Element(elestack.Pop(), Element.Symbol));
                         }
                         if (elestack.Count == 0)
                         {
                             throw new SyntaxErrorException("syntax error,the number of '(' and ')' don't match!");
                         }
                         elestack.Pop();
                     }
                     else
                     {
                         if (operator_priority[tmptok[k]] >= operator_priority[elestack.Peek()])
                         {
                             elestack.Push(tmptok[k]);
                         }
                         else
                         {
                             if (elestack.Peek() == "(")
                             {
                                 elestack.Push(tmptok[k]);
                             }
                             else
                             {
                                 while (operator_priority[tmptok[k]] < operator_priority[elestack.Peek()] && elestack.Count > 0)
                                 {
                                     if (elestack.Peek() == "(")
                                     {
                                         elestack.Pop();
                                         break;
                                     }
                                     restok.Add(new Element(elestack.Pop(), Element.Symbol));
                                 }
                                 elestack.Push(tmptok[k]);
                             }
                         }
                     }
                 }
             }
         }
         //将栈中的剩余运算符按序插入到表达式后面
         while (elestack.Count > 0)
         {
             if (elestack.Peek() == "(")
             {
                 elestack.Pop();
                 continue;
             }
             restok.Add(new Element(elestack.Pop(), Element.Symbol));
         }
         //将整理后的代码生成一个Sentence对象并存入tokens序列中
         tokens.Add(new Sentence(restok, j));
     }
 }
예제 #12
0
파일: Visitor.cs 프로젝트: zuzhu/pinac
 public abstract void VisitFunctionElement(FunctionElement element);
예제 #13
0
 /*
 public override void VisitIfStatementElement(IfStatementElement element)
 {
     //throw new NotImplementedException();
 }
 */
 public override void VisitFunctionElement(FunctionElement element)
 {
     //throw new NotImplementedException();
 }
예제 #14
0
        /// <summary>
        /// THe argument processing method resolves all the attribute designators, attribute
        /// selectors. If there is an internal Apply it will be evaulated within this method.
        /// </summary>
        /// <remarks>All the processed arguments are converted into an IFunctionParameter instance
        /// because this is the only value that can be used to call a function.</remarks>
        /// <param name="context">The evaluation context instance.</param>
        /// <param name="arguments">The arguments to process.</param>
        /// <returns>A list of arguments ready to be used by a function.</returns>
        private FunctionParameterCollection ProcessArguments(EvaluationContext context, ExpressionCollection arguments)
        {
            context.Trace("Processing arguments");
            context.AddIndent();

            // Create a list to return the processed values.
            var processedArguments = new FunctionParameterCollection();

            // Iterate through the arguments, the IExpressionType is a mark interface
            foreach (IExpression arg in arguments)
            {
                var apply = arg as ApplyElement;
                if (apply != null)
                {
                    context.Trace("Nested apply");

                    // There is a nested apply un this policy a new Apply will be created and also
                    // evaluated. It's return value will be used as the processed argument.
                    var childApply = new Apply(apply);

                    // Evaluate the Apply
                    EvaluationValue retVal = childApply.Evaluate(context);

                    context.TraceContextValues();

                    // If the results were Indeterminate the Indeterminate value will be placed in
                    // the processed arguments, later another method will validate the parameters
                    // and cancel the evaluation propperly.
                    if (!retVal.IsIndeterminate)
                    {
                        if (!context.IsMissingAttribute)
                        {
                            processedArguments.Add(retVal);
                        }
                    }
                    else
                    {
                        processedArguments.Add(retVal);
                    }
                }
                else
                {
                    var write = arg as FunctionElementReadWrite;
                    if (write != null)
                    {
                        // Search for the function and place it in the processed arguments.
                        var functionId = new FunctionElement(write.FunctionId, write.SchemaVersion);

                        context.Trace("Function {0}", functionId.FunctionId);
                        IFunction function = EvaluationEngine.GetFunction(functionId.FunctionId);
                        if (function == null)
                        {
                            context.Trace("ERR: function not found {0}", _applyBase.FunctionId);
                            context.ProcessingError = true;
                            processedArguments.Add(EvaluationValue.Indeterminate);
                        }
                        else
                        {
                            processedArguments.Add(function);
                        }
                    }
                    else if (arg is VariableReferenceElement)
                    {
                        var variableRef = arg as VariableReferenceElement;
                        var variableDef = context.CurrentPolicy.VariableDefinition[variableRef.VariableId] as VariableDefinition;

                        context.TraceContextValues();

                        Debug.Assert(variableDef != null, "variableDef != null");
                        processedArguments.Add(!variableDef.IsEvaluated ? variableDef.Evaluate(context) : variableDef.Value);
                    }
                    else
                    {
                        var readWrite = arg as AttributeValueElementReadWrite;
                        if (readWrite != null)
                        {
                            // The AttributeValue does not need to be processed
                            context.Trace("Attribute value {0}", arg.ToString());
                            processedArguments.Add(new AttributeValueElement(readWrite.DataType, readWrite.Contents, readWrite.SchemaVersion));
                        }
                        else
                        {
                            var des = arg as AttributeDesignatorBase;
                            if (des != null)
                            {
                                // Resolve the AttributeDesignator using the EvaluationEngine public methods.
                                context.Trace("Processing attribute designator: {0}", arg.ToString());

                                var      attrDes = des;
                                BagValue bag     = EvaluationEngine.Resolve(context, attrDes);

                                // If the attribute was not resolved by the EvaluationEngine search the
                                // attribute in the context document, also using the EvaluationEngine public
                                // methods.
                                if (bag.BagSize == 0)
                                {
                                    if (arg is SubjectAttributeDesignatorElement)
                                    {
                                        ctx.AttributeElement attrib = EvaluationEngine.GetAttribute(context, attrDes);
                                        if (attrib != null)
                                        {
                                            context.Trace("Adding subject attribute designator: {0}", attrib.ToString());
                                            bag.Add(attrib);
                                            break;
                                        }
                                    }
                                    else if (arg is ResourceAttributeDesignatorElement)
                                    {
                                        ctx.AttributeElement attrib = EvaluationEngine.GetAttribute(context, attrDes);
                                        if (attrib != null)
                                        {
                                            context.Trace("Adding resource attribute designator {0}", attrib.ToString());
                                            bag.Add(attrib);
                                        }
                                    }
                                    else if (arg is ActionAttributeDesignatorElement)
                                    {
                                        ctx.AttributeElement attrib = EvaluationEngine.GetAttribute(context, attrDes);
                                        if (attrib != null)
                                        {
                                            context.Trace("Adding action attribute designator {0}", attrib.ToString());
                                            bag.Add(attrib);
                                        }
                                    }
                                    else if (arg is EnvironmentAttributeDesignatorElement)
                                    {
                                        ctx.AttributeElement attrib = EvaluationEngine.GetAttribute(context, attrDes);
                                        if (attrib != null)
                                        {
                                            context.Trace("Adding environment attribute designator {0}", attrib.ToString());
                                            bag.Add(attrib);
                                        }
                                    }
                                }

                                // If the argument was not found and the attribute must be present this is
                                // a MissingAttribute situation so set the flag. Otherwise add the attribute
                                // to the processed arguments.
                                if (bag.BagSize == 0 && attrDes.MustBePresent)
                                {
                                    context.Trace("Attribute is missing");
                                    context.IsMissingAttribute = true;
                                    context.AddMissingAttribute(attrDes);
                                }
                                else
                                {
                                    processedArguments.Add(bag);
                                }
                            }
                            else
                            {
                                var @base = arg as AttributeSelectorElement;
                                if (@base != null)
                                {
                                    // Resolve the XPath query using the EvaluationEngine public methods.
                                    context.Trace("Attribute selector");
                                    try
                                    {
                                        BagValue bag = EvaluationEngine.Resolve(context, @base);
                                        if (bag.Elements.Count == 0 && @base.MustBePresent)
                                        {
                                            context.Trace("Attribute is missing");
                                            context.IsMissingAttribute = true;
                                            context.AddMissingAttribute(@base);
                                        }
                                        else
                                        {
                                            processedArguments.Add(bag);
                                        }
                                    }
                                    catch (EvaluationException e)
                                    {
                                        context.Trace("ERR: {0}", e.Message);
                                        processedArguments.Add(EvaluationValue.Indeterminate);
                                        context.ProcessingError = true;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            context.RemoveIndent();

            return(processedArguments);
        }
예제 #15
0
 //删除变量
 private void deleteElement()
 {
     if (tabControl_Lists.SelectedIndex == 0)//删除整型单元
     {
         int currentIndex = listBox_VarInt.SelectedIndex;
         if (currentIndex >= 0)
         {
             VarElement element = (VarElement)form_main.varIntManager.getElement(currentIndex);
             if (element == null)
             {
                 return;
             }
             int usedTime = element.getUsedTime();
             if (usedTime > 0)
             {
                 MessageBox.Show("变量被引用了" + usedTime + "次,不能删除");
                 return;
             }
             form_main.varIntManager.removeElement(currentIndex);
         }
     }
     if (tabControl_Lists.SelectedIndex == 1)//删除字符单元
     {
         int currentIndex = listBox_VarString.SelectedIndex;
         if (currentIndex >= 0)
         {
             VarElement element = (VarElement)form_main.varStringManager.getElement(currentIndex);
             if (element == null)
             {
                 return;
             }
             int usedTime = element.getUsedTime();
             if (usedTime > 0)
             {
                 MessageBox.Show("变量被引用了" + usedTime + "次,不能删除");
                 return;
             }
             form_main.varStringManager.removeElement(currentIndex);
         }
     }
     if (tabControl_Lists.SelectedIndex == 2)//删除触发器函数单元
     {
         int currentIndex = listBox_Trigger.SelectedIndex;
         if (currentIndex >= 0)
         {
             FunctionElement element = (FunctionElement)form_main.triggerFunctionManager.getElement(currentIndex);
             if (element == null)
             {
                 return;
             }
             int usedTime = element.getUsedTime();
             if (usedTime > 0)
             {
                 MessageBox.Show("函数被引用了" + usedTime + "次,不能删除");
                 return;
             }
             form_main.triggerFunctionManager.removeElement(currentIndex);
         }
     }
     if (tabControl_Lists.SelectedIndex == 3)//删除条件判断函数单元
     {
         int currentIndex = listBox_Condition.SelectedIndex;
         if (currentIndex >= 0)
         {
             FunctionElement element = (FunctionElement)form_main.contextFunctionManager.getElement(currentIndex);
             if (element == null)
             {
                 return;
             }
             int usedTime = element.getUsedTime();
             if (usedTime > 0)
             {
                 MessageBox.Show("函数被引用了" + usedTime + "次,不能删除");
                 return;
             }
             form_main.contextFunctionManager.removeElement(currentIndex);
         }
     }
     if (tabControl_Lists.SelectedIndex == 4)//删除执行函数单元
     {
         int currentIndex = listBox_Execution.SelectedIndex;
         if (currentIndex >= 0)
         {
             FunctionElement element = (FunctionElement)form_main.executionFunctionManager.getElement(currentIndex);
             if (element == null)
             {
                 return;
             }
             int usedTime = element.getUsedTime();
             if (usedTime > 0)
             {
                 MessageBox.Show("函数被引用了" + usedTime + "次,不能删除");
                 return;
             }
             form_main.executionFunctionManager.removeElement(currentIndex);
         }
     }
 }
예제 #16
0
 public UserElementMixin(FunctionElement element)
     : this(element.Name, element.Location, element.Documentation, element.Annotations)
 {
 }
예제 #17
0
 public void Remove(FunctionElement element)
 {
     BaseRemove(element.MethodName);
 }
예제 #18
0
 //检查变量
 private void checkElement()
 {
     if (tabControl_Lists.SelectedIndex == 0)//检查整型单元
     {
         int currentIndex = listBox_VarInt.SelectedIndex;
         if (currentIndex >= 0)
         {
             VarElement element = (VarElement)form_main.varIntManager.getElement(currentIndex);
             if (element == null)
             {
                 return;
             }
             //String usedInfor = element.getUsedInfor();
             //SmallDialog_ShowString.showString("整型变量检查", usedInfor);
             SmallDialog_ShowList.showList(element.getUsedMeory());
         }
     }
     if (tabControl_Lists.SelectedIndex == 1)//检查字符单元
     {
         int currentIndex = listBox_VarString.SelectedIndex;
         if (currentIndex >= 0)
         {
             VarElement element = (VarElement)form_main.varStringManager.getElement(currentIndex);
             if (element == null)
             {
                 return;
             }
             //String usedInfor = element.getUsedInfor();
             //SmallDialog_ShowString.showString("字符变量检查", usedInfor);
             SmallDialog_ShowList.showList(element.getUsedMeory());
         }
     }
     if (tabControl_Lists.SelectedIndex == 2)//检查触发函数单元
     {
         int currentIndex = listBox_Trigger.SelectedIndex;
         if (currentIndex >= 0)
         {
             FunctionElement element = (FunctionElement)form_main.triggerFunctionManager.getElement(currentIndex);
             if (element == null)
             {
                 return;
             }
             //String usedInfor = element.getUsedInfor();
             //SmallDialog_ShowString.showString("触发器函数检查", usedInfor);
             SmallDialog_ShowList.showList(element.getUsedMeory());
         }
     }
     if (tabControl_Lists.SelectedIndex == 3)//检查环境函数单元
     {
         int currentIndex = listBox_Condition.SelectedIndex;
         if (currentIndex >= 0)
         {
             FunctionElement element = (FunctionElement)form_main.contextFunctionManager.getElement(currentIndex);
             if (element == null)
             {
                 return;
             }
             //String usedInfor = element.getUsedInfor();
             //SmallDialog_ShowString.showString("环境函数检查", usedInfor);
             SmallDialog_ShowList.showList(element.getUsedMeory());
         }
     }
     if (tabControl_Lists.SelectedIndex == 4)//检查执行函数单元
     {
         int currentIndex = listBox_Execution.SelectedIndex;
         if (currentIndex >= 0)
         {
             FunctionElement element = (FunctionElement)form_main.executionFunctionManager.getElement(currentIndex);
             if (element == null)
             {
                 return;
             }
             //String usedInfor = element.getUsedInfor();
             //SmallDialog_ShowString.showString("执行函数检查", usedInfor);
             SmallDialog_ShowList.showList(element.getUsedMeory());
         }
     }
 }
예제 #19
0
 public override void VisitFunctionElement(FunctionElement element)
 {
     Console.Write(element.getreturntype() + " ");
     VisitElement(element.getfunctionname());
     Console.Write("(");
     List<DeclarationElement> args = element.getArguments();
     for (int i = 0; i < args.Count; i++)
     {
         VisitElement(args[i]);
         if(i<(args.Count-1))
         {
             Console.Write(",");
         }
     }
     Console.Write(")");
     Console.Write("\n{\n\t");
     List<Element> funcbody = new List<Element>();
     funcbody = element.getBody();
     for (int i = 0; i < funcbody.Count; i++)
     {
         VisitElement(funcbody[i]);
         if (i < (funcbody.Count - 1))
         {
             Console.Write("\n\t");
         }
         else
         {
             Console.Write("\n");
         }
     }
     Console.Write("}\n");
 }
예제 #20
0
 public void Add(FunctionElement element)
 {
     BaseAdd(element);
 }