home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume13 / labels / labels.l < prev    next >
Encoding:
Lex Description  |  1988-01-31  |  3.2 KB  |  151 lines

  1. %{
  2. /*                   -- LABELS.L --
  3.  
  4. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  5. @@                                                                           @@
  6. @@                       Mailing List Label Formatter                        @@
  7. @@                    Lexical Analyzer for Form Parsing                      @@
  8. @@                      (C) Copyright 1987 by Joe Chen                       @@
  9. @@                           All Rights Reserved                             @@
  10. @@                                                                           @@
  11. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  12.  
  13. You may freely distribute this software to others.  But there are
  14. few rules you must follow:
  15.  
  16. 1. You don't profit from it.  You may however ask for minimal fees to
  17.    cover shipping and handling.
  18.  
  19. 2. This program is copyrighted, meaning you may not modify or enhance
  20.    this software and market it.  You may make changes to suit your
  21.    local needs.  Any enhancements are welcomed.
  22.  
  23. 3. Please honor the author by not removing or replacing his name from
  24.    the source codes.
  25.  
  26.  
  27. Feel free to contact me if you have any questions.
  28.  
  29.                     Joe Chen
  30.  
  31. ---------------------------------------------------------------------------
  32. Phones at work: (213) 743-5363, (213) 743-5935; at home: (818) 571-5304
  33. University Computing Services, University of Southern California
  34. UUCP: {sdcrdcf, uscvax}!oberon!wasat!joec
  35. ARPA: joec@wasat.usc.edu, joec@ecla.usc.edu
  36. ---------------------------------------------------------------------------
  37.  
  38. Program created by Joe Chen - Jul 24, 1987
  39.  
  40. *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
  41.  
  42. */
  43.  
  44. #include <stdio.h>
  45.  
  46. #ifdef UNIX
  47. #include "y.tab.h"
  48. #else
  49. #include "ytab.h"
  50. #endif
  51.  
  52. int value, line_no = 1;
  53. extern char *form;
  54. %}
  55.  
  56. cr        \n
  57. tab        \t
  58. space        " "
  59. white_space    ({space}|{tab})
  60. spcs        {white_space}*
  61.  
  62. digit        [0-9]
  63. number        {digit}+
  64.  
  65. letter        [A-Za-z_]
  66. word        {letter}({letter}|{digit})*
  67.  
  68. %%
  69.  
  70. {spcs}            ;
  71.  
  72. #.*            ;
  73.  
  74. {cr}            {    line_no++;        }
  75.  
  76. initial            {    return(_INITIAL);    }
  77.  
  78. string            {    return(_KSTRING);    }
  79.  
  80. fill            {    return(_FILL);        }
  81.  
  82. form            {    return(_FORM);        }
  83.  
  84. page            {    return(_PAGE);        }
  85.  
  86. width            {    return(_WIDTH);        }
  87.  
  88. hgap            {    return(_HGAP);        }
  89.  
  90. vgap            {    return(_VGAP);        }
  91.  
  92. columns            {    return(_COLUMNS);    }
  93.  
  94. column            {    return(_COLUMNS);    }
  95.  
  96. format            {    return(_FORMAT);    }
  97.  
  98. offset            {    return(_OFFSET);    }
  99.  
  100. of            {    return(_OF);        }
  101.  
  102. for            {    return(_OF);        }
  103.  
  104. lines            {    return(_LINES);        }
  105.  
  106. line            {    return(_LINE);        }
  107.  
  108. rows            {    return(_ROWS);        }
  109.  
  110. is            {    return(_IS);        }
  111.  
  112. ","            {    return(_DELIM);        }
  113.  
  114. ";"            {    return(_DELIM);        }
  115.  
  116. "="            {    return(_ASSIGN);    }
  117.  
  118. ":"            {    return(_ASSIGN);    }
  119.  
  120.  
  121. {number}        {
  122.                 value = atoi(yytext);
  123.                 return(_VALUE);
  124.             }
  125.  
  126. {word}            {    return(_WORD);        }
  127.  
  128.  
  129. \"[^\"]*\"        {    return(_STRING);    }
  130.  
  131. .            {
  132.               fprintf(stderr,
  133.                 "Line %d in %s: Illegal Character: '%s'\n",
  134.                   line_no, yytext);
  135.             }
  136.  
  137. %%
  138.  
  139. /****************************************************************************
  140.   yywrap() [Public function] - lex's function when EOF is detected from yyin
  141.  
  142.   parameters:    none
  143.  
  144.   exit flags:    1        Done matching tokens from input file
  145. ****************************************************************************/
  146.  
  147. yywrap()
  148. {
  149.   return 1;
  150. } /* yywrap() */
  151.