package xm::code::c;
use xm::o;
use xm::code::vars;
use xm::code::func;
"
highlight sourcecode - C mode
"}
$LANGUAGE{'c'} = {
'filename' => '\\.[ch]$',
'regex' => '',
'patterns' => [
{
'name' => 'doc comment',
'regex' => '/\\*\\*.*?\\*/',
'style' => 'doc comment',
'childregex' => []
},
{
'name' => 'comment',
'regex' => '/\\*.*?\\*/',
'style' => 'comment',
'childregex' => []
},
{
'name' => 'string',
'regex' => '""|".*?([^\\\\](\\\\\\\\)*)"|"\\\\\\\\"',
'style' => 'string',
'childregex' => [
{
'name' => 'esc character',
'regex' => '\\\\.',
'style' => 'esc character',
'childregex' => []
}
]
},
{
'name' => 'preprocessor line',
'regex' => '^[ \\t]*#.*?$', 'style' => 'preprocessor',
'childregex' => [
{
'name' => 'string',
'regex' => '""|".*?([^\\\\](\\\\\\\\)*)"|"\\\\\\\\"',
'style' => 'string',
'childregex' => [
{
'name' => 'esc character',
'regex' => '\\\\.',
'style' => 'esc character',
'childregex' => []
}
]
},
{
'name' => '<files>',
'regex' => '<.*?>',
'style' => 'string',
'childregex' => []
},
{
'name' => 'comment',
'regex' => '[^/]/\\*.*?\\*/',
'style' => 'comment',
'childregex' => []
}
]
},
{
'name' => 'character constant',
'regex' => '\'(\\\\)?.\'',
'style' => 'character',
'childregex' => [
{
'name' => 'esc character',
'regex' => '\\\\.',
'style' => 'esc character',
'childregex' => []
}
]
},
{
'name' => 'numeric constant',
'regex' => '\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?\\b',
'style' => 'numeric',
'childregex' => []
},
{
'name' => 'storage keyword',
'regex' => '\\b(const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum)\\b',
'style' => 'reserved word', 'childregex' => []
},
{
'name' => 'keyword',
'regex' => '\\b(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)\\b',
'style' => 'reserved word', 'childregex' => []
},
{
'name' => 'braces',
'regex' => '[\\{\\}]',
'style' => 'braces',
'childregex' => []
},
{
'name' => 'symbols',
'regex' => '([\\*\\-\\+=:;%&\\|<>\\(\\)\\[\\]!])',
'style' => 'symbol',
'childregex' => []
},
{
'name' => 'identifiers',
'regex' => '([a-zA-Z_][a-zA-Z_0-9]*)',
'style' => 'identifier',
'childregex' => []
}
]
};
return xm::code::func::DO($_[0],$LANGUAGE{c}{patterns});
}
return xm::o::args_stdin(@_, DESC); }
return DO(xm::o::args_stdin(@_, DESC)); }
1;