/// <summary> /// Initializes a new instance of the Concrete class. /// </summary> /// <param name="name">Name of concrete grammar</param> /// <param name="flags">Grammar flags</param> /// <param name="linDefs">Default linearization definitions</param> /// <param name="linRefs">Default linearization references</param> /// <param name="prods">List of production sets</param> /// <param name="cncCats">Dictionary containing concrete categories</param> /// <param name="fId">Function id</param> /// <param name="defaultStartCat">Default starting category</param> public Concrete(string name, Dictionary<string, Literal> flags, LinDef[] linDefs, LinDef[] linRefs, ProductionSet[] prods, Dictionary<string, ConcreteCategory> cncCats, int fId, string defaultStartCat) { this.Name = name; this.flags = flags; this.Prods = prods; this.CncCats = cncCats; this.FId = fId; this.startCat = defaultStartCat; this.LinDefs = linDefs; // Populate helper dictionary for production set // TODO check if productionsets can have the same ID? this.Productions = new Dictionary<int, List<Production>>(); foreach (ProductionSet ps in this.Prods) { var tempProd = new List<Production>(); foreach (Production p in ps.Prods) { tempProd.Add(p); } this.Productions[ps.ID] = tempProd; } }
/// <summary> /// Reads a list of LinDefs /// </summary> /// <returns>List of LinDefs</returns> private LinDef[] GetListLinDef() { int size = this.GetInt(); LinDef[] tmp = new LinDef[size]; for (int i = 0; i < size; i++) { tmp[i] = this.GetLinDef(); } return tmp; }