Example #1
0
        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 + ".");
                    }
                }
            }
        }
Example #2
0
        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;
                }
            }
        }
Example #3
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();
        }
Example #4
0
        public static void ScanFile()
        {
            string currentFile = NppFunctions.GetCurrentFileName().ToUpper();

            if (currentFile.Contains("RPG"))
            {
                FileItems = RPGParser.ScanFile(currentFile).ToArray();
            }
            else
            {
                FileItems = null;
            }

            if (Main.CommandWindow != null)
            {
                Main.CommandWindow.loadNewOutput();
            }
        }
Example #5
0
        public void GetVariableAtColumnTest()
        {
            MatchType mt = 0;

            Assert.IsTrue(RPGParser.GetVariableAtColumn(" myVar = 510", 4, out mt) == "myV");
            Assert.IsTrue(mt == MatchType.VARIABLE);
            Assert.IsTrue(RPGParser.GetVariableAtColumn(" myVariable_that_isLong", 23, out mt) == "myVariable_that_isLong");
            Assert.IsTrue(mt == MatchType.VARIABLE);
            Assert.IsTrue(RPGParser.GetVariableAtColumn("ds.", 3, out mt) == "ds");
            Assert.IsTrue(mt == MatchType.STRUCT_FIELD);
            Assert.IsTrue(RPGParser.GetVariableAtColumn("nested.ds.", 10, out mt) == "ds");
            Assert.IsTrue(mt == MatchType.STRUCT_FIELD);
            Assert.IsTrue(RPGParser.GetVariableAtColumn("  if myVar = 510;", 11, out mt) == "");
            Assert.IsTrue(mt == MatchType.NONE);
            Assert.IsTrue(RPGParser.GetVariableAtColumn(" myVar = 510", 10, out mt) == "");
            Assert.IsTrue(mt == MatchType.NONE);
            Assert.IsTrue(RPGParser.GetVariableAtColumn(" my<Var = 510", 4, out mt) == "");
            Assert.IsTrue(mt == MatchType.NONE);
        }