summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mruby/ops.h22
-rw-r--r--include/mruby/symbol.h40
2 files changed, 51 insertions, 11 deletions
diff --git a/include/mruby/ops.h b/include/mruby/ops.h
index f23bb1b0b..7531a5ee2 100644
--- a/include/mruby/ops.h
+++ b/include/mruby/ops.h
@@ -70,17 +70,17 @@ OPCODE(RETURN, B) /* return R(a) (normal) */
OPCODE(RETURN_BLK, B) /* return R(a) (in-block return) */
OPCODE(BREAK, B) /* break R(a) */
OPCODE(BLKPUSH, BS) /* R(a) = block (16=m5:r1:m5:d1:lv4) */
-OPCODE(ADD, BB) /* R(a) = R(a)+R(a+1) (Syms[b]=:+) */
-OPCODE(ADDI, BBB) /* R(a) = R(a)+mrb_int(c) (Syms[b]=:+) */
-OPCODE(SUB, BB) /* R(a) = R(a)-R(a+1) (Syms[b]=:-) */
-OPCODE(SUBI, BBB) /* R(a) = R(a)-C (Syms[b]=:-) */
-OPCODE(MUL, BB) /* R(a) = R(a)*R(a+1) (Syms[b]=:*) */
-OPCODE(DIV, BB) /* R(a) = R(a)/R(a+1) (Syms[b]=:/) */
-OPCODE(EQ, BB) /* R(a) = R(a)==R(a+1) (Syms[b]=:==) */
-OPCODE(LT, BB) /* R(a) = R(a)<R(a+1) (Syms[b]=:<) */
-OPCODE(LE, BB) /* R(a) = R(a)<=R(a+1) (Syms[b]=:<=) */
-OPCODE(GT, BB) /* R(a) = R(a)>R(a+1) (Syms[b]=:>) */
-OPCODE(GE, BB) /* R(a) = R(a)>=R(a+1) (Syms[b]=:>=) */
+OPCODE(ADD, B) /* R(a) = R(a)+R(a+1) */
+OPCODE(ADDI, BB) /* R(a) = R(a)+mrb_int(c) */
+OPCODE(SUB, B) /* R(a) = R(a)-R(a+1) */
+OPCODE(SUBI, BB) /* R(a) = R(a)-C */
+OPCODE(MUL, B) /* R(a) = R(a)*R(a+1) */
+OPCODE(DIV, B) /* R(a) = R(a)/R(a+1) */
+OPCODE(EQ, B) /* R(a) = R(a)==R(a+1) */
+OPCODE(LT, B) /* R(a) = R(a)<R(a+1) */
+OPCODE(LE, B) /* R(a) = R(a)<=R(a+1) */
+OPCODE(GT, B) /* R(a) = R(a)>R(a+1) */
+OPCODE(GE, B) /* R(a) = R(a)>=R(a+1) */
OPCODE(ARRAY, BB) /* R(a) = ary_new(R(a),R(a+1)..R(a+b)) */
OPCODE(ARRAY2, BBB) /* R(a) = ary_new(R(b),R(b+1)..R(b+c)) */
OPCODE(ARYCAT, B) /* ary_cat(R(a),R(a+1)) */
diff --git a/include/mruby/symbol.h b/include/mruby/symbol.h
new file mode 100644
index 000000000..b0feccc51
--- /dev/null
+++ b/include/mruby/symbol.h
@@ -0,0 +1,40 @@
+/*
+** mruby/symbol.h - symbol utilities
+**
+** See Copyright Notice in mruby.h
+*/
+
+#ifndef MRUBY_SYMBOL_H
+#define MRUBY_SYMBOL_H
+
+#include "common.h"
+
+/**
+ * Symbol utilities
+ */
+MRB_BEGIN_DECL
+
+typedef enum mrb_reserved_symbol {
+ mrb_sym_null = 0, // NULL symbol
+
+ mrb_sym_add = 1, // +
+ mrb_sym_sub = 2, // -
+ mrb_sym_mul = 3, // *
+ mrb_sym_div = 4, // /
+ mrb_sym_eq = 5, // ==
+ mrb_sym_lt = 6, // <
+ mrb_sym_le = 7, // <=
+ mrb_sym_gt = 8, // >
+ mrb_sym_ge = 9, // >=
+
+ mrb_sym_method_missing = 10, // method_missing
+} mrb_reserved_symbol;
+
+static inline mrb_bool
+mrb_symbol_constsym_send_p(mrb_sym sym) {
+ return mrb_sym_add <= sym && sym <= mrb_sym_ge;
+}
+
+MRB_END_DECL
+
+#endif /* MRUBY_SYMBOL_H */