protected void formatConstruction(string del, KifObject kifObject, TextWriter writer) { int count = 0; IList <IModelItem> list = kifObject.getChildren(); for (int i = 0; i < list.Count - 1; i++) { IModelItem item = list[i]; if (item.isDelimiter()) { if (list[i + 1].isLeaf()) { writer.Write(" "); } if (count == 1) { writer.Write("\n"); } else { count++; } } } }
public KifObject getLexem(string name) { KifObject result = null; if (!(StringUtils.isEmpty(name) || _register.TryGetValue(name, out result))) { result = new Lexem(name); _register.Add(name, result); } return(result); }
protected virtual void WriteConstruction(string ident, IModelItem modelItem, TextWriter writer, int pos) { KifObject kifObject = modelItem as KifObject; IList <IModelItem> items = kifObject.getChildren(); writer.Write(ident); for (int i = 0; i < items.Count; i++) { IModelItem item = items[i]; if (item.isLeaf()) { writer.Write(item.ToString()); if (i < items.Count - 1 && item != LB && items[i + 1] != RB) { writer.Write(" "); } } else { WriteConstruction(calcIdent(ident, pos + 1), item, writer, pos + 1); } } }