コード例 #1
0
ファイル: SourceEditor.cs プロジェクト: roderickd/ILEditor
        private void Parse()
        {
            if (IBMi.CurrentSystem.GetValue("OUTLINE_VIEW_ENABLED") == "true")
            {
                string code = "";
                switch (this.Language)
                {
                case Language.RPG:
                    this.Invoke((MethodInvoker) delegate
                    {
                        code = GetText().ToUpper();
                    });
                    this.Functions = RPGParser.Parse(code);
                    break;

                case Language.CL:
                    this.Invoke((MethodInvoker) delegate
                    {
                        code = GetText().ToUpper();
                    });
                    this.Functions = CLParser.Parse(code);
                    break;
                }
            }
        }
コード例 #2
0
ファイル: SourceEditor.cs プロジェクト: jairofloress/ILEditor
        private void Parse()
        {
            if (IBMi.CurrentSystem.GetValue("OUTLINE_VIEW_ENABLED") == "true")
            {
                string code = "";

                if (this.Language == Language.RPG || this.Language == Language.CL)
                {
                    try
                    {
                        this.Invoke((MethodInvoker) delegate
                        {
                            code = GetText().ToUpper();
                        });
                        switch (this.Language)
                        {
                        case Language.RPG:
                            this.Functions = RPGParser.Parse(code);
                            break;

                        case Language.CL:
                            this.Functions = CLParser.Parse(code);
                            break;
                        }
                    }
                    catch
                    {
                        Editor.TheEditor.SetStatus("Error parsing " + this.Language.ToString() + " for " + this.Text + ".");
                    }
                }
            }
        }
コード例 #3
0
    public void Test1()
    {
        CLParser parser = new CLParser();
        var      config = parser.Run <TestConfig>(GetArgs().ToArray());

        Assert.AreEqual("testbbbb", config.Test);
        Assert.AreEqual(EnumTest.Test3, config.EnumTest);
        Assert.AreEqual(4444, config.Num);
        Assert.AreEqual(0, config.Value);
    }
