home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 173_01 / abc.lxi < prev    next >
Text File  |  1979-12-31  |  896b  |  33 lines

  1. /*
  2.  * An example lex input file to show the effects of quotes,
  3.  * apostrophes, and upper and lower case letters.
  4.  */
  5.  
  6. c = [C];
  7.  
  8.  
  9.  
  10. %{
  11. main()
  12. {
  13.     int token_number;
  14.     while(token_number = yylex())
  15.         printf("\nyylex returns %d\n", token_number);
  16.     printf("\nyylex returns NULL\n");
  17. }
  18. %}
  19.  
  20. %%
  21. 'a'            {printf("yylex: a\n");   return(1);}
  22. 'A'            {printf("yylex: A\n");   return(2);}
  23. "b"            {printf("yylex: b\n");   return(3);}
  24. "B"            {printf("yylex: B\n");   return(4);}
  25. C            {printf("yylex: c\n");   return(5);}
  26. c        {printf("yylex: C\n");   return(6);}
  27. [ \n\t]    {printf("yylex: white space\n"); return(LEXSKIP);}
  28. .     {return(8);}
  29. %%
  30.  
  31. c        {printf("yylex: C\n");   return(6);}
  32. [ \n\t]    {printf("yylex: white space\n"); return(LEXSKIP);}
  33. .     {return(8);