示例#1
0
        public static string Write(object One, ref LswSql.SqlPositions SqlPosition)
        {
            string   Return = "ELSEIF ";
            LsElseIf Two    = (LsElseIf)One;

            Return += new SqlControler().Out(new LsBaseList()
            {
                Bases = new List <lsBase>()
                {
                    Two.Bracket
                }
            }).TrimEnd("\r\n".ToCharArray()) + " THEN\r\n";
            Return = Return.Replace("((", "(");
            foreach (var item in Two.InerLines)
            {
                Return += "\t" + new SqlControler().Out(new LsBaseList()
                {
                    Bases = new List <lsBase>()
                    {
                        item
                    }
                });
            }
            if (Two.EndIf)
            {
                Return += "END IF;\r\n";
            }
            return(Return);
        }
        public static LsBracket Read(string One, ref LswSql.SqlPositions SqlPosition)
        {
            LsBracket Two   = new LsBracket();
            string    Three = One[0].ToString();

            switch (Three)
            {
            case "<":
                Three = Three + "|>";
                break;

            case "(":
                Three = Three + "|)";
                break;

            case "[":
                Three = Three + "|]";
                break;

            case "{":
                Three = Three + "|}";
                break;

            default:
                Three = "(|)";
                break;
            }
            if (Two.BracketTypesPears.ContainsValue(Three))
            {
                Two.BracketType = Dic.KeyByValue(Three); // //
            }
            else
            {
                Two.BracketType = LsBracket.BracketTypes.Round;
            }
            //do
            //{
            string[] Parts;
            Parts = One.Trim().Substring(1, One.Length - 2).Split(Seperater(Two.BracketType).ToCharArray());
            foreach (var item in Parts)
            {
                string itemT = item.Trim();
                var    Four  = new SqlControler().PartInRef(itemT, ref SqlPosition);
                if (Four is string && (itemT[0] != '"' && itemT[0] != "'"[0]))
                {
                    Two.AddString(new LsName()
                    {
                        Name = Four.ToString()
                    });
                }
                else
                {
                    Two.AddBase(Four);
                }
            }
            SqlPosition.Position++;
            try
            { One = SqlPosition.InLine[SqlPosition.Position]; }
            catch { }
            //} while(CheckRepeate(One, Two));
            SqlPosition.Position = SqlPosition.Position - 1;
            return(Two);
        }