xref: /Universal-ctags/Units/parser-sql.r/bug823000.sql.d/input.sql (revision ac0bc2347d23a84cbef9bc0e024621f9a30eb358)
1/*
2Bugs item #823000, was opened at 2003-10-13 21:56
3Message generated for change (Tracker Item Submitted) made by Item Submitter
4You can respond by visiting:
5https://sourceforge.net/tracker/?func=detail&atid=106556&aid=823000&group_id=6556
6
7Category: None
8Group: None
9Status: Open
10Resolution: None
11Priority: 5
12Submitted By: Jozsef Nagy (brutal)
13Assigned to: Nobody/Anonymous (nobody)
14Summary: PL/SQL functions and procedures
15
16Initial Comment:
17I've tried to use ctags (version 5.5.2) to navigate
18PL/SQL source codes in vim but jumping to
19function/procedure definitions worked not properly. I
20figured out that the problem was that I've defined
21these functions/procedures in multiline format, for
22example:
23
24test.pkb:
25*/
26CREATE OR REPLACE PACKAGE TEST IS
27
28PROCEDURE TestFunc1
29(
30  arg1  IN NUMBER,
31  arg2  IN NUMBER
32)
33IS
34BEGIN
35  NULL;
36END TestFunc1;
37
38PROCEDURE TestFunc2
39(
40  arg1  IN NUMBER,
41  arg2  IN NUMBER
42)
43IS
44BEGIN
45  NULL;
46END TestFunc2;
47
48END TEST;
49/
50/*
51ctags creates a regexp type pattern for my
52functions/procedures but unfortunately the pattern was
53/^IS$/ for each function/procedure, that's why the
54jumping method worked really crappy. (see the output of
55ctags 5.5.2 on this example code below)
56
57ctags -f - --language-force=sql test.pkb
58TEST    test.pkb        /^CREATE OR REPLACE PACKAGE
59TEST IS$/;" P
60TestFunc1       test.pkb        /^IS$/;"        p
61TestFunc2       test.pkb        /^IS$/;"        p
62
63I've looked into the ctags source code and I saw that
64in parseSubProgram() in sql.c called makeSqlTag() only
65when KEYWORD_is reached. I have modified this function
66 so that makeSqlTag() is called immediately after a
67function/procedure keyword and name is read (I have
68attached the output of diff sql.c.5.5.2 sql.c). I don't
69know much of ctags internals so I am not sure if this
70is the best solution but it worked for me. (see the
71output of my modified ctags below)
72
73ctags -f - --language-force=sql test.pkb
74TEST    test.pkb        /^CREATE OR REPLACE PACKAGE
75TEST IS$/;" P
76TestFunc1       test.pkb        /^PROCEDURE
77TestFunc1$/;"       p
78TestFunc2       test.pkb        /^PROCEDURE
79TestFunc2$/;"       p
80*/
81