~ubuntu-branches/ubuntu/trusty/lxr-cvs/trusty

« back to all changes in this revision

Viewing changes to lib/LXR/Lang/Java.pm

  • Committer: Bazaar Package Importer
  • Author(s): Giacomo Catenazzi
  • Date: 2004-01-27 20:34:44 UTC
  • Revision ID: james.westby@ubuntu.com-20040127203444-kb8xobdp8j1z8owi
Tags: upstream-0.9.2
ImportĀ upstreamĀ versionĀ 0.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- tab-width: 4 -*- ###############################################
 
2
#
 
3
# $Id: Java.pm,v 1.4 2001/11/14 15:27:36 mbox Exp $
 
4
#
 
5
# Enhances the support for the Java language over that provided by
 
6
# Generic.pm
 
7
#
 
8
# This program is free software; you can redistribute it and/or modify
 
9
# it under the terms of the GNU General Public License as published by
 
10
# the Free Software Foundation; either version 2 of the License, or
 
11
# (at your option) any later version.
 
12
#
 
13
# This program is distributed in the hope that it will be useful,
 
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
# GNU General Public License for more details.
 
17
#
 
18
# You should have received a copy of the GNU General Public License
 
19
# along with this program; if not, write to the Free Software
 
20
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
21
 
 
22
package LXR::Lang::Java;
 
23
 
 
24
 
 
25
my $CVSID = '$Id: Java.pm,v 1.4 2001/11/14 15:27:36 mbox Exp $ ';
 
26
 
 
27
use strict;
 
28
use LXR::Common;
 
29
require LXR::Lang;
 
30
require LXR::Lang::Generic;
 
31
 
 
32
@LXR::Lang::Java::ISA = ('LXR::Lang::Generic');
 
33
 
 
34
# Only override the include handling.  For java, this is really package
 
35
# handling, as there is no include mechanism, so deals with "package" 
 
36
# and "import" keywords
 
37
 
 
38
sub processinclude {
 
39
        my ($self, $frag, $dir) = @_;
 
40
        # Deal with package declaration of the form
 
41
        # "package java.lang.util"
 
42
        $$frag =~ s#(package\s+)([\w.]+)#
 
43
            $1.
 
44
            ($index->issymbol($2, $$self{'release'}) ?
 
45
                join($2, @{$$self{'itag'}}) : $2)
 
46
            #e;
 
47
        # Deal with import declaration of the form
 
48
        # "import java.awt.*" by providing link to the package
 
49
        $$frag =~ s#(import\s+)([\w.]+)(\.\*)#
 
50
                $1.
 
51
                        ($index->issymbol($2, $$self{'release'}) ?
 
52
                         join($2, @{$$self{'itag'}}) : $2) . 
 
53
                                 $3 #e;
 
54
        
 
55
        # Deal with import declaration of the form
 
56
        # "import java.awt.classname" by providing links to the
 
57
        # package and the class
 
58
        $$frag =~ s#(import\s+)([\w.]+)\.(\w+)(\W)#
 
59
                $1.
 
60
                        ($index->issymbol($2, $$self{'release'}) ?
 
61
                         join($2, @{$$self{'itag'}}) : $2) . "." .
 
62
                                 ($index->issymbol($3, $$self{'release'}) ?
 
63
                                  join($3, @{$$self{'itag'}}) : $3) . $4#e;
 
64
                        
 
65
          }
 
66
 
 
67
 
 
68
 
 
69
1;
 
70
 
 
71