public void setDTAll() { foreach (var item in datatypes) { foreach (tokenCounter t in item.counter) { if (!(new List <string>() { "bool", "char", "short", "float", "int", "FILE", "int32", "double", "long", "void" }.Exists(element => t.getLexeme() == element))) { if (dataTypesAllFile.Select(a => a.getLexeme()).Contains("newDataType")) { tokenCounter t2 = dataTypesAllFile.Find(a => a.getLexeme() == "newDataType"); t2.setCount(t2.getCount() + t.getCount()); } else { tokenCounter t2 = new tokenCounter(new token("newDataType", "datatype")); t2.setCount(t.getCount()); dataTypesAllFile.Add(t2.copy()); } } else if (dataTypesAllFile.Select(a => a.getLexeme()).Contains(t.getLexeme())) { tokenCounter t2 = dataTypesAllFile.Find(a => a.getLexeme() == t.getLexeme()); t2.setCount(t2.getCount() + t.getCount()); } else { dataTypesAllFile.Add(t.copy()); } } } }
public void setOpAll() { foreach (var item in operations) { foreach (tokenCounter t in item.counter) { if (operationsAllFile.Select(a => a.getLexeme()).Contains(t.getLexeme())) { tokenCounter t2 = operationsAllFile.Find(a => a.getLexeme() == t.getLexeme()); t2.setCount(t2.getCount() + t.getCount()); } else { operationsAllFile.Add(t.copy()); } } } }
public void setSpecialCahrAll() { foreach (var item in specialChars) { foreach (tokenCounter t in item.counter) { if (specialCharAllFile.Select(a => a.getLexeme()).Contains(t.getLexeme())) { tokenCounter t2 = specialCharAllFile.Find(a => a.getLexeme() == t.getLexeme()); t2.setCount(t2.getCount() + t.getCount()); } else { specialCharAllFile.Add(t.copy()); } } } }
public void setKWAll() { foreach (var item in keyWords) { foreach (tokenCounter t in item.counter) { if (keyWordsAllFile.Select(a => a.getLexeme()).Contains(t.getLexeme())) { tokenCounter t2 = keyWordsAllFile.Find(a => a.getLexeme() == t.getLexeme()); t2.setCount(t2.getCount() + t.getCount()); } else { keyWordsAllFile.Add(t.copy()); } } } }
public List <variableCounter> varsAllFile = new List <variableCounter>(); //not used #region setAll public void setValuesAll() { foreach (var item in values) { foreach (tokenCounter t in item.counter) { if (valuesAllFile.Select(a => a.getType()).Contains(t.getType())) { tokenCounter t2 = valuesAllFile.Find(a => a.getType() == t.getType()); t2.setCount(t2.getCount() + t.getCount()); } else { tokenCounter t5 = t.copy(); t5.setLexeme(t.getType()); valuesAllFile.Add(t5); } } } }