private void printItemHTML(Item item, BitVectorSet conflictSymbols, TextWriter writer) { writer.Write(getSymbolPrintName(item.Production.LHSSymbol)); writer.Write(" ::="); for (int i = 0; i < item.Production.RHSSymbols.Count; i++) { if (i == item.Position) { writer.Write(" ·"); if ((item.Production.RHSSymbols[i] < grammar.NumTerminals) && conflictSymbols.Contains(item.Production.RHSSymbols[i])) { writer.Write(" <span style=\"color:red\">{0}</span>", getSymbolPrintName(item.Production.RHSSymbols[i])); } else { writer.Write(" " + getSymbolPrintName(item.Production.RHSSymbols[i])); } } else { writer.Write(" " + getSymbolPrintName(item.Production.RHSSymbols[i])); } } if (item.IsFinal) { writer.Write(" ·"); } }
private void printLookahead(BitVectorSet lookaheadSet, BitVectorSet conflictSymbols, TextWriter writer) { StringBuilder lookaheadSetString = new StringBuilder(); lookaheadSetString.Append('{'); foreach (int lookaheadSymbol in lookaheadSet) { if (conflictSymbols.Contains(lookaheadSymbol)) lookaheadSetString.AppendFormat("<span style=\"color:red\">{0}</span>", getSymbolPrintName(lookaheadSymbol)); else lookaheadSetString.Append(getSymbolPrintName(lookaheadSymbol)); lookaheadSetString.Append(", "); } lookaheadSetString.Remove(lookaheadSetString.Length - 2, 2); lookaheadSetString.Append('}'); writer.Write(lookaheadSetString.ToString()); }
private void printLookahead(BitVectorSet lookaheadSet, BitVectorSet conflictSymbols, TextWriter writer) { StringBuilder lookaheadSetString = new StringBuilder(); lookaheadSetString.Append('{'); foreach (int lookaheadSymbol in lookaheadSet) { if (conflictSymbols.Contains(lookaheadSymbol)) { lookaheadSetString.AppendFormat("<span style=\"color:red\">{0}</span>", getSymbolPrintName(lookaheadSymbol)); } else { lookaheadSetString.Append(getSymbolPrintName(lookaheadSymbol)); } lookaheadSetString.Append(", "); } lookaheadSetString.Remove(lookaheadSetString.Length - 2, 2); lookaheadSetString.Append('}'); writer.Write(lookaheadSetString.ToString()); }
private void printItemHTML(Item item, BitVectorSet conflictSymbols, TextWriter writer) { writer.Write(getSymbolPrintName(item.Production.LHSSymbol)); writer.Write(" ::="); for (int i = 0; i < item.Production.RHSSymbols.Count; i++) { if (i == item.Position) { writer.Write(" ·"); if ((item.Production.RHSSymbols[i] < grammar.NumTerminals) && conflictSymbols.Contains(item.Production.RHSSymbols[i])) writer.Write(" <span style=\"color:red\">{0}</span>", getSymbolPrintName(item.Production.RHSSymbols[i])); else writer.Write(" " + getSymbolPrintName(item.Production.RHSSymbols[i])); } else writer.Write(" " + getSymbolPrintName(item.Production.RHSSymbols[i])); } if (item.IsFinal) writer.Write(" ·"); }