private static string GetUniqueString(HashCache cache) { LR0Item obj = cache as LR0Item; return(obj.Dump()); //StringBuilder builder = new StringBuilder(); //builder.Append(obj.Regulation.Left.Nickname); //builder.Append(" ::= "); //int count = obj.Regulation.RightPart.Count(); //for (int i = 0; i < count; i++) //{ // if (i == obj.DotPosition) // { builder.Append('.'); builder.Append(' '); } // var item = obj.Regulation.RightNode(i); // builder.Append(item.Nickname); // builder.Append(' '); //} //if (obj.DotPosition == count) //{ builder.Append('.'); builder.Append(' '); } //builder.Append(';'); //return builder.ToString(); }
private static string GetUniqueString(HashCache cache) { TreeNodeType obj = cache as TreeNodeType; return(obj.Dump()); //return string.Format("({0})[{1}][{2}]", obj.Type, obj.Content, obj.Nickname); }
private static string GetUniqueString(HashCache cache) { FIRST obj = cache as FIRST; return(obj.Dump()); //StringBuilder builder = new StringBuilder(); //{ // builder.Append("FIRST( "); // int count = obj.target.Count; // for (int i = 0; i < count; i++) // { // builder.Append(obj.target[i].Nickname); // if (i + 1 < count) // { builder.Append(" "); } // } // if (count == 0) // { builder.Append("ε "); } // builder.Append(" ) = "); //} //{ // builder.Append("【 "); // int count = obj.values.Count; // for (int i = 0; i < count; i++) // { // builder.Append(obj.values[i].Nickname); // if (i + 1 < count) // { builder.Append(" "); } // } // builder.Append(" 】"); //} //return builder.ToString(); }
private static string getUniqueString(HashCache cache) { Regulation obj = cache as Regulation; return(obj.Dump()); //StringBuilder builder = new StringBuilder(); //builder.Append(obj.Left.Nickname); //builder.Append(" ::= "); //builder.Append(obj.RightPart); //builder.Append(" ;"); //return builder.ToString(); }
private static string GetUniqueString(HashCache cache) { LR1Edge obj = cache as LR1Edge; return(obj.Dump()); //StringBuilder builder = new StringBuilder(); //builder.Append(obj.From); //builder.AppendLine(); //builder.Append(" └──("); builder.Append(obj.X); builder.Append(")──┒"); //builder.AppendLine(); //builder.Append(obj.To); //return builder.ToString(); }
private static string GetUniqueString(HashCache cache) { var obj = cache as LALR1Edge; // 绝对不能用obj.Dump()了。LALR(1)的edge.CompareTo()不关注LookAheadNode //return obj.Dump(); StringBuilder builder = new StringBuilder(); builder.Append(obj.From); builder.AppendLine(); builder.Append(" └──("); builder.Append(obj.X); builder.Append(")──┒"); builder.AppendLine(); builder.Append(obj.To); return(builder.ToString()); }
private static string GetUniqueString(HashCache cache) { OrderedCollection <T> obj = cache as OrderedCollection <T>; return(obj.Dump()); //StringBuilder builder = new StringBuilder(); //for (int i = 0; i < obj.list.Count; i++) //{ // builder.Append(obj.list[i]); // if (i + 1 < obj.list.Count) // { // builder.Append(obj.seperator); // } //} //return builder.ToString(); }
private static string GetUniqueString(HashCache cache) { FOLLOW obj = cache as FOLLOW; return(obj.Dump()); //StringBuilder builder = new StringBuilder(); //builder.Append("FOLLOW("); //builder.Append(obj.Target.Nickname); //builder.Append(") = 【 "); //int count = obj.values.Count; //for (int i = 0; i < count; i++) //{ // builder.Append(obj.values[i].Nickname); // builder.Append(" "); //} //builder.Append("】"); //return builder.ToString(); }
private static string GetUniqueString(HashCache cache) { var obj = cache as LALR1State; // 绝对不能用obj.Dump()了。LALR(1)的state.CompareTo()不关注LookAheadNode //return obj.Dump(); StringBuilder builder = new StringBuilder(); for (int i = 0; i < obj.regulationDotList.Count; i++) { builder.Append(obj.regulationDotList[i]); if (i + 1 < obj.regulationDotList.Count) { builder.Append(Environment.NewLine); } } return(builder.ToString()); }