/// <summary> /// Registers a token type for a binary operator /// </summary> /// <param name="token">Token type in between operator sides</param> /// <param name="nodeType">Type of node to register to</param> /// <param name="precedence">Precedence level of operator</param> /// <param name="rightAssociative">Whether the operator is right-associative</param> public static void Register(TokenType token, Type nodeType, Precedence precedence, bool rightAssociative = false) { Type _nodeOperatorBinary = typeof(NodeOperatorBinary); if (!_nodeOperatorBinary.IsAssignableFrom(nodeType)) { throw new InvalidCastException( "Cannot register binary infix operator without binary node."); } RegItem val = new RegItem(nodeType, precedence, rightAssociative); if (registry.ContainsKey(token)) { Logger.Log(LogLevel.Warning, Logger.REGISTRY, "Key for " + token.ToString() + " already exists. Replacing with type " + val.NodeType.ToString() + "."); registry[token] = val; } else { registry.Add(token, val); } }
public void RemoveRegex( RegItem Item ) { RegexPairs.Remove( Item ); NotifyChanged( "RegexPairs" ); }
private static void CreateIniParaFile() { #region create config file //DIO DIOItem a1 = new DIOItem(); a1.DI = new DINum[1]; a1.DI[0] = new DINum(); a1.DI[0].No = 10001; a1.DI[0].Name = "1#吸嘴真空已开"; a1.DO = new DONum[1]; a1.DO[0] = new DONum(); a1.DO[0].No = 10002; a1.DO[0].Name = "1#吸嘴开真空"; XmlSerialization.SerializeObjectToFile(a1, lstDIOFile[0]); //Para ParaItem a2 = new ParaItem(); a2.ParaSet = new Para[2]; a2.ParaSet[0] = new Para(); a2.ParaSet[0].Name = "PickOffset"; a2.ParaSet[0].Desc = "1#吸嘴取料偏差"; a2.ParaSet[0].Option = false; a2.ParaSet[0].Select = ""; a2.ParaSet[0].Value = "0.5"; a2.ParaSet[0].MinValue = "-0.5"; a2.ParaSet[0].MaxValue = "0.5"; a2.ParaSet[1].Name = "VisionName"; a2.ParaSet[1].Desc = "顶部相机图像场景"; a2.ParaSet[1].Option = true; a2.ParaSet[1].Select = "Prd1,Prd2,Prd3"; a2.ParaSet[1].Value = "Prd1"; a2.ParaSet[1].MinValue = ""; a2.ParaSet[1].MaxValue = ""; XmlSerialization.SerializeObjectToFile(a2, lstParaFile[0]); //ErrMsg ErrMsgItem a3 = new ErrMsgItem(); a3.ErrCode = new ErrMsg[1]; a3.ErrCode[0] = new ErrMsg(); a3.ErrCode[0].Code = 2000; a3.ErrCode[0].Msg = "1#吸嘴真空检测超时"; XmlSerialization.SerializeObjectToFile(a3, lstErrMsgFile[0]); //Point PointItem a4 = new PointItem(); a4.Location = new Point[1]; a4.Location[0] = new Point(); a4.Location[0].Name = "SafePoint"; a4.Location[0].X = 1; a4.Location[0].Y = 2; a4.Location[0].Z = 2; a4.Location[0].Yaw = 2; a4.Location[0].Pitch = 2; a4.Location[0].Roll = 2; a4.Location[0].Config = 2; XmlSerialization.SerializeObjectToFile(a4, lstPointFile[0]); //Profile ProfileItem a5 = new ProfileItem(); a5.MoveProfile = new Profile[1]; a5.MoveProfile[0] = new Profile(); a5.MoveProfile[0].Name = "QuickProfile"; a5.MoveProfile[0].Acc = 1; a5.MoveProfile[0].AccR = 2; a5.MoveProfile[0].Dec = 2; a5.MoveProfile[0].DecR = 2; a5.MoveProfile[0].Speed = 2; a5.MoveProfile[0].Speed2 = 2; a5.MoveProfile[0].InRange = 2; a5.MoveProfile[0].Straight = false; XmlSerialization.SerializeObjectToFile(a5, lstProfileFile[0]); //PLC RegItem a6 = new RegItem(); a6.PLCReg = new RegNum[1]; a6.PLCReg[0] = new RegNum(); a6.PLCReg[0].No = "M1"; a6.PLCReg[0].Name = "PLC 可以取料"; XmlSerialization.SerializeObjectToFile(a6, lstPlcRegFile[0]); #endregion }