internal CapabilitiesSection(int type, DelayedRegex regex, CapabilitiesPattern expr, ArrayList rulelist) { _type = type; _regex = regex; _expr = expr; _rules = (CapabilitiesRule[])rulelist.ToArray(typeof(CapabilitiesRule)); }
internal CapabilitiesSection(int type, DelayedRegex regex, CapabilitiesPattern expr, ArrayList rulelist) { base._type = type; this._regex = regex; this._expr = expr; this._rules = (CapabilitiesRule[]) rulelist.ToArray(typeof(CapabilitiesRule)); }
// // Create a rule from an element // static CapabilitiesRule RuleFromElement(ParseState parseState, XmlNode element) { int ruletype; DelayedRegex regex; CapabilitiesPattern pat; // grab tag name if (element.Name == "filter") { ruletype = CapabilitiesRule.Filter; } else if (element.Name == "case") { ruletype = CapabilitiesRule.Case; } else if (element.Name == "use") { HandlerBase.CheckForNonCommentChildNodes(element); string var = HandlerBase.RemoveRequiredAttribute(element, "var"); string strAs = HandlerBase.RemoveAttribute(element, "as"); HandlerBase.CheckForUnrecognizedAttributes(element); if (strAs == null) { strAs = String.Empty; } parseState.Evaluator.AddDependency(var); return(new CapabilitiesUse(var, strAs)); } else { throw new ConfigurationErrorsException( SR.GetString(SR.Unknown_tag_in_caps_config, element.Name), element); } // grab attributes String matchpat = HandlerBase.RemoveAttribute(element, "match"); String testpat = HandlerBase.RemoveAttribute(element, "with"); HandlerBase.CheckForUnrecognizedAttributes(element); if (matchpat == null) { if (testpat != null) { throw new ConfigurationErrorsException(SR.GetString(SR.Cannot_specify_test_without_match), element); } regex = null; pat = null; } else { try { regex = new DelayedRegex(matchpat); } catch (Exception e) { throw new ConfigurationErrorsException(e.Message, e, element); } if (testpat == null) { pat = CapabilitiesPattern.Default; } else { pat = new CapabilitiesPattern(testpat); } } // grab contents ArrayList subrules = RuleListFromElement(parseState, element, false); return(new CapabilitiesSection(ruletype, regex, pat, subrules)); }
internal virtual void AddMatch(DelayedRegex regex, Match match) { this._regexlist.Add(regex); this._matchlist.Add(match); }
private static CapabilitiesRule RuleFromElement(ParseState parseState, XmlNode element) { int num; DelayedRegex regex; CapabilitiesPattern pattern; if (element.Name == "filter") { num = 2; } else if (element.Name == "case") { num = 3; } else { if (element.Name != "use") { throw new ConfigurationErrorsException(System.Web.SR.GetString("Unknown_tag_in_caps_config", new object[] { element.Name }), element); } System.Web.Configuration.HandlerBase.CheckForNonCommentChildNodes(element); string variable = System.Web.Configuration.HandlerBase.RemoveRequiredAttribute(element, "var"); string asParam = System.Web.Configuration.HandlerBase.RemoveAttribute(element, "as"); System.Web.Configuration.HandlerBase.CheckForUnrecognizedAttributes(element); if (asParam == null) { asParam = string.Empty; } parseState.Evaluator.AddDependency(variable); return(new CapabilitiesUse(variable, asParam)); } string s = System.Web.Configuration.HandlerBase.RemoveAttribute(element, "match"); string text = System.Web.Configuration.HandlerBase.RemoveAttribute(element, "with"); System.Web.Configuration.HandlerBase.CheckForUnrecognizedAttributes(element); if (s == null) { if (text != null) { throw new ConfigurationErrorsException(System.Web.SR.GetString("Cannot_specify_test_without_match"), element); } regex = null; pattern = null; } else { try { regex = new DelayedRegex(s); } catch (Exception exception) { throw new ConfigurationErrorsException(exception.Message, exception, element); } if (text == null) { pattern = CapabilitiesPattern.Default; } else { pattern = new CapabilitiesPattern(text); } } return(new CapabilitiesSection(num, regex, pattern, RuleListFromElement(parseState, element, false))); }
// // Create a rule from an element // static CapabilitiesRule RuleFromElement(ParseState parseState, XmlNode element) { int ruletype; DelayedRegex regex; CapabilitiesPattern pat; // grab tag name if (element.Name == "filter") { ruletype = CapabilitiesRule.Filter; } else if (element.Name=="case") { ruletype = CapabilitiesRule.Case; } else if (element.Name == "use") { HandlerBase.CheckForNonCommentChildNodes(element); string var = HandlerBase.RemoveRequiredAttribute(element, "var"); string strAs = HandlerBase.RemoveAttribute(element, "as"); HandlerBase.CheckForUnrecognizedAttributes(element); if (strAs == null) strAs = String.Empty; parseState.Evaluator.AddDependency(var); return new CapabilitiesUse(var, strAs); } else { throw new ConfigurationErrorsException( SR.GetString(SR.Unknown_tag_in_caps_config, element.Name), element); } // grab attributes String matchpat = HandlerBase.RemoveAttribute(element, "match"); String testpat = HandlerBase.RemoveAttribute(element, "with"); HandlerBase.CheckForUnrecognizedAttributes(element); if (matchpat == null) { if (testpat != null) throw new ConfigurationErrorsException(SR.GetString(SR.Cannot_specify_test_without_match), element); regex = null; pat = null; } else { try { regex = new DelayedRegex(matchpat); } catch (Exception e) { throw new ConfigurationErrorsException(e.Message, e, element); } if (testpat == null) pat = CapabilitiesPattern.Default; else pat = new CapabilitiesPattern(testpat); } // grab contents ArrayList subrules = RuleListFromElement(parseState, element, false); return new CapabilitiesSection(ruletype, regex, pat, subrules); }
internal virtual void AddMatch(DelayedRegex regex, Match match) { _regexlist.Add(regex); _matchlist.Add(match); }