aboutsummaryrefslogtreecommitdiffstats
path: root/lib/LXRng/Lang/C.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/LXRng/Lang/C.pm')
-rw-r--r--lib/LXRng/Lang/C.pm37
1 files changed, 8 insertions, 29 deletions
diff --git a/lib/LXRng/Lang/C.pm b/lib/LXRng/Lang/C.pm
index 60a571b..db3a204 100644
--- a/lib/LXRng/Lang/C.pm
+++ b/lib/LXRng/Lang/C.pm
@@ -51,13 +51,13 @@ sub identifier_re {
return $_identifier_re;
}
-my $_reserved ||= { map { $_ => 1 }
- qw(asm auto break case char const continue default
- do double else enum extern float for fortran
- goto if int long register return short signed
- sizeof static struct switch typedef union
- unsigned void volatile while #define #else
- #endif #if #ifdef #ifndef #include #undef)};
+my $_reserved = { map { $_ => 1 }
+ qw(asm auto break case char const continue default
+ do double else enum extern float for fortran goto
+ if int long register return short signed sizeof
+ static struct switch typedef union unsigned void
+ volatile while #define #else #endif #if #ifdef
+ #ifndef #include #undef)};
sub reserved {
return $_reserved;
@@ -73,31 +73,10 @@ sub parsespec {
'include', '#\s*include\s+<', '>'];
}
-sub typemap {
- return {
- 'c' => 'class',
- 'd' => 'macro (un)definition',
- 'e' => 'enumerator',
- 'f' => 'function definition',
- 'g' => 'enumeration name',
- 'm' => 'class, struct, or union member',
- 'n' => 'namespace',
- 'p' => 'function prototype or declaration',
- 's' => 'structure name',
- 't' => 'typedef',
- 'u' => 'union name',
- 'v' => 'variable definition',
- 'x' => 'extern or forward variable declaration',
- 'i' => 'interface'};
-}
-
sub markuphandlers {
my ($self, $context, $node, $markup) = @_;
my $index = $context->config->{'index'};
- my $idre = $self->identifier_re();
- my $res = $self->reserved();
-
my %subst;
my $format_newline = $markup->make_format_newline($node);
@@ -121,7 +100,7 @@ sub markuphandlers {
$subst{'code'} = new Subst::Complex
qr/\n/ => $format_newline,
- qr/[^\n]*/ => sub { $markup->format_code($idre, $res, @_) };
+ qr/[^\n]*/ => sub { $markup->format_code($self, @_) };
$subst{'start'} = new Subst::Complex
qr/^/ => $format_newline;