1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
/*
* Copyright (C) Tildeslash. All rights reserved.
* Use is subject to license terms.
*/
%option noyywrap
%{
/*
* Use for filtering text from a C-header file. Filter text between
* //<< and //>> or from //<< and to eof. '#' may be used instead of
* '//' if applicable.
*
* Usage: filterh < file > filtered-file
*/
#include <stdio.h>
#include <string.h>
%}
%x CPP BPP
%%
"//<<" { BEGIN(CPP); }
"#<<" { BEGIN(BPP); }
<CPP>{
"//>>".*"\n" { BEGIN(INITIAL); }
[\000-\377] ;
}
<BPP>{
"#>>".*"\n" { BEGIN(INITIAL); }
[\000-\377] ;
}
<INITIAL>. { fprintf(yyout, "%s", yytext); }
%%
int main(void) { return yylex(); }
|