コード例 #4
0
        private void Parse()
        {
            List <TaskItem> Items = new List <TaskItem>();
            int             CharIndex = -1, lineNumber = 0;

            string code = "";

            this.Invoke((MethodInvoker) delegate
            {
                code = GetText();
            });

            if (IBMi.CurrentSystem.GetValue("OUTLINE_VIEW_ENABLED") == "true")
            {
                try
                {
                    switch (this.Language)
                    {
                    case Language.RPG:
                        this.Functions = RPGParser.Parse(code.ToUpper());
                        break;

                    case Language.CL:
                        this.Functions = CLParser.Parse(code.ToUpper());
                        break;
                    }
                }
                catch
                {
                    Editor.TheEditor.SetStatus("Error parsing " + this.Language.ToString() + " for " + this.Text + ".");
                }
            }

            foreach (string Line in code.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
            {
                lineNumber++;

                foreach (string Keyword in Program.TaskKeywords)
                {
                    CharIndex = Line.IndexOf("//" + Keyword);
                    if (CharIndex >= 0)
                    {
                        Items.Add(new TaskItem()
                        {
                            Line = lineNumber, Text = Line.Substring(CharIndex + 2)
                        });
                    }
                }
            }

            this.Tasks = Items.ToArray();
        }
コード例 #5
0
    public void Test2()
    {
        CLParser  parser  = new CLParser();
        bool      success = false;
        Exception error   = null;

        try
        {
            var config = parser.Run <TestRequiredConfig>(GetArgs().ToArray());
            success = true;
            config  = parser.Run <TestRequiredConfig>(new string[] { });
        }
        catch (Exception ex)
        {
            error = ex;
        }
        Assert.IsTrue(success);
        Assert.IsNotNull(error);
    }
コード例 #6
0
        override public void Tick()
        {
            //Get user Input
            Console.Write("$");
            CLParser cmd = new CLParser(Console.ReadLine());

            //Parse command
            switch (cmd.Command)
            {
            case "setup":
                Setup();
                break;

            case "index":
                ReadIndexData(cmd.HasArgument("update"));
                break;

            case "download":
                Download();
                break;

            case "process":
                Merge();
                break;

            case "help":
                PostHelp();
                break;

            case "exit":
                m_exit = true;
                break;

            default:
                Console.WriteLine("Unknown Command \"" + cmd.Command + "\". Enter \"help\" for a list of the available commands.");
                break;
            }
        }
コード例 #7
0
        internal static void CommandMenuInit()
        {
            StringBuilder pluginsConfigDir = new StringBuilder(Win32.MAX_PATH);

            Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_GETPLUGINSCONFIGDIR, Win32.MAX_PATH, pluginsConfigDir);
            ConfigDirectory    = $"{ pluginsConfigDir.ToString() }\\{ PluginName }\\";
            SystemsDirectory   = $"{ConfigDirectory}systems\\";
            FileCacheDirectory = $"{ConfigDirectory}cache\\";

            if (!Directory.Exists(ConfigDirectory))
            {
                Directory.CreateDirectory(ConfigDirectory);
            }
            if (!Directory.Exists(SystemsDirectory))
            {
                Directory.CreateDirectory(SystemsDirectory);
            }
            if (!Directory.Exists(FileCacheDirectory))
            {
                Directory.CreateDirectory(FileCacheDirectory);
            }

            IBMiUtilities.CreateLog(ConfigDirectory + PluginName);
            RPGParser.LoadFileCache();
            CLParser.LoadFileCache();

            if (File.Exists(ConfigDirectory + "dftcfg"))
            {
                Config.SwitchToConfig(File.ReadAllText(ConfigDirectory + "dftcfg"));
            }
            else
            {
                LoadConfigSelect();
                if (Config.GetConfigs().Length == 0)
                {
                    return;
                }
                if (IBMi._ConfigFile == "" || IBMi._ConfigFile == null)
                {
                    string UseConfig = Config.GetConfigs()[0];
                    MessageBox.Show("No config selected. Defaulted to " + UseConfig + ".");
                    Config.SwitchToConfig(UseConfig);
                }
            }
            //if (IBMi.GetConfig("localDefintionsInstalled") == "false")
            //{
            //    IBMiNPPInstaller.InstallLocalDefinitions();
            //}

            bool ExperimentalFeatures = (IBMi.GetConfig("experimental") == "true");
            int  ItemOrder            = 0;

            PluginBase.SetCommand(ItemOrder++, "About IBMiCmd", About, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand(ItemOrder++, "-SEPARATOR-", null);
            PluginBase.SetCommand(ItemOrder++, "Select Remote System", LoadConfigSelect);
            PluginBase.SetCommand(ItemOrder++, "Remote System Setup", RemoteSetup);
            PluginBase.SetCommand(ItemOrder++, "Library List", LiblDialog, new ShortcutKey(true, false, false, Keys.F7));
            if (ExperimentalFeatures)
            {
                PluginBase.SetCommand(ItemOrder++, "Remote Install Plugin Server", RemoteInstall);
            }
            PluginBase.SetCommand(ItemOrder++, "-SEPARATOR-", null);
            PluginBase.SetCommand(ItemOrder++, "Command Entry", CommandDialog);
            PluginBase.SetCommand(ItemOrder++, "Error Listing", ErrorDialog);
            PluginBase.SetCommand(ItemOrder++, "Command Bindings", BindsDialog);
            PluginBase.SetCommand(ItemOrder++, "-SEPARATOR-", null);
            PluginBase.SetCommand(ItemOrder++, "Member Listing", MemberListing);
            PluginBase.SetCommand(ItemOrder++, "Open Source Member", OpenMember, new ShortcutKey(true, false, true, Keys.A));
            //PluginBase.SetCommand(ItemOrder++, "Upload Source Member", UploadMember, new ShortcutKey(true, false, true, Keys.X));
            PluginBase.SetCommand(ItemOrder++, "Open Include/Copy", OpenInclude, new ShortcutKey(true, false, false, Keys.F12));
            PluginBase.SetCommand(ItemOrder++, "-SEPARATOR-", null);
            PluginBase.SetCommand(ItemOrder++, "Format CL file", ManageCL, new ShortcutKey(true, false, false, Keys.F4));
            PluginBase.SetCommand(ItemOrder++, "RPG Line Conversion", LaunchConversion, new ShortcutKey(true, false, false, Keys.F5));
            PluginBase.SetCommand(ItemOrder++, "RPG File Conversion", LaunchFileConversion, new ShortcutKey(true, false, false, Keys.F6));
            PluginBase.SetCommand(ItemOrder++, "-SEPARATOR-", null);
            PluginBase.SetCommand(ItemOrder++, "Display File Editor", DisplayEdit);
            if (ExperimentalFeatures)
            {
                PluginBase.SetCommand(ItemOrder++, "Refresh Extname Definitions", BuildSourceContext);
            }
            if (ExperimentalFeatures)
            {
                PluginBase.SetCommand(ItemOrder++, "Extname Content Assist", AutoComplete, new ShortcutKey(false, true, false, Keys.Space));
            }
            if (ExperimentalFeatures)
            {
                PluginBase.SetCommand(ItemOrder++, "Prompt CL Command", PromptCommand, new ShortcutKey(true, false, false, Keys.F4));
            }
        }