Пример #1
0
        /// <summary>
        /// 解析位置を指定する
        /// </summary>
        /// <param name="tCol">解析位置</param>
        /// <remarks>エイリアスを毎回展開しながら位置を算出するためとても効率が悪い</remarks>
        public void setPos(int tCol)
        {
            if (pData == null)
            {
                return;
            }

            dataEnd = false;

            int row = 0;
            int col = 0;
            int n = 0;
            string aliesName = "";
            resetPos();

            pos.tCol = tCol;

            while (true)
            {
                string data;
                char ch;

                //読みだすデータの頭出し
                if (aliesName == "")
                {
                    if (pData.Count == row)
                    {
                        dataEnd = true;
                        return;
                    }
                    data = pData[row].Item2;
                }
                else
                {
                    data = aData[aliesName].Item2;
                }

                while (data.Length == col)
                {
                    if (aliesName == "")
                    {
                        row++;
                        if (pData.Count == row)
                        {
                            dataEnd = true;
                            break;
                        }
                        else
                        {
                            data = pData[row].Item2;
                            col = 0;
                            break;
                        }
                    }
                    else
                    {
                        clsPos p = stackPos.Pop();
                        aliesName = p.alies;
                        col = p.col;
                        row = p.row;
                        if (aliesName == "")
                        {
                            data = pData[row].Item2;
                        }
                        else
                        {
                            data = aData[aliesName].Item2;
                        }
                    }
                }
                ch = data[col];

                while (ch == '%')
                {
                    string a = getAliesName(data, col);
                    if (a != "")
                    {
                        clsPos p = new clsPos();
                        p.alies = aliesName;
                        p.col = col + a.Length + 1;
                        p.row = row;
                        stackPos.Push(p);

                        data = aData[a].Item2;
                        col = 0;
                        aliesName = a;
                        row = 0;
                    }
                    else
                    {
                        msgBox.setWrnMsg("指定されたエイリアス名は定義されていません。"
                            , (aliesName == "") ? pData[row].Item1 : aData[aliesName].Item1
                            );
                        col++;
                    }
                    ch = data[col];
                }

                if (n == tCol)
                {
                    pos.row = row;
                    pos.col = col;
                    pos.alies = aliesName;
                    break;
                }

                n++;
                col++;
                while (data.Length == col)
                {
                    if (aliesName == "")
                    {
                        row++;
                        if (pData.Count == row)
                        {
                            dataEnd = true;
                            break;
                        }
                        else
                        {
                            data = pData[row].Item2;
                            col = 0;
                            break;
                        }
                    }
                    else
                    {
                        clsPos p = stackPos.Pop();
                        aliesName = p.alies;
                        col = p.col;
                        row = p.row;
                        if (aliesName == "")
                        {
                            data = pData[row].Item2;
                        }
                        else
                        {
                            data = aData[aliesName].Item2;
                        }
                    }
                }

            }
        }
Пример #2
0
 /// <summary>
 /// パート情報をリセットする
 /// </summary>
 public void resetPos()
 {
     pos = new clsPos();
     stackPos = new Stack<clsPos>();
 }