I don't really have an answer for you, but you are likely to get more help in the SQL and PL/SQL forum.
Somthing simpler like a regular expression search might help.
Looking for ; and / on consecutive lines (or with only blank lines in between) would help the second problem. (if the ; isn't attached to an "end")
Thanks for your answer.
Unfortunately regular expression is not suitable - too much of different cases.