Esempio n. 1
0
        private void ReadModeCommon(NvdlModeBase el)
        {
            FillForeignAttribute(el);
            if (reader.IsEmptyElement)
            {
                reader.Skip();
                return;
            }
            reader.Read();
            do
            {
                reader.MoveToContent();
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    break;
                }
                if (reader.NamespaceURI != Nvdl.Namespace)
                {
                    el.Foreign.Add(XDocument.ReadFrom(reader));
                    continue;
                }
                switch (reader.LocalName)
                {
                case "mode":
                    el.IncludedModes.Add(ReadIncludedMode());
                    break;

                case "namespace":
                    el.Rules.Add(ReadNamespace());
                    break;

                case "anyNamespace":
                    el.Rules.Add(ReadAnyNamespace());
                    break;
                }
            } while (!reader.EOF);
            if (!reader.EOF)
            {
                reader.Read();
            }
            return;
        }
Esempio n. 2
0
        private void SimplifyPhase1(NvdlModeBase mode,
                                    NvdlCompileContext ctx)
        {
            NvdlModeCompileContext mctx =
                new NvdlModeCompileContext(mode);

            ctx.AddModeContext(this, mctx);
            ArrayList al = new ArrayList();

            foreach (NvdlRule r in mode.Rules)
            {
                switch (r.Match)
                {
                case NvdlRuleTarget.Both:
                    al.Add(new SimpleRule(r, true, ctx));
                    al.Add(new SimpleRule(r, false, ctx));
                    break;

                case NvdlRuleTarget.None:
                case NvdlRuleTarget.Elements:
                    al.Add(new SimpleRule(r, false, ctx));
                    break;

                case NvdlRuleTarget.Attributes:
                    al.Add(new SimpleRule(r, true, ctx));
                    break;
                }
            }
            foreach (NvdlIncludedMode inc in mode.IncludedModes)
            {
                mctx.Included.Add(new SimpleMode(inc, ctx));
            }
            // The rule table is just a dummy store that might
            // erase because of removal of inclusion.
            rules = (SimpleRule [])al.ToArray(typeof(SimpleRule));
        }
Esempio n. 3
0
 public void Remove(NvdlModeBase item)
 {
     List.Add(item);
 }
Esempio n. 4
0
 public void Add(NvdlModeBase item)
 {
     List.Add(item);
 }
Esempio n. 5
0
 public NvdlModeCompileContext(NvdlModeBase mode)
 {
     included = new ArrayList();
 }
Esempio n. 6
0
		public NvdlModeCompileContext (NvdlModeBase mode)
		{
			included = new ArrayList ();
		}
Esempio n. 7
0
		public void Remove (NvdlModeBase item)
		{
			List.Add (item);
		}
Esempio n. 8
0
		public void Add (NvdlModeBase item)
		{
			List.Add (item);
		}
Esempio n. 9
0
 public NvdlModeCompileContext(NvdlModeBase mode)
 {
     included = new List <SimpleMode> ();
 }
Esempio n. 10
0
		private void ReadModeCommon (NvdlModeBase el)
		{
			FillForeignAttribute (el);
			if (reader.IsEmptyElement) {
				reader.Skip ();
				return;
			}
			reader.Read ();
			do {
				reader.MoveToContent ();
				if (reader.NodeType == XmlNodeType.EndElement)
					break;
				if (reader.NamespaceURI != Nvdl.Namespace) {
					el.Foreign.Add (doc.ReadNode (reader));
					continue;
				}
				switch (reader.LocalName) {
				case "mode":
					el.IncludedModes.Add (ReadIncludedMode ());
					break;
				case "namespace":
					el.Rules.Add (ReadNamespace ());
					break;
				case "anyNamespace":
					el.Rules.Add (ReadAnyNamespace ());
					break;
				}
			} while (!reader.EOF);
			if (!reader.EOF)
				reader.Read ();
			return;
		}
Esempio n. 11
0
		private void SimplifyPhase1 (NvdlModeBase mode,
			NvdlCompileContext ctx)
		{
			NvdlModeCompileContext mctx =
				new NvdlModeCompileContext (mode);
			ctx.AddModeContext (this, mctx);
			ArrayList al = new ArrayList ();
			foreach (NvdlRule r in mode.Rules) {
				switch (r.Match) {
				case NvdlRuleTarget.Both:
					al.Add (new SimpleRule (r, true, ctx));
					al.Add (new SimpleRule (r, false, ctx));
					break;
				case NvdlRuleTarget.None:
				case NvdlRuleTarget.Elements:
					al.Add (new SimpleRule (r, false, ctx));
					break;
				case NvdlRuleTarget.Attributes:
					al.Add (new SimpleRule (r, true, ctx));
					break;
				}
			}
			foreach (NvdlIncludedMode inc in mode.IncludedModes)
				mctx.Included.Add (new SimpleMode (inc, ctx));
			// The rule table is just a dummy store that might
			// erase because of removal of inclusion.
			rules = (SimpleRule []) al.ToArray (typeof (SimpleRule));
		}