Beispiel #1
0
        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(" ·");
            }
        }
Beispiel #2
0
        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());
        }
Beispiel #3
0
        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());
        }
Beispiel #4
0
        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(" ·");
        }