home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / slacksrce / d / libc / libc-4.6 / libc-4 / libc-linux / locale / numeric / parse.y < prev   
Encoding:
Lex Description  |  1994-03-12  |  744 b   |  56 lines

  1. %{
  2.  
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include <locale.h>
  6. #include <localeinfo.h>
  7.  
  8. #include "mknumeric.h"
  9.  
  10. extern unsigned char *codename;
  11.  
  12. %}
  13.  
  14. %union {
  15.     int number;
  16.     unsigned char *str;
  17. };
  18.  
  19. %token            CODESET
  20.  
  21. %token    <str>        CODENAME
  22. %token    <str>        STRING
  23.  
  24. %token        DECIMAL_POINT
  25. %token        GROUPING
  26. %token        THOUSANDS_SEP
  27.  
  28. %%
  29.  
  30. statements    : codeset descriptions
  31.         ;
  32.  
  33. descriptions    : desc
  34.         | descriptions desc
  35.         ;
  36.  
  37. codeset        : CODESET CODENAME {
  38.                 codename = $2;
  39.             }
  40.         ;
  41.  
  42. desc        : DECIMAL_POINT STRING {
  43.                 if(strlen($2) == 0) {
  44.                     yyerror("zero length decimal_point");
  45.                     YYERROR;
  46.                 }
  47.                 ninfo.decimal_point = $2;
  48.             }
  49.         | THOUSANDS_SEP STRING {
  50.                 ninfo.thousands_sep = $2;
  51.             }
  52.         | GROUPING STRING {
  53.                 ninfo.grouping = $2;
  54.             }
  55.         ;
  56.