ag-char-map.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * Character mapping generated 12/31/08 19:07:31
  3. *
  4. * This file contains the character classifications
  5. * used by AutoGen and AutoOpts for identifying tokens.
  6. */
  7. #ifndef AG_CHAR_MAP_H_GUARD
  8. #define AG_CHAR_MAP_H_GUARD 1
  9. #ifdef HAVE_CONFIG_H
  10. # if defined(HAVE_INTTYPES_H)
  11. # include <inttypes.h>
  12. # elif defined(HAVE_STDINT_H)
  13. # include <stdint.h>
  14. # else
  15. # error "no int-types header."
  16. # choke-me-now.
  17. # endif
  18. #else
  19. # ifdef __sun
  20. # include <inttypes.h>
  21. # else
  22. # include <stdint.h>
  23. # endif
  24. #endif
  25. #if 0 /* mapping specification source (from autogen.map) */
  26. //
  27. // %guard autoopts_internal
  28. // %file ag-char-map.h
  29. // %table opt-char-cat
  30. //
  31. // %comment
  32. // This file contains the character classifications
  33. // used by AutoGen and AutoOpts for identifying tokens.
  34. // %
  35. //
  36. // lower-case "a-z"
  37. // upper-case "A-Z"
  38. // alphabetic +lower-case +upper-case
  39. // oct-digit "0-7"
  40. // dec-digit "89" +oct-digit
  41. // hex-digit "a-fA-F" +dec-digit
  42. // alphanumeric +alphabetic +dec-digit
  43. // var-first "_" +alphabetic
  44. // variable-name +var-first +dec-digit
  45. // option-name "^-" +variable-name
  46. // value-name ":" +option-name
  47. // horiz-white "\t "
  48. // compound-name "[.]" +value-name +horiz-white
  49. // whitespace "\v\f\r\n\b" +horiz-white
  50. // unquotable "!-~" -"\"#(),;<=>[\\]`{}?*'"
  51. // end-xml-token "/>" +whitespace
  52. // graphic "!-~"
  53. // plus-n-space "+" +whitespace
  54. // punctuation "!-~" -alphanumeric -"_"
  55. // suffix "-._" +alphanumeric
  56. // suffix-fmt "%/" +suffix
  57. // false-type "nNfF0\x00"
  58. //
  59. #endif /* 0 -- mapping spec. source */
  60. typedef uint32_t opt_char_cat_mask_t;
  61. extern opt_char_cat_mask_t const opt_char_cat[128];
  62. static inline int is_opt_char_cat_char(char ch, opt_char_cat_mask_t mask) {
  63. unsigned int ix = (unsigned char)ch;
  64. return ((ix < 0x7F) && ((opt_char_cat[ix] & mask) != 0)); }
  65. #define IS_LOWER_CASE_CHAR(_c) is_opt_char_cat_char((_c), 0x00001)
  66. #define IS_UPPER_CASE_CHAR(_c) is_opt_char_cat_char((_c), 0x00002)
  67. #define IS_ALPHABETIC_CHAR(_c) is_opt_char_cat_char((_c), 0x00003)
  68. #define IS_OCT_DIGIT_CHAR(_c) is_opt_char_cat_char((_c), 0x00004)
  69. #define IS_DEC_DIGIT_CHAR(_c) is_opt_char_cat_char((_c), 0x0000C)
  70. #define IS_HEX_DIGIT_CHAR(_c) is_opt_char_cat_char((_c), 0x0001C)
  71. #define IS_ALPHANUMERIC_CHAR(_c) is_opt_char_cat_char((_c), 0x0000F)
  72. #define IS_VAR_FIRST_CHAR(_c) is_opt_char_cat_char((_c), 0x00023)
  73. #define IS_VARIABLE_NAME_CHAR(_c) is_opt_char_cat_char((_c), 0x0002F)
  74. #define IS_OPTION_NAME_CHAR(_c) is_opt_char_cat_char((_c), 0x0006F)
  75. #define IS_VALUE_NAME_CHAR(_c) is_opt_char_cat_char((_c), 0x000EF)
  76. #define IS_HORIZ_WHITE_CHAR(_c) is_opt_char_cat_char((_c), 0x00100)
  77. #define IS_COMPOUND_NAME_CHAR(_c) is_opt_char_cat_char((_c), 0x003EF)
  78. #define IS_WHITESPACE_CHAR(_c) is_opt_char_cat_char((_c), 0x00500)
  79. #define IS_UNQUOTABLE_CHAR(_c) is_opt_char_cat_char((_c), 0x00800)
  80. #define IS_END_XML_TOKEN_CHAR(_c) is_opt_char_cat_char((_c), 0x01500)
  81. #define IS_GRAPHIC_CHAR(_c) is_opt_char_cat_char((_c), 0x02000)
  82. #define IS_PLUS_N_SPACE_CHAR(_c) is_opt_char_cat_char((_c), 0x04500)
  83. #define IS_PUNCTUATION_CHAR(_c) is_opt_char_cat_char((_c), 0x08000)
  84. #define IS_SUFFIX_CHAR(_c) is_opt_char_cat_char((_c), 0x1000F)
  85. #define IS_SUFFIX_FMT_CHAR(_c) is_opt_char_cat_char((_c), 0x3000F)
  86. #define IS_FALSE_TYPE_CHAR(_c) is_opt_char_cat_char((_c), 0x40000)
  87. #ifdef AUTOOPTS_INTERNAL
  88. opt_char_cat_mask_t const opt_char_cat[128] = {
  89. /*x00*/ 0x40000, /*x01*/ 0x00000, /*x02*/ 0x00000, /*x03*/ 0x00000,
  90. /*x04*/ 0x00000, /*x05*/ 0x00000, /*x06*/ 0x00000, /*\a */ 0x00000,
  91. /*\b */ 0x00400, /*\t */ 0x00100, /*\n */ 0x00400, /*\v */ 0x00400,
  92. /*\f */ 0x00400, /*\r */ 0x00400, /*x0E*/ 0x00000, /*x0F*/ 0x00000,
  93. /*x10*/ 0x00000, /*x11*/ 0x00000, /*x12*/ 0x00000, /*x13*/ 0x00000,
  94. /*x14*/ 0x00000, /*x15*/ 0x00000, /*x16*/ 0x00000, /*x17*/ 0x00000,
  95. /*x18*/ 0x00000, /*x19*/ 0x00000, /*x1A*/ 0x00000, /*x1B*/ 0x00000,
  96. /*x1C*/ 0x00000, /*x1D*/ 0x00000, /*x1E*/ 0x00000, /*x1F*/ 0x00000,
  97. /* */ 0x00100, /* ! */ 0x0A800, /* " */ 0x0A000, /* # */ 0x0A000,
  98. /* $ */ 0x0A800, /* % */ 0x2A800, /* & */ 0x0A800, /* ' */ 0x0A000,
  99. /* ( */ 0x0A000, /* ) */ 0x0A000, /* * */ 0x0A000, /* + */ 0x0E800,
  100. /* , */ 0x0A000, /* - */ 0x1A840, /* . */ 0x1AA00, /* / */ 0x2B800,
  101. /* 0 */ 0x42804, /* 1 */ 0x02804, /* 2 */ 0x02804, /* 3 */ 0x02804,
  102. /* 4 */ 0x02804, /* 5 */ 0x02804, /* 6 */ 0x02804, /* 7 */ 0x02804,
  103. /* 8 */ 0x02808, /* 9 */ 0x02808, /* : */ 0x0A880, /* ; */ 0x0A000,
  104. /* < */ 0x0A000, /* = */ 0x0A000, /* > */ 0x0B000, /* ? */ 0x0A000,
  105. /* @ */ 0x0A800, /* A */ 0x02812, /* B */ 0x02812, /* C */ 0x02812,
  106. /* D */ 0x02812, /* E */ 0x02812, /* F */ 0x42812, /* G */ 0x02802,
  107. /* H */ 0x02802, /* I */ 0x02802, /* J */ 0x02802, /* K */ 0x02802,
  108. /* L */ 0x02802, /* M */ 0x02802, /* N */ 0x42802, /* O */ 0x02802,
  109. /* P */ 0x02802, /* Q */ 0x02802, /* R */ 0x02802, /* S */ 0x02802,
  110. /* T */ 0x02802, /* U */ 0x02802, /* V */ 0x02802, /* W */ 0x02802,
  111. /* X */ 0x02802, /* Y */ 0x02802, /* Z */ 0x02802, /* [ */ 0x0A200,
  112. /* \ */ 0x0A000, /* ] */ 0x0A200, /* ^ */ 0x0A840, /* _ */ 0x12820,
  113. /* ` */ 0x0A000, /* a */ 0x02811, /* b */ 0x02811, /* c */ 0x02811,
  114. /* d */ 0x02811, /* e */ 0x02811, /* f */ 0x42811, /* g */ 0x02801,
  115. /* h */ 0x02801, /* i */ 0x02801, /* j */ 0x02801, /* k */ 0x02801,
  116. /* l */ 0x02801, /* m */ 0x02801, /* n */ 0x42801, /* o */ 0x02801,
  117. /* p */ 0x02801, /* q */ 0x02801, /* r */ 0x02801, /* s */ 0x02801,
  118. /* t */ 0x02801, /* u */ 0x02801, /* v */ 0x02801, /* w */ 0x02801,
  119. /* x */ 0x02801, /* y */ 0x02801, /* z */ 0x02801, /* { */ 0x0A000,
  120. /* | */ 0x0A800, /* } */ 0x0A000, /* ~ */ 0x0A800, /*x7F*/ 0x00000
  121. };
  122. #endif /* AUTOOPTS_INTERNAL */
  123. #endif /* AG_CHAR_MAP_H_GUARD */