Function List and PL/SQL packages



  • Yes, indeed. Thanks for the suggestion.



  • You’re welcome!



  • HI! Wonderful, I came here for this… :D

    I have tried his solution, but immediately bumped into a serious problem:
    I can see only the first method in my package. :(

    if i understand correctly, the classRange - mainExpr should match for the whole package body.
    I think the problem lies here at the last line:

    ^\h*END(?:\s+\k'PACKAGE_ID')?\s*;
    

    this matches the first “end;” in the code.

    In a real-world code there is lots of “end;” statements, as we can close methods with it, and even there is unnamed blocks inside them.

    Example:

    CREATE OR REPLACE PACKAGE BODY sch_001.pck_001 AS
      PROCEDURE p_proc_001(pn_id PLS_INTEGER) IS
        sd date;
      BEGIN
         -- unnamed block begin: "try-catch" in PL/SQL
         begin
            select sysdate into sd from dual;
         exception when others then
             sd := null;
         end;
         -- do something else
      END;
    END pck_001;
    /
    

    Please help me on this.
    Unfortunately I’m not really familiar with greedy multi-line regexp statements…

    For start, it would be OK, if it could end only on the end of file…

    It would be a huge help for us! :)



  • @Gábor-Madács
    I don’t understand your problem.



  • Thank you for the quick response!

    Your results are better than mine… :)

    What parser do you use? This is by the one from the last post from Jean-Marc Malmedy.
    I have also tried the one before this - posted by you - that is showed the second procedure too, but out of the body.
    (That’s because of here no “CREATE” in the procedure name - that is a difference between the two version. “CREATE” is for procedures not in packages.)

    Please post your fine parser version! :)

    Gabor



  • @Gábor-Madács See my post on GitHub.



  • @MAPJe71 Wow… Thank you very much! :D
    (May I note, now the “I don’t understand your problem.” seems somewhat unfounded… ;) )

    Work like a charm! (Looks like a charm, indeed… ;) )

    Hope, it will be part of the official NPP distribution!

    Thank you again!

    Gabor


Log in to reply