private static void ParseOperatorAttributes(Specification S, string elementName, XmlAttributeCollection A) { int nbArgs = (elementName == XML_UNARY_OPERATOR) ? 1 : 2; String symbol = ""; String function = ""; bool prefix = true; bool prefixAttributeSpecified = false; for (int i = 0; i < A.Count; i++) { switch (A[i].Name) { case XML_PREFIX: prefix = (A[i].Value.ToLower() == XML_TRUE); prefixAttributeSpecified = true; break; case XML_FUNCTION: function = A[i].Value; break; case XML_SYMBOL: symbol = A[i].Value; break; default: throw new G25.UserException("XML parsing error: Unknown attribute '" + A[i].Name + "' in specification."); } } if ((nbArgs != 1) && prefixAttributeSpecified) throw new G25.UserException("Prefix specified for operator '" + symbol + "' bound to '" + function + "' (todo: improve this error message)."); S.AddOperator(new Operator(nbArgs, prefix, symbol, function)); }