From 172a21f37471c7d8ad55318dcdc61c51986d4452 Mon Sep 17 00:00:00 2001 From: Arne Georg Gleditsch Date: Sun, 9 Aug 2009 13:35:06 +0200 Subject: Don't do progress reports when not on tty, allow ctags-unsupported languages to implement independent indexing. --- lib/LXRng/Lang/Kconfig.pm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'lib/LXRng/Lang') diff --git a/lib/LXRng/Lang/Kconfig.pm b/lib/LXRng/Lang/Kconfig.pm index 7417236..2239a87 100644 --- a/lib/LXRng/Lang/Kconfig.pm +++ b/lib/LXRng/Lang/Kconfig.pm @@ -114,5 +114,33 @@ sub resolve_include { return (); } +sub index_file { + my ($self, $context, $file, $add_ident) = @_; + + my $handle = $file->handle(); + my $parse = LXRng::Parse::Simple->new($handle, 8, + @{$self->parsespec}); + + my $line = 1; + while (1) { + my ($btype, $frag) = $parse->nextfrag; + + return 1 unless defined $frag; + + $btype ||= 'code'; + if ($btype eq 'code') { + while ($frag =~ s/\A(.*)^config (\w+)//) { + my ($pref, $sym) = ($1, $2); + $line += $pref =~ tr/\n/\n/; + $add_ident->($self->mangle_sym($sym), + {'kind' => 'd', + 'line' => $line}); + } + } + $line += $frag =~ tr/\n/\n/; + } +} + + 1; -- cgit v1.2.3