/// <summary> /// Initialization code for the registry. /// </summary> public static void Init() { List <Type> prefixes = Extensibility. GetAllTypesWithAttribute <PrefixOperatorAttribute>(); foreach (Type t in prefixes) { object obj = t.GetCustomAttributes(typeof(PrefixOperatorAttribute), false).FirstOrDefault(); PrefixOperatorAttribute att = obj as PrefixOperatorAttribute; if (att == null) { Logger.Log(LogLevel.Error, Logger.REGISTRY, "Attribute is null!"); System.Diagnostics.Debugger.Break(); } Register(att.TokenInstance, att.NodeType); } }
/// <summary> /// Initializes and loads binary operators via reflection /// </summary> public static void Init() { List <Type> infixes = Extensibility. GetAllTypesWithAttribute(typeof(BinaryOperatorAttribute)); foreach (Type t in infixes) { object obj = t.GetCustomAttributes(typeof(BinaryOperatorAttribute), false).FirstOrDefault(); BinaryOperatorAttribute att = obj as BinaryOperatorAttribute; if (att == null) { Logger.Log(LogLevel.Error, Logger.REGISTRY, "Attribute is null!"); System.Diagnostics.Debugger.Break(); } Register(att.TokenInstance, att.NodeType, att.PrecedenceLevel, att.IsRightAssociative); } }