cast 0.0.1 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,29 @@
1
+ require 'ritual'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(test: [:ext, 'lib/cast/c.tab.rb']) do |t|
5
+ t.libs << "test"
6
+ t.test_files = FileList['test/*_test.rb']
7
+ t.warning = false
8
+ end
9
+
10
+ extension
11
+
12
+ file 'ext/cast.so' => FileList['ext/*.c', 'ext/yylex.c'] do |t|
13
+ FileUtils.cd 'ext' do
14
+ ruby 'extconf.rb'
15
+ sh 'make'
16
+ end
17
+ end
18
+
19
+ file 'ext/yylex.c' => 'ext/yylex.re' do |t|
20
+ sh "re2c #{t.prerequisites[0]} > #{t.name}"
21
+ end
22
+
23
+ file 'lib/cast/c.tab.rb' => 'lib/cast/c.y' do |t|
24
+ sh "racc #{t.prerequisites[0]}"
25
+ end
26
+
27
+ task :ext => 'ext/yylex.c'
28
+ task 'gem:build' => ['ext/yylex.c', 'lib/cast/c.tab.rb']
29
+ CLEAN.include('ext/yylex.c', 'lib/cast/c.tab.rb')
@@ -0,0 +1,18 @@
1
+ $:.unshift File.expand_path('lib', File.dirname(__FILE__))
2
+ require 'cast/version'
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = 'cast'
6
+ gem.version = C::VERSION
7
+ gem.authors = ["George Ogata"]
8
+ gem.email = ["george.ogata@gmail.com"]
9
+ gem.license = 'MIT'
10
+ gem.date = Time.now.strftime('%Y-%m-%d')
11
+ gem.summary = "C parser and AST constructor."
12
+ gem.homepage = 'http://github.com/oggy/cast'
13
+
14
+ gem.extensions = ["ext/extconf.rb"]
15
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
16
+ gem.files = `git ls-files`.split("\n") + ['ext/yylex.c', 'lib/cast/c.tab.rb']
17
+ gem.test_files = `git ls-files -- test/*`.split("\n")
18
+ end
@@ -0,0 +1,6 @@
1
+ #include "cast.h"
2
+
3
+ void Init_cast(void) {
4
+ cast_mC = rb_define_module("C");
5
+ cast_init_parser();
6
+ }
@@ -0,0 +1,141 @@
1
+ #include <assert.h>
2
+ #include "ruby.h"
3
+
4
+ /* Modules and classes.
5
+ */
6
+ extern VALUE cast_mC;
7
+ extern VALUE cast_cParser;
8
+ extern VALUE cast_eParseError;
9
+
10
+ /*
11
+ * -------------------------------------------------------------------
12
+ * Helpers
13
+ * -------------------------------------------------------------------
14
+ */
15
+
16
+ #define Get_Struct(value, type, sval) do { \
17
+ sval = (cast_##type *)DATA_PTR(value); \
18
+ } while (0)
19
+
20
+ #define Find_Struct(value, type, sval) do { \
21
+ if (!rb_obj_is_kind_of(value, cast_c##type)) \
22
+ rb_raise(rb_eTypeError, #type " expected, got %s", rb_obj_classname(value)); \
23
+ sval = (cast_##type *)DATA_PTR(value); \
24
+ } while (0)
25
+
26
+ #define Wrap_Struct(ptr, type, klass) \
27
+ Data_Wrap_Struct(klass, cast_##type##_mark, cast_##type##_free, ptr)
28
+
29
+ /*
30
+ * -------------------------------------------------------------------
31
+ * Parser
32
+ * -------------------------------------------------------------------
33
+ */
34
+
35
+ typedef struct {
36
+ /* stuff used by yylex */
37
+ char *bot, *tok, *ptr, *cur, *pos, *lim, *top, *eof;
38
+ long lineno; /* line number */
39
+ VALUE token; /* last token (2-element array) */
40
+ } cast_Parser;
41
+
42
+ VALUE cast_Parser_alloc(VALUE klass);
43
+ void cast_Parser_mark(cast_Parser *parser);
44
+ void cast_Parser_free(cast_Parser *parser);
45
+ VALUE cast_Parser_next_token(VALUE self);
46
+ void yylex(VALUE self, cast_Parser *p);
47
+ void cast_init_parser(void);
48
+
49
+ /* Lexer symbols. */
50
+ extern VALUE cast_sym_AUTO;
51
+ extern VALUE cast_sym_BREAK;
52
+ extern VALUE cast_sym_CASE;
53
+ extern VALUE cast_sym_CHAR;
54
+ extern VALUE cast_sym_CONST;
55
+ extern VALUE cast_sym_CONTINUE;
56
+ extern VALUE cast_sym_DEFAULT;
57
+ extern VALUE cast_sym_DO;
58
+ extern VALUE cast_sym_DOUBLE;
59
+ extern VALUE cast_sym_ELSE;
60
+ extern VALUE cast_sym_ENUM;
61
+ extern VALUE cast_sym_EXTERN;
62
+ extern VALUE cast_sym_FLOAT;
63
+ extern VALUE cast_sym_FOR;
64
+ extern VALUE cast_sym_GOTO;
65
+ extern VALUE cast_sym_IF;
66
+ extern VALUE cast_sym_INT;
67
+ extern VALUE cast_sym_LONG;
68
+ extern VALUE cast_sym_REGISTER;
69
+ extern VALUE cast_sym_RETURN;
70
+ extern VALUE cast_sym_SHORT;
71
+ extern VALUE cast_sym_SIGNED;
72
+ extern VALUE cast_sym_SIZEOF;
73
+ extern VALUE cast_sym_STATIC;
74
+ extern VALUE cast_sym_STRUCT;
75
+ extern VALUE cast_sym_SWITCH;
76
+ extern VALUE cast_sym_TYPEDEF;
77
+ extern VALUE cast_sym_UNION;
78
+ extern VALUE cast_sym_UNSIGNED;
79
+ extern VALUE cast_sym_VOID;
80
+ extern VALUE cast_sym_VOLATILE;
81
+ extern VALUE cast_sym_WHILE;
82
+ extern VALUE cast_sym_INLINE;
83
+ extern VALUE cast_sym_RESTRICT;
84
+ extern VALUE cast_sym_BOOL;
85
+ extern VALUE cast_sym_COMPLEX;
86
+ extern VALUE cast_sym_IMAGINARY;
87
+
88
+ extern VALUE cast_sym_FCON;
89
+ extern VALUE cast_sym_ICON;
90
+ extern VALUE cast_sym_ID;
91
+ extern VALUE cast_sym_SCON;
92
+ extern VALUE cast_sym_CCON;
93
+ extern VALUE cast_sym_TYPENAME;
94
+
95
+ extern VALUE cast_sym_ADDEQ;
96
+ extern VALUE cast_sym_ANDAND;
97
+ extern VALUE cast_sym_ANDEQ;
98
+ extern VALUE cast_sym_DEC;
99
+ extern VALUE cast_sym_ARROW;
100
+ extern VALUE cast_sym_DIVEQ;
101
+ extern VALUE cast_sym_ELLIPSIS;
102
+ extern VALUE cast_sym_EQEQ;
103
+ extern VALUE cast_sym_GEQ;
104
+ extern VALUE cast_sym_INC;
105
+ extern VALUE cast_sym_LEQ;
106
+ extern VALUE cast_sym_LSHIFT;
107
+ extern VALUE cast_sym_LSHIFTEQ;
108
+ extern VALUE cast_sym_MODEQ;
109
+ extern VALUE cast_sym_MULEQ;
110
+ extern VALUE cast_sym_NEQ;
111
+ extern VALUE cast_sym_OREQ;
112
+ extern VALUE cast_sym_OROR;
113
+ extern VALUE cast_sym_RSHIFT;
114
+ extern VALUE cast_sym_RSHIFTEQ;
115
+ extern VALUE cast_sym_SUBEQ;
116
+ extern VALUE cast_sym_XOREQ;
117
+
118
+ extern VALUE cast_sym_SEMICOLON;
119
+ extern VALUE cast_sym_LBRACE;
120
+ extern VALUE cast_sym_RBRACE;
121
+ extern VALUE cast_sym_COMMA;
122
+ extern VALUE cast_sym_COLON;
123
+ extern VALUE cast_sym_EQ;
124
+ extern VALUE cast_sym_LPAREN;
125
+ extern VALUE cast_sym_RPAREN;
126
+ extern VALUE cast_sym_LBRACKET;
127
+ extern VALUE cast_sym_RBRACKET;
128
+ extern VALUE cast_sym_DOT;
129
+ extern VALUE cast_sym_AND;
130
+ extern VALUE cast_sym_BANG;
131
+ extern VALUE cast_sym_NOT;
132
+ extern VALUE cast_sym_SUB;
133
+ extern VALUE cast_sym_ADD;
134
+ extern VALUE cast_sym_MUL;
135
+ extern VALUE cast_sym_DIV;
136
+ extern VALUE cast_sym_MOD;
137
+ extern VALUE cast_sym_LT;
138
+ extern VALUE cast_sym_GT;
139
+ extern VALUE cast_sym_XOR;
140
+ extern VALUE cast_sym_OR;
141
+ extern VALUE cast_sym_QUESTION;
@@ -0,0 +1,2 @@
1
+ require 'mkmf'
2
+ create_makefile 'cast/cast'
@@ -0,0 +1,287 @@
1
+ #include "cast.h"
2
+
3
+ /* Modules and classes.
4
+ */
5
+ VALUE cast_mC;
6
+ VALUE cast_cParser;
7
+ VALUE cast_eParseError;
8
+
9
+ /* Lexer symbols.
10
+ */
11
+ VALUE cast_sym_AUTO;
12
+ VALUE cast_sym_BREAK;
13
+ VALUE cast_sym_CASE;
14
+ VALUE cast_sym_CHAR;
15
+ VALUE cast_sym_CONST;
16
+ VALUE cast_sym_CONTINUE;
17
+ VALUE cast_sym_DEFAULT;
18
+ VALUE cast_sym_DO;
19
+ VALUE cast_sym_DOUBLE;
20
+ VALUE cast_sym_ELSE;
21
+ VALUE cast_sym_ENUM;
22
+ VALUE cast_sym_EXTERN;
23
+ VALUE cast_sym_FLOAT;
24
+ VALUE cast_sym_FOR;
25
+ VALUE cast_sym_GOTO;
26
+ VALUE cast_sym_IF;
27
+ VALUE cast_sym_INT;
28
+ VALUE cast_sym_LONG;
29
+ VALUE cast_sym_REGISTER;
30
+ VALUE cast_sym_RETURN;
31
+ VALUE cast_sym_SHORT;
32
+ VALUE cast_sym_SIGNED;
33
+ VALUE cast_sym_SIZEOF;
34
+ VALUE cast_sym_STATIC;
35
+ VALUE cast_sym_STRUCT;
36
+ VALUE cast_sym_SWITCH;
37
+ VALUE cast_sym_TYPEDEF;
38
+ VALUE cast_sym_UNION;
39
+ VALUE cast_sym_UNSIGNED;
40
+ VALUE cast_sym_VOID;
41
+ VALUE cast_sym_VOLATILE;
42
+ VALUE cast_sym_WHILE;
43
+ VALUE cast_sym_INLINE;
44
+ VALUE cast_sym_RESTRICT;
45
+ VALUE cast_sym_BOOL;
46
+ VALUE cast_sym_COMPLEX;
47
+ VALUE cast_sym_IMAGINARY;
48
+
49
+ VALUE cast_sym_FCON;
50
+ VALUE cast_sym_ICON;
51
+ VALUE cast_sym_ID;
52
+ VALUE cast_sym_SCON;
53
+ VALUE cast_sym_CCON;
54
+ VALUE cast_sym_TYPENAME;
55
+
56
+ VALUE cast_sym_ADDEQ;
57
+ VALUE cast_sym_ANDAND;
58
+ VALUE cast_sym_ANDEQ;
59
+ VALUE cast_sym_DEC;
60
+ VALUE cast_sym_ARROW;
61
+ VALUE cast_sym_DIVEQ;
62
+ VALUE cast_sym_ELLIPSIS;
63
+ VALUE cast_sym_EQEQ;
64
+ VALUE cast_sym_GEQ;
65
+ VALUE cast_sym_INC;
66
+ VALUE cast_sym_LEQ;
67
+ VALUE cast_sym_LSHIFT;
68
+ VALUE cast_sym_LSHIFTEQ;
69
+ VALUE cast_sym_MODEQ;
70
+ VALUE cast_sym_MULEQ;
71
+ VALUE cast_sym_NEQ;
72
+ VALUE cast_sym_OREQ;
73
+ VALUE cast_sym_OROR;
74
+ VALUE cast_sym_RSHIFT;
75
+ VALUE cast_sym_RSHIFTEQ;
76
+ VALUE cast_sym_SUBEQ;
77
+ VALUE cast_sym_XOREQ;
78
+
79
+ VALUE cast_sym_SEMICOLON;
80
+ VALUE cast_sym_LBRACE;
81
+ VALUE cast_sym_RBRACE;
82
+ VALUE cast_sym_COMMA;
83
+ VALUE cast_sym_COLON;
84
+ VALUE cast_sym_EQ;
85
+ VALUE cast_sym_LPAREN;
86
+ VALUE cast_sym_RPAREN;
87
+ VALUE cast_sym_LBRACKET;
88
+ VALUE cast_sym_RBRACKET;
89
+ VALUE cast_sym_DOT;
90
+ VALUE cast_sym_AND;
91
+ VALUE cast_sym_BANG;
92
+ VALUE cast_sym_NOT;
93
+ VALUE cast_sym_SUB;
94
+ VALUE cast_sym_ADD;
95
+ VALUE cast_sym_MUL;
96
+ VALUE cast_sym_DIV;
97
+ VALUE cast_sym_MOD;
98
+ VALUE cast_sym_LT;
99
+ VALUE cast_sym_GT;
100
+ VALUE cast_sym_XOR;
101
+ VALUE cast_sym_OR;
102
+ VALUE cast_sym_QUESTION;
103
+
104
+ VALUE cast_Parser_alloc(VALUE klass) {
105
+ VALUE ret;
106
+ cast_Parser *ret_p;
107
+ ret_p = ALLOC(cast_Parser);
108
+ memset(ret_p, 0, sizeof(cast_Parser));
109
+ ret = Wrap_Struct(ret_p, Parser, klass);
110
+ ret_p->lineno = 1;
111
+ ret_p->token = rb_ary_new2(2);
112
+ rb_ary_push(ret_p->token, Qnil);
113
+ rb_ary_push(ret_p->token, Qnil);
114
+ return ret;
115
+ }
116
+
117
+ void cast_Parser_mark(cast_Parser *parser) {
118
+ rb_gc_mark(parser->token);
119
+ }
120
+
121
+ void cast_Parser_free(cast_Parser *parser) {
122
+ /* nothing to do */
123
+ }
124
+
125
+ /* (Private.) Called by #parse to prepare for lexing.
126
+ */
127
+ VALUE cast_Parser_prepare_lexer(VALUE self, VALUE string) {
128
+ cast_Parser *self_p;
129
+ char *b, *e;
130
+
131
+ Get_Struct(self, Parser, self_p);
132
+ string = rb_convert_type(string, T_STRING, "String", "to_s");
133
+
134
+ b = RSTRING_PTR(string);
135
+ e = b + RSTRING_LEN(string) + 1;
136
+
137
+ self_p->bot = b;
138
+ self_p->tok = b;
139
+ self_p->ptr = b;
140
+ self_p->cur = b;
141
+ self_p->pos = b;
142
+ self_p->lim = e;
143
+ self_p->top = e;
144
+ self_p->eof = e;
145
+ self_p->lineno = 1;
146
+
147
+ return Qnil;
148
+ }
149
+
150
+ /* (Private.) Called by #parse to get the next token (as required by
151
+ * racc). Returns a 2-element array: [TOKEN_SYM, VALUE].
152
+ */
153
+ VALUE cast_Parser_next_token(VALUE self) {
154
+ cast_Parser *self_p;
155
+ VALUE token, pos;
156
+ Get_Struct(self, Parser, self_p);
157
+
158
+ /* clear the token val */
159
+ rb_ary_store(self_p->token, 1, Qnil);
160
+
161
+ /* call the lexer */
162
+ yylex(self, self_p);
163
+
164
+ /* return nil if EOF */
165
+ if (rb_ary_entry(self_p->token, 0) == Qnil)
166
+ return Qnil;
167
+
168
+ /* set self.pos */
169
+ pos = rb_iv_get(self, "@pos");
170
+ rb_funcall(pos, rb_intern("line_num="), 1, LONG2NUM(self_p->lineno));
171
+ /* make token */
172
+ token = rb_funcall(rb_const_get(cast_cParser, rb_intern("Token")),
173
+ rb_intern("new"), 2,
174
+ rb_funcall2(pos, rb_intern("dup"), 0, NULL),
175
+ rb_ary_entry(self_p->token, 1));
176
+ /* put the token in the array */
177
+ rb_ary_store(self_p->token, 1, token);
178
+ return self_p->token;
179
+ }
180
+
181
+ /* Called from Init_cast_ext to initialize the Parser section.
182
+ */
183
+ void cast_init_parser(void) {
184
+ VALUE cRaccParser;
185
+ rb_require("racc/parser");
186
+ cRaccParser = rb_const_get(rb_const_get(rb_cObject, rb_intern("Racc")),
187
+ rb_intern("Parser"));
188
+ cast_cParser = rb_define_class_under(cast_mC, "Parser", cRaccParser);
189
+ rb_define_alloc_func(cast_cParser, cast_Parser_alloc);
190
+ cast_eParseError = rb_define_class_under(cast_mC, "ParseError", rb_eStandardError);
191
+
192
+ rb_define_private_method(cast_cParser, "next_token", cast_Parser_next_token, 0);
193
+ rb_define_private_method(cast_cParser, "prepare_lexer", cast_Parser_prepare_lexer, 1);
194
+
195
+ cast_sym_AUTO = ID2SYM(rb_intern("AUTO"));
196
+ cast_sym_BREAK = ID2SYM(rb_intern("BREAK"));
197
+ cast_sym_CASE = ID2SYM(rb_intern("CASE"));
198
+ cast_sym_CHAR = ID2SYM(rb_intern("CHAR"));
199
+ cast_sym_CONST = ID2SYM(rb_intern("CONST"));
200
+ cast_sym_CONTINUE = ID2SYM(rb_intern("CONTINUE"));
201
+ cast_sym_DEFAULT = ID2SYM(rb_intern("DEFAULT"));
202
+ cast_sym_DO = ID2SYM(rb_intern("DO"));
203
+ cast_sym_DOUBLE = ID2SYM(rb_intern("DOUBLE"));
204
+ cast_sym_ELSE = ID2SYM(rb_intern("ELSE"));
205
+ cast_sym_ENUM = ID2SYM(rb_intern("ENUM"));
206
+ cast_sym_EXTERN = ID2SYM(rb_intern("EXTERN"));
207
+ cast_sym_FLOAT = ID2SYM(rb_intern("FLOAT"));
208
+ cast_sym_FOR = ID2SYM(rb_intern("FOR"));
209
+ cast_sym_GOTO = ID2SYM(rb_intern("GOTO"));
210
+ cast_sym_IF = ID2SYM(rb_intern("IF"));
211
+ cast_sym_INT = ID2SYM(rb_intern("INT"));
212
+ cast_sym_LONG = ID2SYM(rb_intern("LONG"));
213
+ cast_sym_REGISTER = ID2SYM(rb_intern("REGISTER"));
214
+ cast_sym_RETURN = ID2SYM(rb_intern("RETURN"));
215
+ cast_sym_SHORT = ID2SYM(rb_intern("SHORT"));
216
+ cast_sym_SIGNED = ID2SYM(rb_intern("SIGNED"));
217
+ cast_sym_SIZEOF = ID2SYM(rb_intern("SIZEOF"));
218
+ cast_sym_STATIC = ID2SYM(rb_intern("STATIC"));
219
+ cast_sym_STRUCT = ID2SYM(rb_intern("STRUCT"));
220
+ cast_sym_SWITCH = ID2SYM(rb_intern("SWITCH"));
221
+ cast_sym_TYPEDEF = ID2SYM(rb_intern("TYPEDEF"));
222
+ cast_sym_UNION = ID2SYM(rb_intern("UNION"));
223
+ cast_sym_UNSIGNED = ID2SYM(rb_intern("UNSIGNED"));
224
+ cast_sym_VOID = ID2SYM(rb_intern("VOID"));
225
+ cast_sym_VOLATILE = ID2SYM(rb_intern("VOLATILE"));
226
+ cast_sym_WHILE = ID2SYM(rb_intern("WHILE"));
227
+ cast_sym_INLINE = ID2SYM(rb_intern("INLINE"));
228
+ cast_sym_RESTRICT = ID2SYM(rb_intern("RESTRICT"));
229
+ cast_sym_BOOL = ID2SYM(rb_intern("BOOL"));
230
+ cast_sym_COMPLEX = ID2SYM(rb_intern("COMPLEX"));
231
+ cast_sym_IMAGINARY = ID2SYM(rb_intern("IMAGINARY"));
232
+
233
+ cast_sym_FCON = ID2SYM(rb_intern("FCON"));
234
+ cast_sym_ICON = ID2SYM(rb_intern("ICON"));
235
+ cast_sym_ID = ID2SYM(rb_intern("ID"));
236
+ cast_sym_SCON = ID2SYM(rb_intern("SCON"));
237
+ cast_sym_CCON = ID2SYM(rb_intern("CCON"));
238
+ cast_sym_TYPENAME = ID2SYM(rb_intern("TYPENAME"));
239
+
240
+ cast_sym_ADDEQ = ID2SYM(rb_intern("ADDEQ"));
241
+ cast_sym_ANDAND = ID2SYM(rb_intern("ANDAND"));
242
+ cast_sym_ANDEQ = ID2SYM(rb_intern("ANDEQ"));
243
+ cast_sym_DEC = ID2SYM(rb_intern("DEC"));
244
+ cast_sym_ARROW = ID2SYM(rb_intern("ARROW"));
245
+ cast_sym_DIVEQ = ID2SYM(rb_intern("DIVEQ"));
246
+ cast_sym_ELLIPSIS = ID2SYM(rb_intern("ELLIPSIS"));
247
+ cast_sym_EQEQ = ID2SYM(rb_intern("EQEQ"));
248
+ cast_sym_GEQ = ID2SYM(rb_intern("GEQ"));
249
+ cast_sym_INC = ID2SYM(rb_intern("INC"));
250
+ cast_sym_LEQ = ID2SYM(rb_intern("LEQ"));
251
+ cast_sym_LSHIFT = ID2SYM(rb_intern("LSHIFT"));
252
+ cast_sym_LSHIFTEQ = ID2SYM(rb_intern("LSHIFTEQ"));
253
+ cast_sym_MODEQ = ID2SYM(rb_intern("MODEQ"));
254
+ cast_sym_MULEQ = ID2SYM(rb_intern("MULEQ"));
255
+ cast_sym_NEQ = ID2SYM(rb_intern("NEQ"));
256
+ cast_sym_OREQ = ID2SYM(rb_intern("OREQ"));
257
+ cast_sym_OROR = ID2SYM(rb_intern("OROR"));
258
+ cast_sym_RSHIFT = ID2SYM(rb_intern("RSHIFT"));
259
+ cast_sym_RSHIFTEQ = ID2SYM(rb_intern("RSHIFTEQ"));
260
+ cast_sym_SUBEQ = ID2SYM(rb_intern("SUBEQ"));
261
+ cast_sym_XOREQ = ID2SYM(rb_intern("XOREQ"));
262
+
263
+ cast_sym_SEMICOLON = ID2SYM(rb_intern("SEMICOLON"));
264
+ cast_sym_LBRACE = ID2SYM(rb_intern("LBRACE"));
265
+ cast_sym_RBRACE = ID2SYM(rb_intern("RBRACE"));
266
+ cast_sym_COMMA = ID2SYM(rb_intern("COMMA"));
267
+ cast_sym_COLON = ID2SYM(rb_intern("COLON"));
268
+ cast_sym_EQ = ID2SYM(rb_intern("EQ"));
269
+ cast_sym_LPAREN = ID2SYM(rb_intern("LPAREN"));
270
+ cast_sym_RPAREN = ID2SYM(rb_intern("RPAREN"));
271
+ cast_sym_LBRACKET = ID2SYM(rb_intern("LBRACKET"));
272
+ cast_sym_RBRACKET = ID2SYM(rb_intern("RBRACKET"));
273
+ cast_sym_DOT = ID2SYM(rb_intern("DOT"));
274
+ cast_sym_AND = ID2SYM(rb_intern("AND"));
275
+ cast_sym_BANG = ID2SYM(rb_intern("BANG"));
276
+ cast_sym_NOT = ID2SYM(rb_intern("NOT"));
277
+ cast_sym_SUB = ID2SYM(rb_intern("SUB"));
278
+ cast_sym_ADD = ID2SYM(rb_intern("ADD"));
279
+ cast_sym_MUL = ID2SYM(rb_intern("MUL"));
280
+ cast_sym_DIV = ID2SYM(rb_intern("DIV"));
281
+ cast_sym_MOD = ID2SYM(rb_intern("MOD"));
282
+ cast_sym_LT = ID2SYM(rb_intern("LT"));
283
+ cast_sym_GT = ID2SYM(rb_intern("GT"));
284
+ cast_sym_XOR = ID2SYM(rb_intern("XOR"));
285
+ cast_sym_OR = ID2SYM(rb_intern("OR"));
286
+ cast_sym_QUESTION = ID2SYM(rb_intern("QUESTION"));
287
+ }