public ModuleSubscribe(Module module, ITree node, string filename, string package, IList<string> ns) : base(node, filename, package, ns) { if (node.Type != SpicaMLLexer.SUB) { throw new CException("Module: Unable to create subscription request, wrong node type! ({0})", module.Details); } if (node.ChildCount < 1) { throw new CException("Module: Unable to create subscription request, wrong number of children! ({0})", module.Details); } this.module = module; Name = node.GetChild(0).Text; this.annDMC = this.module.subDefaultDMC; this.annSrc = this.module.subDefaultSrc; this.annPeriod = this.module.subDefaultPeriod; this.annType = this.module.subDefaultType; this.annTTL = this.module.subDefaultTTL; this.extract = new List<Annotations.Extract>(); for (int i = 1; i < node.ChildCount; i++) { switch (node.GetChild(i).Type) { case SpicaMLLexer.DMC: this.annDMC = this.module.GetDMC(node.GetChild(i)); break; case SpicaMLLexer.PERIOD: this.annPeriod = this.module.GetPeriod(node.GetChild(i)); break; case SpicaMLLexer.SRC: this.annSrc = this.module.GetSource(node.GetChild(i)); break; case SpicaMLLexer.TYPE: this.annType = this.module.GetType(node.GetChild(i)); break; case SpicaMLLexer.TTL: this.annTTL = this.module.GetTTL(node.GetChild(i)); break; case SpicaMLLexer.EXTRACT: this.extract.Add(new Annotations.Extract(this.module, this, node.GetChild(i))); break; } } }
protected void Process(ITree node, string filename) { switch (node.Type) { case SpicaMLLexer.STRUCT: { Structure s = new Structure(node, filename, null, Namespace); foreach (Element elem in this.elements) { if (elem.Equals(s)) { throw new CException("Unable to create structure '{0}', already defined", s.Name); } } this.elements.Add(s); } break; case SpicaMLLexer.ENUM: { Enum e = new Enum(node, filename, null, Namespace); foreach (Element elem in this.elements) { if (elem.Equals(e)) { throw new CException("Unable to create enumeration '{0}', already defined", e.Name); } } this.elements.Add(e); } break; case SpicaMLLexer.MODULE: { Module m = new Module(node, filename, null, Namespace); foreach (Element elem in this.elements) { if (elem.Equals(m)) { throw new CException("Unable to create module '{0}', already defined", m.Name); } } this.elements.Add(m); } break; case SpicaMLLexer.INCLUDE: { ProcessTree(node, node.Text); } break; } }
public ModulePublish(Module module, ITree node, string filename, string package, IList<string> ns) : base(node, filename, package, ns) { if (node.Type != SpicaMLLexer.PUB) { throw new CException("Module: Unable to create publication request, wrong node type! ({0})", module.Details); } if (node.ChildCount < 1) { throw new CException("Module: Unable to create publication request, wrong number of children! ({0})", module.Details); } this.module = module; Name = node.GetChild(0).Text; this.annDMC = this.module.pubDefaultDMC; this.annDst = this.module.pubDefaultDst; this.annPeriod = this.module.pubDefaultPeriod; this.annTTL = this.module.pubDefaultTTL; for (int i = 1; i < node.ChildCount; i++) { switch (node.GetChild(i).Type) { case SpicaMLLexer.DMC: this.annDMC = this.module.GetDMC(node.GetChild(i)); break; case SpicaMLLexer.PERIOD: this.annPeriod = this.module.GetPeriod(node.GetChild(i)); break; case SpicaMLLexer.DST: this.annDst = this.module.GetSource(node.GetChild(i)); break; case SpicaMLLexer.TTL: this.annTTL = this.module.GetTTL(node.GetChild(i)); break; } } }