home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / dev / misc / adoc / source / coda.yy < prev    next >
Text File  |  1995-04-13  |  2KB  |  59 lines

  1. /* $VER: $Id: coda.yy,v 1.3 1995/03/30 13:12:11 tf Exp $ */
  2.  
  3. %{
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <stdio.h>
  7.  
  8. #ifdef yywrap
  9. #undef yywrap
  10. #endif
  11. %}
  12.  
  13. %%
  14.  
  15. (\n|\f)[^\n\t\f ]+"/"[^\n\t\f ]+[\t ]+[^\n\t\f ]+"/"[^\n\t\f ]+\n  {
  16.                            register char *s, *t;
  17.                            yyless(yyleng-1);
  18.                            if( (s= strdup(&yytext[1])) ) {
  19.                              for(t=s; *t && *t!=' ' && *t!='\t'; t++) ;
  20.                              *t='\0';
  21.                              printf("\n/****** %s ******",s);
  22.                              free(s);
  23.                            }
  24.                          }
  25.  
  26. \f[\n]*[^\n\t\f ]+"/"[^\n\t\f ]+([\t ]*\n){2}   { /* The MUI Problem */
  27.                            register char *s, *t, *u;
  28.                            yyless(yyleng-2);
  29.                            for(u=&yytext[1]; *u=='\n' || *u=='\f'; u++) ;
  30.                            if( (s= strdup(u)) ) {
  31.                              for(t=s; *t && *t!=' ' && *t!='\t' && *t!='\n'; t++) ;
  32.                              *t='\0';
  33.                              printf("******/\n/****** %s ******\n*",s);
  34.                              free(s);
  35.                            }
  36.                          }
  37.  
  38. \n                       { printf("%s*",yytext); }
  39. \f                       { printf("*****/\n"); }
  40. \n[^ \f\t\n]             { printf(" %s", &yytext[1]); }       /* word wrap? */
  41. \n"TABLE OF CONTENTS"    { printf("\n******/\n%s",yytext); }  /* next file */
  42. \n\n"TABLE OF CONTENTS"  { printf("\n******/\n%s",yytext); }  /* next file */
  43. .                        { ECHO; }
  44.  
  45. <<EOF>>                  { printf("******/\n"); yyterminate(); }
  46.  
  47. %%
  48.  
  49. #if 0
  50. \n\f                     { printf("\n******/\n"); }
  51. #endif
  52.  
  53. #ifdef yywrap
  54. #undef yywrap
  55. #endif
  56.  
  57. int yywrap() { return 1; }
  58. int main()   { return yylex(); }
  59.