home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 355_02 / slk2.exe / SPP / ENUM.H < prev    next >
Text File  |  1991-06-09  |  4KB  |  157 lines

  1. /*
  2.     New Sherlock preprocessor -- Header file for all enumerations.
  3.  
  4.     source:  enum.h
  5.     started: June 20, 1986
  6.     version: April 5, 1988
  7.         February 10, 1989 UNSIGNED_LONG and LONG_DOUBLE added.
  8.  
  9.  
  10.     PUBLIC DOMAIN SOFTWARE
  11.  
  12.     Sherlock, including the SPP, SDEL and SDIF programs, was placed in
  13.     the public domain on June 15, 1991, by its author,
  14.  
  15.         Edward K. Ream
  16.         166 North Prospect Ave.
  17.         Madison, WI 53705.
  18.         (608) 257-0802
  19.  
  20.     Sherlock may be used for any commercial or non-commercial purpose.
  21.  
  22.  
  23.     DISCLAIMER OF WARRANTIES
  24.  
  25.     Edward K. Ream (Ream) specifically disclaims all warranties,
  26.     expressed or implied, with respect to this computer software,
  27.     including but not limited to implied warranties of merchantability
  28.     and fitness for a particular purpose.  In no event shall Ream be
  29.     liable for any loss of profit or any commercial damage, including
  30.     but not limited to special, incidental consequential or other damages.
  31.     
  32.  
  33.     WARNING:  change the table in pr.c if any changes are made here.
  34. */
  35.  
  36. /*
  37.     ----------    PARSING    ----------
  38. */
  39.  
  40. /*
  41.     Enumerate the possible values of the "current scope"
  42. */
  43. typedef enum {NULL_SCOPE,
  44.     OUTER_SCOPE, OLD_FORMAL_SCOPE, NEW_FORMAL_SCOPE, STRUCT_SCOPE,
  45.     BLOCK_SCOPE
  46. } en_scope;
  47.  
  48. /*
  49.     Input Codes and Internal Operator Codes:
  50.     Type fields of parse nodes.
  51. */
  52. typedef enum /* en_tokens */ { NULL_TOK, ERR_TOK,
  53.  
  54. /*    start of key subenum.                */
  55. /*    kdecl subenum.                    */
  56.  
  57. K_AUTO,  K_CHAR, K_CONST, K_DOUBLE,  K_ENUM, K_EXTERN,
  58. K_FLOAT, K_INT, K_LONG, K_NOALIAS, K_REGISTER, K_SHORT,
  59. K_STATIC, K_TYPEDEF, K_SIGNED, K_STRUCT, K_UNION,
  60. K_UNSIGNED, K_VOID, K_VOLATILE,
  61.  
  62. /*    kcontrol subenum.                */
  63.  
  64. K_BREAK, K_CASE,
  65. K_CONTINUE, K_DEFAULT, K_DO, K_ELSE, K_FOR,
  66. K_GOTO, K_IF, K_RETURN, K_SWITCH, K_WHILE,
  67.  
  68. /*    Remainder of key subenum.            */
  69.  
  70. K_ENTRY, K_SIZEOF,
  71.  
  72. /*    Separator and grouping tokens.            */
  73. /*    Start of is_op subenum.                */
  74.  
  75. SEPARATOR_TOK, NL_TOK,
  76. SEMICOLON_TOK, LBRACK_TOK, LCURLY_TOK, LPAREN_TOK, RBRACK_TOK,
  77. RCURLY_TOK, RPAREN_TOK,
  78.  
  79. /*    is_ternop.                    */
  80.  
  81. COLON_TOK, QUESTION_TOK,
  82.  
  83. /*    Start of is_binop enum.                */
  84.  
  85. ARRAY_TOK, ARROW_TOK, DOT_TOK, LAND_TOK, LOR_TOK, COMMA_TOK,
  86.  
  87. /*    is_assnop subenum.                */
  88.  
  89. ASSN_TOK,
  90. AND_ASSN_TOK, DIV_ASSN_TOK, LSHIFT_ASSN_TOK, MINUS_ASSN_TOK, MOD_ASSN_TOK,
  91. OR_ASSN_TOK, PLUS_ASSN_TOK, RSHIFT_ASSN_TOK, STAR_ASSN_TOK, XOR_ASSN_TOK,
  92.  
  93. /*    is_aop, is_abelian  subenum.            */
  94.  
  95. AND_TOK, OR_TOK, PLUS_TOK, STAR_TOK, XOR_TOK,
  96.  
  97. DIV_TOK, LSHIFT_TOK, MINUS_TOK, MOD_TOK, RSHIFT_TOK,
  98.  
  99. /*     end of is_aop.                    */
  100.  
  101. /*    is_relop subenum.                */
  102. /*    Final entries of is_binop subenum.        */
  103.  
  104. EQUAL_TOK, GE_TOK, GT_TOK, LE_TOK, LT_TOK, NE_TOK,
  105.  
  106. /*    Unary operators returned by get_token().    */
  107.  
  108. DEC_TOK, INC_TOK,
  109.  
  110. /*    Start of is_unop subenum.            */
  111.  
  112. NOT_TOK, TILDE_TOK,
  113.  
  114. /*    Unary operators created by expr().        */
  115. /*    End of is_unop subenum.                */
  116.  
  117. CAST_TOK, POST_DEC_TOK, POST_INC_TOK, PRE_DEC_TOK, PRE_INC_TOK,
  118.  
  119. /*    Artificial unary operators; also is_unop    */
  120.  
  121. UAND_TOK, UMINUS_TOK, UPLUS_TOK, USTAR_TOK,
  122.  
  123. /*    Operators with variable operand count        */
  124. /*    Final entries in is_op subenum.            */
  125.  
  126. CALL_TOK,
  127.  
  128. /*    Class tokens.                    */
  129.  
  130. CHAR_TOK, EOP_TOK, ID_TOK, INT_TOK, FLOAT_TOK, LONG_TOK, STRING_TOK,
  131. UNSIGNED_LONG, LONG_DOUBLE,
  132.  
  133. /*    Miscellaneous tokens            */
  134.  
  135. DOTS3, LABEL_TOK, K_BOOL
  136.  
  137. } en_tokens;
  138.  
  139. #define LAST_ENUM_TOK K_BOOL
  140.  
  141. /*
  142.     Most of the unary operators are specials generated in the parser.
  143.     Only NOT_TOK and TILDE_TOK are unambiguously unary.
  144. */
  145. #define is_kdecl(n)    (n >= K_AUTO    && n <= K_VOLATILE)
  146. #define is_kcontrol(n)    (n >= K_BREAK    && n <= K_WHILE)
  147. #define is_key(n)    (n >= K_AUTO    && n <= K_SIZEOF)
  148.  
  149. #define is_op(n)    (n >= SEPARATOR_TOK    && n <= CALL_TOK)
  150. #define is_binop(n)    (n >= ARRAY_TOK    && n <= NE_TOK)
  151. #define is_assnop(n)    (n >= ASSN_TOK    && n <= XOR_ASSN_TOK)
  152. #define is_abelian(n)    (n >= AND_TOK    && n <= XOR_TOK)
  153. #define is_aop(n)    (n >= AND_TOK    && n <= RSHIFT_TOK)
  154. #define is_relop(n)    (n >= EQUAL_TOK    && n <= NE_TOK)
  155. #define is_unop(n)    (n >= NOT_TOK    && n <= USTAR_TOK)
  156. #define is_argop(n)    (n >= COLON_TOK && n <= CALL_TOK)
  157.