%{ #ifndef lint static char *copyright = "Copyright (C) 1985, Sven Mattisson."; #endif /* * $Log: doc2sty.l,v $ * Revision 1.1 86/01/15 22:17:59 sven * Initial revision * */ %} %START BOL INL S [ \t]+ T [ \t]* W [ \t\f\n] X [^{W}] %% ^{T}%.*\n ; /* comment line(s) */ {S}%.*\n | %.*\n/{W} {putchar ('\n'); BEGIN BOL;} /* trailing comment */ %.*\n/{X} {printf ("%%\n"); BEGIN BOL;} /* tricky comment */ ^{T}\n ; /* empty line */ ^{S} ; /* strip leading spaces */ {S}$ ; /* strip trailing spaces */ {S}/[^%] {putchar (' ');} /* compress spaces */ \\" " | . {ECHO; BEGIN INL;} \n {ECHO; BEGIN BOL;} %% main(argc,argv) char **argv; { int i; BEGIN BOL; if (argc==1) { yyin = stdin; yylex(); } else for (i=1; i