Exemple #1
0
        /// <summary>
        /// Add a command, keyword, operator, etc to the tag list
        /// </summary>
        private void AddItem(ref string s_SQL, ref int s32_Start, int s32_End, ref ParseItem i_LastItem)
        {
            int  s32_Last = Math.Min (s32_End, s_SQL.Length);
            string s_Text = s_SQL.Substring(s32_Start, s32_Last -s32_Start);
            ParseItem i_Item = new ParseItem(this, s_Text);

            if (i_Item.Type != eType.Invalid)
            {
                if (mi_FirstItem == null)
                    mi_FirstItem = i_Item;
                else
                    i_LastItem.InsertAfter(i_Item);

                i_LastItem = i_Item;

                if (!mb_CursorStored && ms32_CursorPos <= s32_End)
                {
                    mb_CursorStored = true;
                    i_Item.CursorPos = Math.Max(0, ms32_CursorPos - s32_Start);

                    Functions.PrintDebug("AddItem() set CursorPos={0} in Item      {1} <{2}> ...", i_Item.CursorPos, getDebug(i_Item.Prev), getDebug(i_Item), typeof(Parser));
                }
            }

            s32_Start = -1;
        }
Exemple #2
0
            /// <summary>
            /// Controls the count of linebreaks after an item
            /// These linebreaks are permananet and cannot be deleted by clean-up operations
            /// It is allowed that i_Item may be null !
            /// </summary>
            public static void SetLinebreakAfter(ParseItem i_Item, int s32_Count)
            {
                if (i_Item == null || i_Item.Next == null) // Don't insert linebreaks after the last item
                    return;

                if (!i_Item.mi_Parser.mb_ModifyLineBR)
                    return;

                // Assure at least s32_Count Linebreaks which are permanent
                for (int i=0; i<s32_Count; i++)
                {
                    if (getType(i_Item.Next) != eType.LineBreak)
                        i_Item.InsertAfter(new ParseItem(i_Item.mi_Parser, "\n"));

                    i_Item = i_Item.Next;
                    i_Item.Permanent = true;
                }
            }