%s HEADER DELETE INSERT MODIFY %{ /* * $Header: /usr/build/vile/vile/filters/RCS/difffilt.l,v 1.6 2003/05/20 20:38:41 tom Exp $ * * Filter to add vile "attribution" sequences to selected bits of diff output */ #include DefineFilter("diff"); static char *Marker_attr; static char *Header_attr; static char *Insert_attr; static char *Delete_attr; static char *Modify_attr; %} BLANK [ \t] HEADER ^("***"|"+++"|"---"|@@|#|diff\>|Index:|Binary\>) INSERT ^[>+] DELETE ^[<-] MODIFY ^[|!] MARKED [^\n]*\n %% {HEADER} { WriteToken(Marker_attr); BEGIN(HEADER); }
{MARKED} { WriteToken(Header_attr); BEGIN(INITIAL); } {INSERT} { ECHO; BEGIN(INSERT); } {MARKED} { WriteToken(Insert_attr); BEGIN(INITIAL); } {DELETE} { ECHO; BEGIN(DELETE); } {MARKED} { WriteToken(Delete_attr); BEGIN(INITIAL); } {MODIFY} { ECHO; BEGIN(MODIFY); } {MARKED} { WriteToken(Modify_attr); BEGIN(INITIAL); } %% static void init_filter(int before GCC_UNUSED) { } static void do_filter(FILE *inputs) { yyin = inputs; Marker_attr = class_attr("Marker"); Header_attr = class_attr("Header"); Insert_attr = class_attr("Insert"); Delete_attr = class_attr("Delete"); Modify_attr = class_attr("Modify"); BEGIN(INITIAL); while (yylex() > 0) { } }