Define null symbol

parent 3248de83
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
MRB_BEGIN_DECL MRB_BEGIN_DECL
typedef enum mrb_reserved_symbol { typedef enum mrb_reserved_symbol {
mrb_sym_null = 0, // NULL symbol
mrb_sym_add = 1, // + mrb_sym_add = 1, // +
mrb_sym_sub = 2, // - mrb_sym_sub = 2, // -
mrb_sym_mul = 3, // * mrb_sym_mul = 3, // *
......
...@@ -187,7 +187,7 @@ static struct reserved_symbol_t reserved_symbols[] = { ...@@ -187,7 +187,7 @@ static struct reserved_symbol_t reserved_symbols[] = {
{ mrb_sym_gt, ">" }, { mrb_sym_gt, ">" },
{ mrb_sym_ge, ">=" }, { mrb_sym_ge, ">=" },
{ mrb_sym_method_missing, "method_missing" }, { mrb_sym_method_missing, "method_missing" },
{ 0, NULL }, { mrb_sym_null, NULL },
}; };
void void
...@@ -196,7 +196,7 @@ mrb_init_symtbl(mrb_state *mrb) ...@@ -196,7 +196,7 @@ mrb_init_symtbl(mrb_state *mrb)
int i; int i;
mrb->name2sym = kh_init(n2s, mrb); mrb->name2sym = kh_init(n2s, mrb);
for (i = 0; reserved_symbols[i].sym != 0; ++i) { for (i = 0; reserved_symbols[i].sym != mrb_sym_null; ++i) {
mrb_sym s = mrb_intern_static(mrb, reserved_symbols[i].str, strlen(reserved_symbols[i].str)); mrb_sym s = mrb_intern_static(mrb, reserved_symbols[i].str, strlen(reserved_symbols[i].str));
mrb_assert(s == reserved_symbols[i].sym); mrb_assert(s == reserved_symbols[i].sym);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment