00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef RUBY_ID_H
00014 #define RUBY_ID_H
00015
00016 #define ID_SCOPE_SHIFT 3
00017 #define ID_SCOPE_MASK 0x07
00018 #define ID_LOCAL 0x00
00019 #define ID_INSTANCE 0x01
00020 #define ID_GLOBAL 0x03
00021 #define ID_ATTRSET 0x04
00022 #define ID_CONST 0x05
00023 #define ID_CLASS 0x06
00024 #define ID_JUNK 0x07
00025 #define ID_INTERNAL ID_JUNK
00026
00027 #ifdef USE_PARSE_H
00028 #include "parse.h"
00029 #endif
00030
00031 #include "vm_opts.h"
00032
00033 #define symIFUNC ID2SYM(idIFUNC)
00034 #define symCFUNC ID2SYM(idCFUNC)
00035
00036 #if !defined tLAST_TOKEN && defined YYTOKENTYPE
00037 #define tLAST_TOKEN tLAST_TOKEN
00038 #endif
00039
00040 enum ruby_method_ids {
00041 #ifndef tLAST_TOKEN
00042 tUPLUS = 321,
00043 tUMINUS = 322,
00044 tPOW = 323,
00045 tCMP = 324,
00046 tEQ = 325,
00047 tEQQ = 326,
00048 tNEQ = 327,
00049 tGEQ = 328,
00050 tLEQ = 329,
00051 tANDOP = 330,
00052 tOROP = 331,
00053 tMATCH = 332,
00054 tNMATCH = 333,
00055 tDOT2 = 334,
00056 tDOT3 = 335,
00057 tAREF = 336,
00058 tASET = 337,
00059 tLSHFT = 338,
00060 tRSHFT = 339,
00061 tLAMBDA = 352,
00062 idNULL = 365,
00063 idRespond_to = 366,
00064 idIFUNC = 367,
00065 idCFUNC = 368,
00066 id_core_set_method_alias = 369,
00067 id_core_set_variable_alias = 370,
00068 id_core_undef_method = 371,
00069 id_core_define_method = 372,
00070 id_core_define_singleton_method = 373,
00071 id_core_set_postexe = 374,
00072 tLAST_TOKEN = 375,
00073 #endif
00074 idDot2 = tDOT2,
00075 idDot3 = tDOT3,
00076 idUPlus = tUPLUS,
00077 idUMinus = tUMINUS,
00078 idPow = tPOW,
00079 idCmp = tCMP,
00080 idPLUS = '+',
00081 idMINUS = '-',
00082 idMULT = '*',
00083 idDIV = '/',
00084 idMOD = '%',
00085 idLT = '<',
00086 idLTLT = tLSHFT,
00087 idLE = tLEQ,
00088 idGT = '>',
00089 idGE = tGEQ,
00090 idEq = tEQ,
00091 idEqq = tEQQ,
00092 idNeq = tNEQ,
00093 idNot = '!',
00094 idBackquote = '`',
00095 idEqTilde = tMATCH,
00096 idNeqTilde = tNMATCH,
00097 idAREF = tAREF,
00098 idASET = tASET,
00099 idLAST_TOKEN = tLAST_TOKEN >> ID_SCOPE_SHIFT,
00100 tIntern,
00101 tMethodMissing,
00102 tLength,
00103 tSize,
00104 tGets,
00105 tSucc,
00106 tEach,
00107 tProc,
00108 tLambda,
00109 tSend,
00110 t__send__,
00111 tInitialize,
00112 tUScore,
00113 #if SUPPORT_JOKE
00114 tBitblt,
00115 tAnswer,
00116 #endif
00117 tLAST_ID,
00118 #define TOKEN2ID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_LOCAL)
00119 #if SUPPORT_JOKE
00120 TOKEN2ID(Bitblt),
00121 TOKEN2ID(Answer),
00122 #endif
00123 TOKEN2ID(Intern),
00124 TOKEN2ID(MethodMissing),
00125 TOKEN2ID(Length),
00126 TOKEN2ID(Size),
00127 TOKEN2ID(Gets),
00128 TOKEN2ID(Succ),
00129 TOKEN2ID(Each),
00130 TOKEN2ID(Proc),
00131 TOKEN2ID(Lambda),
00132 TOKEN2ID(Send),
00133 TOKEN2ID(__send__),
00134 TOKEN2ID(Initialize),
00135 TOKEN2ID(UScore),
00136 TOKEN2ID(LAST_ID)
00137 };
00138
00139 #ifdef tLAST_TOKEN
00140 struct ruby_method_ids_check {
00141 #define ruby_method_id_check_for(name, value) \
00142 int checking_for_##name[name == (value) ? 1 : -1]
00143 ruby_method_id_check_for(tUPLUS, 321);
00144 ruby_method_id_check_for(tUMINUS, 322);
00145 ruby_method_id_check_for(tPOW, 323);
00146 ruby_method_id_check_for(tCMP, 324);
00147 ruby_method_id_check_for(tEQ, 325);
00148 ruby_method_id_check_for(tEQQ, 326);
00149 ruby_method_id_check_for(tNEQ, 327);
00150 ruby_method_id_check_for(tGEQ, 328);
00151 ruby_method_id_check_for(tLEQ, 329);
00152 ruby_method_id_check_for(tANDOP, 330);
00153 ruby_method_id_check_for(tOROP, 331);
00154 ruby_method_id_check_for(tMATCH, 332);
00155 ruby_method_id_check_for(tNMATCH, 333);
00156 ruby_method_id_check_for(tDOT2, 334);
00157 ruby_method_id_check_for(tDOT3, 335);
00158 ruby_method_id_check_for(tAREF, 336);
00159 ruby_method_id_check_for(tASET, 337);
00160 ruby_method_id_check_for(tLSHFT, 338);
00161 ruby_method_id_check_for(tRSHFT, 339);
00162 ruby_method_id_check_for(tLAMBDA, 352);
00163 ruby_method_id_check_for(idNULL, 365);
00164 ruby_method_id_check_for(idRespond_to, 366);
00165 ruby_method_id_check_for(idIFUNC, 367);
00166 ruby_method_id_check_for(idCFUNC, 368);
00167 ruby_method_id_check_for(id_core_set_method_alias, 369);
00168 ruby_method_id_check_for(id_core_set_variable_alias, 370);
00169 ruby_method_id_check_for(id_core_undef_method, 371);
00170 ruby_method_id_check_for(id_core_define_method, 372);
00171 ruby_method_id_check_for(id_core_define_singleton_method, 373);
00172 ruby_method_id_check_for(id_core_set_postexe, 374);
00173 ruby_method_id_check_for(tLAST_TOKEN, 375);
00174 };
00175 #endif
00176
00177 #endif
00178