public SimpleRule(NvdlRule rule, bool matchAttributes, NvdlCompileContext ctx) { FillLocation(rule); this.matchAttributes = matchAttributes; NvdlNamespace nss = rule as NvdlNamespace; if (nss == null) { this.isAny = true; } else { this.ns = nss.NS; if (nss.Wildcard == null) { wildcard = "*"; } else if (nss.Wildcard.Length > 1) { throw new NvdlCompileException("'wildCard' attribute can specify at most one character string.", rule); } else { wildcard = nss.Wildcard; } } SimplifyPhase1(rule, ctx); }
private void SimplifyPhase1(NvdlRule r, NvdlCompileContext ctx) { ctx.AddRuleContext(this, r); // 6.4.9 ArrayList al = new ArrayList(); foreach (NvdlAction a in r.Actions) { NvdlNoCancelAction nca = a as NvdlNoCancelAction; if (nca != null) { if (nca.ModeUsage != null) { SimplifyModeUsage(nca, ctx); } NvdlResultAction ra = nca as NvdlResultAction; if (ra != null) { al.Add(new SimpleResultAction(ra, ctx)); } else if (nca is NvdlValidate) { al.Add(new SimpleValidate( (NvdlValidate)nca, ctx)); } else if (nca is NvdlAllow) { al.Add(new SimpleValidate( (NvdlAllow)nca, ctx)); } else { al.Add(new SimpleValidate( (NvdlReject)nca, ctx)); } } else if (nca == null) { ctx.CancelledRules.Add(this, this); } } actions = (SimpleAction [])al.ToArray( typeof(SimpleAction)); }
private void ReadAction(NvdlRule el) { switch (reader.LocalName) { case "cancelNestedActions": el.Actions.Add(ReadCancelAction()); break; case "validate": el.Actions.Add(ReadValidate()); break; case "allow": el.Actions.Add(ReadAllow()); break; case "reject": el.Actions.Add(ReadReject()); break; case "attach": el.Actions.Add(ReadAttach()); break; case "attachPlaceHolder": el.Actions.Add(ReadAttachPlaceholder()); break; case "unwrap": el.Actions.Add(ReadUnwrap()); break; default: throw new NotSupportedException(); } }
public void Remove(NvdlRule item) { List.Add(item); }
public void Add(NvdlRule item) { List.Add(item); }
internal void AddRuleContext(SimpleRule r, NvdlRule rctx) { ruleContexts.Add(r, rctx); }
internal void AddRuleContext (SimpleRule r, NvdlRule rctx) { ruleContexts.Add (r, rctx); }
public void Remove (NvdlRule item) { List.Add (item); }
public void Add (NvdlRule item) { List.Add (item); }
private void ReadAction (NvdlRule el) { switch (reader.LocalName) { case "cancelNestedActions": el.Actions.Add (ReadCancelAction ()); break; case "validate": el.Actions.Add (ReadValidate ()); break; case "allow": el.Actions.Add (ReadAllow ()); break; case "reject": el.Actions.Add (ReadReject ()); break; case "attach": el.Actions.Add (ReadAttach ()); break; case "attachPlaceHolder": el.Actions.Add (ReadAttachPlaceholder ()); break; case "unwrap": el.Actions.Add (ReadUnwrap ()); break; default: throw new NotSupportedException (); } }
private void SimplifyPhase1 (NvdlRule r, NvdlCompileContext ctx) { ctx.AddRuleContext (this, r); // 6.4.9 ArrayList al = new ArrayList (); foreach (NvdlAction a in r.Actions) { NvdlNoCancelAction nca = a as NvdlNoCancelAction; if (nca != null) { if (nca.ModeUsage != null) SimplifyModeUsage (nca, ctx); NvdlResultAction ra = nca as NvdlResultAction; if (ra != null) al.Add (new SimpleResultAction (ra, ctx)); else if (nca is NvdlValidate) al.Add (new SimpleValidate ( (NvdlValidate) nca, ctx)); else if (nca is NvdlAllow) al.Add (new SimpleValidate ( (NvdlAllow) nca, ctx)); else al.Add (new SimpleValidate ( (NvdlReject) nca, ctx)); } else if (nca == null) ctx.CancelledRules.Add (this, this); } actions = (SimpleAction []) al.ToArray ( typeof (SimpleAction)); }
public SimpleRule (NvdlRule rule, bool matchAttributes, NvdlCompileContext ctx) { FillLocation (rule); this.matchAttributes = matchAttributes; NvdlNamespace nss = rule as NvdlNamespace; if (nss == null) this.isAny = true; else { this.ns = nss.NS; if (nss.Wildcard == null) wildcard = "*"; else if (nss.Wildcard.Length > 1) throw new NvdlCompileException ("'wildCard' attribute can specify at most one character string.", rule); else wildcard = nss.Wildcard; } SimplifyPhase1 (rule, ctx); }