- Subject: [jed] help for diff mode (syntax color via dfa)
- From: <Lechee.Lai@xxxxxxxxxxxx>
- Date: Fri, 13 Apr 2007 07:42:07 +0800
Folks,
I’ve use JED 0.99.18U and try diff mode with simply syntax color via dfa_syntax but not working any hints?
% diff mode simple syntax color
$1 = "diff";
create_syntax_table ($1);
%define_syntax ('"', '"', $1);
%define_syntax ('\'', '\'', $1);
%define_syntax ('\\', '\\', $1);
define_syntax ("([{", ")]}", '(', $1);
define_syntax ("0-9a-zA-Z_", 'w', $1); % words
define_syntax ("0-9a-fA-F", '0', $1); % Numbers
define_syntax (",;.?:", ',', $1);
%define_syntax ("%-+/&*=<>|!~^", '+', $1);
set_syntax_flags ($1, 5); % case insensitive + C-mode
#ifdef HAS_DFA_SYNTAX
%%% DFA_CACHE_BEGIN %%%
private define setup_dfa_callback (name)
{
dfa_enable_highlight_cache("diffmode.dfa", name);
% dfa_define_highlight_rule ("^diff .*$","comment",name);
dfa_define_highlight_rule ("^\\-\\-\\- .*$","number",name);
dfa_define_highlight_rule ("^\\+\\+\\+ .*$","comment",name);
dfa_define_highlight_rule ("^@@.*@@","string",name);
dfa_define_highlight_rule ("^[0-9].*$","number",name);
dfa_define_highlight_rule ("^\\-.*$","keyword2",name);
dfa_define_highlight_rule ("^\\+.*$","normal",name);
dfa_define_highlight_rule ("^> .*$","normal",name);
dfa_define_highlight_rule ("^< .*$","normal",name);
dfa_define_highlight_rule ("^Only in .*$","normal",name);
dfa_build_highlight_table (name);
}
dfa_set_init_callback (&setup_dfa_callback,$1);
%%% DFA_CACHE_END %%%
#endif
() = define_keywords_n ($1, "diff", 4 ,0);
define diff_mode ()
{
variable diff = "diff";
set_mode (diff, 2);
use_syntax_table (diff);
run_mode_hooks("diff_mode_hook");
}
Andy Idea?
Thanks
Lechee
[2007 date index]
[2007 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]