/* -*- Mode: C -*- Begin node_classes.H */
/*
	$Source: /usr3/lang/benson/work/stripped_cfront/RCS/node_classes.H,v $ $RCSfile: node_classes.H,v $
	$Revision: 1.1 $		$Date: 89/11/20 08:50:41 $
	$Author: benson $		$Locker:  $
	$State: Exp $
*/

#ifndef _node_classes
#define _node_classes

enum discriminator_error {
    discrim_none_valid = 0,
    discrim_bad_index = -1,
    discrim_inconsistent_node = -2,
};

enum node_class {
    nc_unused = 0,
    nc_eof = 1,
    nc_virt = 2,
    nc_nlist = 3,
    nc_gen = 4,
    nc_vec = 5,
    nc_ptr = 6,
    nc_fct = 7,
    nc_table = 8,
    nc_basetype = 9,
    nc_name = 10,
    nc_expr = 11,
    nc_stmt = 12,
    nc_enumdef = 13,
    nc_classdef = 14,
    nc_baseclass = 15,
    nc_iline = 16,
    nc_ia = 17,
};
    
/* searching this is slower than a directly indexed array,
   but this is more maintainable. We can speed it up later. */

#ifdef DEFINE_TOKEN_CLASS_TABLE
struct token_class {
    TOK token;
    node_class nclass;
} token_classes[] = {
    { EOFTOK, nc_eof },
    { ASM, nc_stmt },
    { AUTO, nc_basetype },
    { BREAK, nc_stmt },
    { CASE, nc_stmt },
    { CHAR, nc_basetype },
    { CLASS, nc_classdef },
    { CONTINUE, nc_stmt },
    { DEFAULT, nc_stmt },
    { DELETE, nc_expr },
    { DO, nc_stmt },
    { DOUBLE, nc_basetype },
    { ELSE, nc_stmt },
    { ENUM, nc_enumdef },
    { EXTERN, nc_basetype },
    { FLOAT, nc_basetype },
    { FOR, nc_stmt },
    { FORTRAN, nc_unused },
    { FRIEND, nc_basetype },
    { GOTO, nc_stmt },
    { IF, nc_stmt },
    { INT, nc_basetype },
    { LONG, nc_basetype },
    { NEW, nc_expr },
    { OPERATOR, nc_fct },
    { RETURN, nc_stmt },
    { PUBLIC, nc_name },
    { CONST, nc_basetype },
    { REGISTER, nc_basetype },
    { RETURN, nc_stmt },
    { SHORT, nc_basetype },
    { SIZEOF, nc_expr },
    { STATIC, nc_basetype },
    { STRUCT, nc_unused },
    { SWITCH, nc_stmt },
    { THIS, nc_expr },
    { TYPEDEF, nc_basetype },
    { UNION, nc_unused },
    { UNSIGNED, nc_basetype },
    { VOID, nc_basetype },
    { WHILE, nc_stmt },
    { LP, nc_unused },
    { RP, nc_unused },
    { LB, nc_unused },
    { RB, nc_unused },
    { REF, nc_expr },
    { DOT, nc_expr },
    { NOT, nc_expr },
    { COMPL, nc_expr },
    { INCR, nc_expr },
    { DECR, nc_expr },
    { MUL, nc_expr },
    { DIV, nc_expr },
    { AND, nc_expr },
    { MOD, nc_expr },
    { PLUS, nc_expr },
    { MINUS, nc_expr },
    { LS, nc_expr },
    { RS, nc_expr },
    { LT, nc_expr },
    { LE, nc_expr },
    { GT, nc_expr },
    { GE, nc_expr },
    { EQ, nc_expr },
    { NE, nc_expr },
    { ER, nc_expr },
    { OR, nc_expr },
    { ANDAND, nc_expr },
    { OROR, nc_expr },
    { QUEST, nc_expr },
    { COLON, nc_unused },
    { ASSIGN, nc_expr },
    { CM, nc_expr },
    { SM, nc_stmt },
    { SM_PARAM, nc_stmt },
    { LC, nc_unused },
    { RC, nc_unused },
    { INLINE, nc_fct },
    { OVERLOAD, nc_gen },
    { VIRTUAL, nc_fct },	/* but might be a basecl */
    { COERCE, nc_unused },
    { PROTECTED, nc_name },
    { ID, nc_unused },
    { STRING, nc_expr },
    { ICON, nc_expr },
    { FCON, nc_expr },
    { CCON, nc_expr },
    { NAME, nc_name },		/* but might be basecl */
    { ZERO, nc_expr },
    { ICTOR, nc_unused },
    { IDTOR, nc_unused },
    { ASOP, nc_expr },
    { RELOP, nc_expr },
    { EQUOP, nc_expr },
    { DIVOP, nc_expr },
    { SHIFTOP, nc_expr },
    { ICOP, nc_expr },
    { UNOP, nc_expr },
    { TYPE, nc_basetype },
    { UMINUS, nc_expr },
    { FCT, nc_fct },
    { CALL, nc_expr },
    { VEC, nc_vec },
    { DEREF, nc_expr },
    { ADDROF, nc_expr },
    { CAST, nc_expr },
    { FIELD, nc_basetype },
    { LABEL, nc_stmt },
    { BLOCK, nc_stmt },
    { DCL, nc_stmt },
    { QUA, nc_unused },
    { COBJ, nc_basetype },
    { EOBJ, nc_basetype },
    { TNAME, nc_name },
    { ILIST, nc_expr },
    { PTR, nc_ptr },
    { ASPLUS, nc_expr },
    { ASMINUS, nc_expr },
    { ASMUL, nc_expr },
    { ASDIV, nc_expr },
    { ASMOD, nc_expr },
    { ASAND, nc_expr },
    { ASOR, nc_expr },
    { ASER, nc_expr },
    { ASLS, nc_expr },
    { ASRS, nc_expr },    
    { ARG, nc_basetype },
    { KNOWN, nc_unused },
    { ZTYPE, nc_basetype },
    { ARGT, nc_basetype },
    { ELIST, nc_expr },
    { ANY, nc_basetype },
    { TABLE, nc_table },
    { LOC, nc_unused },
    { DUMMY, nc_expr },
    { G_ADDROF, nc_expr },
    { G_CALL, nc_expr },
    { G_CM, nc_expr },
    { IVAL, nc_expr },
    { FVAL, nc_expr },
    { LVAL, nc_expr },
    { ELLIPSIS, nc_unused },
    { AGGR, nc_unused },
    { RPTR, nc_ptr },
    { HIDDEN, nc_unused },
    { MEM, nc_expr },
    { CTOR, nc_unused },
    { DTOR, nc_unused },
    { CONST_PTR, nc_ptr },
    { CONST_RPTR, nc_ptr },
    { TEXT, nc_expr },
    { PAIR, nc_stmt },
    { ANON, nc_unused },
    { ICALL, nc_expr },
    { ANAME, nc_expr },
    { VOLATILE, nc_basetype },
    { SIGNED, nc_basetype },
    { UPLUS, nc_expr },
    { MEMPTR, nc_unused },
    { PRIVATE, nc_name },
    { PR, nc_unused },
    { MDOT, nc_expr },
    { TSCOPE, nc_unused },
    { DECL_MARKER, nc_unused },
    { REFMUL, nc_expr },
    { LDOUBLE, nc_basetype },
    { LINKAGE, nc_unused },
    { LOCAL, nc_basetype },
    { GNEW, nc_expr },
    { TEMPLATE, nc_unused },
    { STAT_INIT, nc_unused },
    { CATCH, nc_unused },
    { GDELETE, nc_expr },
    { CONVERT, nc_unused },
    { XVIRT, nc_virt },
    { XNLIST, nc_nlist },
    { XILINE, nc_iline },
    { XIA, nc_ia },
    { VALUE, nc_expr },
    { XDELETED_NODE, nc_unused },
};
#endif


node_class classify_node (Pnode, int&);
node_class classify_node (Pnode);

#endif

/* End node_classes.H */

/*
   $Log:	node_classes.H,v $
Revision 1.1  89/11/20  08:50:41  benson
Initial revision

Revision 1.6  89/10/10  08:41:43  benson
add missing entries.

Revision 1.5  89/10/05  11:40:50  benson
add declaration of the one-arg form of classify_node.



   end_log
*/
