Beispiel #1
0
        /// <summary>
        /// This parser is called recursively with every parenthesis
        /// </summary>
        private void ParseCommands(ref ParseItem i_Item)
        {
            while (i_Item != null)
            {
                Application.DoEvents();
                if (mb_Abort)
                    return;

                switch (i_Item.Type)
                {
                    case eType.ParOpen:
                        i_Item = i_Item.Next;
                        ParseCommands(ref i_Item);
                        break;

                    case eType.ParClose:
                        // do not set Next here !!!!
                        return;

                    case eType.Keyword:
                    case eType.Comand:
                        switch (i_Item.Cmd)
                        {
                            case eCmd.Select:
                                Parse_SELECT(ref i_Item);
                                break;

                            case eCmd.Create:
                                Parse_CREATE(ref i_Item);
                                break;

                            // CASE may appear after a "("
                            case eCmd.Case:
                                Parse_CASE(ref i_Item);
                                break;

                            case eCmd.Begin:
                                ParseItem  i_After = i_Item.FindAfterLF();
                                if (getCmd(i_After) != eCmd.Distributed &&
                                    getCmd(i_After) != eCmd.Transaction)
                                        i_Item.Indent = eIndent.DoubleLF;
                                break;

                            case eCmd.End:
                                i_Item.Outdent = eIndent.DoubleLF;
                                break;

                            case eCmd.Else:
                                ParseItem.SetLinebreakBefore(i_Item, 1);
                                break;

                            case eCmd.Exec:
                                ParseItem.SetLinebreakBefore(i_Item, 2);
                                break;
                        }
                        break;
                }
                if (i_Item == null)
                    break;

                i_Item = i_Item.Next;
            };
        }