コード例 #1
0
ファイル: NvdlSimplified.cs プロジェクト: pmq20/mono_forked
        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);
        }
コード例 #2
0
ファイル: NvdlSimplified.cs プロジェクト: pmq20/mono_forked
        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));
        }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
ファイル: NvdlStructures.cs プロジェクト: pmq20/mono_forked
 public void Remove(NvdlRule item)
 {
     List.Add(item);
 }
コード例 #5
0
ファイル: NvdlStructures.cs プロジェクト: pmq20/mono_forked
 public void Add(NvdlRule item)
 {
     List.Add(item);
 }
コード例 #6
0
 internal void AddRuleContext(SimpleRule r, NvdlRule rctx)
 {
     ruleContexts.Add(r, rctx);
 }
コード例 #7
0
		internal void AddRuleContext (SimpleRule r, NvdlRule rctx)
		{
			ruleContexts.Add (r, rctx);
		}
コード例 #8
0
ファイル: NvdlStructures.cs プロジェクト: jack-pappas/mono
		public void Remove (NvdlRule item)
		{
			List.Add (item);
		}
コード例 #9
0
ファイル: NvdlStructures.cs プロジェクト: jack-pappas/mono
		public void Add (NvdlRule item)
		{
			List.Add (item);
		}
コード例 #10
0
ファイル: NvdlReader.cs プロジェクト: KonajuGames/SharpLang
		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 ();
			}
		}
コード例 #11
0
ファイル: NvdlSimplified.cs プロジェクト: jack-pappas/mono
		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));
		}
コード例 #12
0
ファイル: NvdlSimplified.cs プロジェクト: jack-pappas/mono
		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);
		}