public void BuildIdentificator(OutputRow row)
        {
            string lex = row.Name;

            foreach (IdentificatorRow idRow in IdentificatorTable)
            {
                if (idRow.Name.CompareTo(lex) == 0)
                {
                    row.Index = idRow.Index;
                    return;
                }
            }

            foreach (OutputRow oRow in OutputTable)
            {
                if (oRow.Name.CompareTo("begin") == 0)
                {
                    throw new LexicException("Error: неоголошений ідентифікатор '" + lex + "', рядок " + line);
                }
            }
            IdentificatorRow idRow2 = new IdentificatorRow()
            {
                Name  = lex,
                Index = IdentificatorTable.Count + 1,
                Value = "0"
            };

            IdentificatorTable.Add(idRow2);
            row.Index = idRow2.Index;
        }
Ejemplo n.º 2
0
        private void GenerateRjTable(int index)
        {
            rTable.Add("r" + index);
            string           str   = rTable[rTable.Count - 1];
            IdentificatorRow idRow = new IdentificatorRow
            {
                Name  = str,
                Index = IdentificatorTable.Count - 1,
                Value = "0"
            };

            IdentificatorTable.Add(idRow);

            Polir.Add(new OutputRow()
            {
                Name = str,
                Id   = identificatorId
            });
            polirRow.Polir.Add(str);
            //AddToPolir(rTable[rTable.Count - 1]);
        }