rubinius-melbourne 1.0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/Gemfile +4 -0
- data/LICENSE +25 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/ext/rubinius/melbourne/bstring-license.txt +29 -0
- data/ext/rubinius/melbourne/bstrlib.cpp +2687 -0
- data/ext/rubinius/melbourne/bstrlib.h +267 -0
- data/ext/rubinius/melbourne/extconf.rb +166 -0
- data/ext/rubinius/melbourne/grammar.cpp +11255 -0
- data/ext/rubinius/melbourne/grammar.hpp +11 -0
- data/ext/rubinius/melbourne/grammar.y +6063 -0
- data/ext/rubinius/melbourne/lex.c.tab +136 -0
- data/ext/rubinius/melbourne/local_state.hpp +41 -0
- data/ext/rubinius/melbourne/melbourne.cpp +60 -0
- data/ext/rubinius/melbourne/melbourne.hpp +19 -0
- data/ext/rubinius/melbourne/node.hpp +261 -0
- data/ext/rubinius/melbourne/node_types.cpp +254 -0
- data/ext/rubinius/melbourne/node_types.hpp +127 -0
- data/ext/rubinius/melbourne/node_types.rb +185 -0
- data/ext/rubinius/melbourne/parser_state.hpp +180 -0
- data/ext/rubinius/melbourne/quark.cpp +43 -0
- data/ext/rubinius/melbourne/quark.hpp +49 -0
- data/ext/rubinius/melbourne/symbols.cpp +225 -0
- data/ext/rubinius/melbourne/symbols.hpp +119 -0
- data/ext/rubinius/melbourne/var_table.cpp +81 -0
- data/ext/rubinius/melbourne/var_table.hpp +31 -0
- data/ext/rubinius/melbourne/visitor.cpp +962 -0
- data/ext/rubinius/melbourne/visitor.hpp +10 -0
- data/lib/rubinius/melbourne/version.rb +5 -0
- data/lib/rubinius/melbourne.rb +100 -0
- data/rubinius-melbourne.gemspec +25 -0
- metadata +119 -0
@@ -0,0 +1,136 @@
|
|
1
|
+
/* C code produced by gperf version 2.7.2 */
|
2
|
+
/* Command-line: gperf -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' ./keywords */
|
3
|
+
struct kwtable {
|
4
|
+
int id[2];
|
5
|
+
enum lex_state_e state;
|
6
|
+
char name[16];
|
7
|
+
};
|
8
|
+
|
9
|
+
#define TOTAL_KEYWORDS 40
|
10
|
+
#define MIN_WORD_LENGTH 2
|
11
|
+
#define MAX_WORD_LENGTH 8
|
12
|
+
#define MIN_HASH_VALUE 6
|
13
|
+
#define MAX_HASH_VALUE 55
|
14
|
+
/* maximum key range = 50, duplicates = 0 */
|
15
|
+
|
16
|
+
#ifdef __GNUC__
|
17
|
+
__inline
|
18
|
+
#else
|
19
|
+
#ifdef __cplusplus
|
20
|
+
inline
|
21
|
+
#endif
|
22
|
+
#endif
|
23
|
+
static unsigned int
|
24
|
+
hash (register const char *str, register unsigned int len)
|
25
|
+
{
|
26
|
+
static const unsigned char asso_values[] =
|
27
|
+
{
|
28
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
29
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
30
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
31
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
32
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
33
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
34
|
+
56, 56, 56, 11, 56, 56, 36, 56, 1, 37,
|
35
|
+
31, 1, 56, 56, 56, 56, 29, 56, 1, 56,
|
36
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
37
|
+
56, 56, 56, 56, 56, 1, 56, 32, 1, 2,
|
38
|
+
1, 1, 4, 23, 56, 17, 56, 20, 9, 2,
|
39
|
+
9, 26, 14, 56, 5, 1, 1, 16, 56, 21,
|
40
|
+
20, 9, 56, 56, 56, 56, 56, 56, 56, 56,
|
41
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
42
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
43
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
44
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
45
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
46
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
47
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
48
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
49
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
50
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
52
|
+
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
53
|
+
56, 56, 56, 56, 56, 56
|
54
|
+
};
|
55
|
+
register int hval = len;
|
56
|
+
|
57
|
+
switch (hval)
|
58
|
+
{
|
59
|
+
default:
|
60
|
+
case 3:
|
61
|
+
hval += asso_values[(unsigned char)str[2]];
|
62
|
+
case 2:
|
63
|
+
case 1:
|
64
|
+
hval += asso_values[(unsigned char)str[0]];
|
65
|
+
break;
|
66
|
+
}
|
67
|
+
return hval + asso_values[(unsigned char)str[len - 1]];
|
68
|
+
}
|
69
|
+
|
70
|
+
#ifdef __GNUC__
|
71
|
+
__inline
|
72
|
+
#endif
|
73
|
+
const struct kwtable *
|
74
|
+
mel_reserved_word (register const char *str, register unsigned int len)
|
75
|
+
{
|
76
|
+
static const struct kwtable wordlist[] =
|
77
|
+
{
|
78
|
+
{{0, 0}}, {{0, 0}}, {{0, 0}}, {{0, 0}}, {{0, 0}}, {{0, 0}},
|
79
|
+
{{kEND, kEND}, EXPR_END, "end"},
|
80
|
+
{{kELSE, kELSE}, EXPR_BEG, "else"},
|
81
|
+
{{kCASE, kCASE}, EXPR_BEG, "case"},
|
82
|
+
{{kENSURE, kENSURE}, EXPR_BEG, "ensure"},
|
83
|
+
{{kMODULE, kMODULE}, EXPR_BEG, "module"},
|
84
|
+
{{kELSIF, kELSIF}, EXPR_BEG, "elsif"},
|
85
|
+
{{kDEF, kDEF}, EXPR_FNAME, "def"},
|
86
|
+
{{kRESCUE, kRESCUE_MOD}, EXPR_MID, "rescue"},
|
87
|
+
{{kNOT, kNOT}, EXPR_BEG, "not"},
|
88
|
+
{{kTHEN, kTHEN}, EXPR_BEG, "then"},
|
89
|
+
{{kYIELD, kYIELD}, EXPR_ARG, "yield"},
|
90
|
+
{{kFOR, kFOR}, EXPR_BEG, "for"},
|
91
|
+
{{kSELF, kSELF}, EXPR_END, "self"},
|
92
|
+
{{kFALSE, kFALSE}, EXPR_END, "false"},
|
93
|
+
{{kRETRY, kRETRY}, EXPR_END, "retry"},
|
94
|
+
{{kRETURN, kRETURN}, EXPR_MID, "return"},
|
95
|
+
{{kTRUE, kTRUE}, EXPR_END, "true"},
|
96
|
+
{{kIF, kIF_MOD}, EXPR_BEG, "if"},
|
97
|
+
{{kDEFINED, kDEFINED}, EXPR_ARG, "defined?"},
|
98
|
+
{{kSUPER, kSUPER}, EXPR_ARG, "super"},
|
99
|
+
{{kUNDEF, kUNDEF}, EXPR_FNAME, "undef"},
|
100
|
+
{{kBREAK, kBREAK}, EXPR_MID, "break"},
|
101
|
+
{{kIN, kIN}, EXPR_BEG, "in"},
|
102
|
+
{{kDO, kDO}, EXPR_BEG, "do"},
|
103
|
+
{{kNIL, kNIL}, EXPR_END, "nil"},
|
104
|
+
{{kUNTIL, kUNTIL_MOD}, EXPR_BEG, "until"},
|
105
|
+
{{kUNLESS, kUNLESS_MOD}, EXPR_BEG, "unless"},
|
106
|
+
{{kOR, kOR}, EXPR_BEG, "or"},
|
107
|
+
{{kNEXT, kNEXT}, EXPR_MID, "next"},
|
108
|
+
{{kWHEN, kWHEN}, EXPR_BEG, "when"},
|
109
|
+
{{kREDO, kREDO}, EXPR_END, "redo"},
|
110
|
+
{{kAND, kAND}, EXPR_BEG, "and"},
|
111
|
+
{{kBEGIN, kBEGIN}, EXPR_BEG, "begin"},
|
112
|
+
{{k__LINE__, k__LINE__}, EXPR_END, "__LINE__"},
|
113
|
+
{{kCLASS, kCLASS}, EXPR_CLASS, "class"},
|
114
|
+
{{k__FILE__, k__FILE__}, EXPR_END, "__FILE__"},
|
115
|
+
{{klEND, klEND}, EXPR_END, "END"},
|
116
|
+
{{klBEGIN, klBEGIN}, EXPR_END, "BEGIN"},
|
117
|
+
{{kWHILE, kWHILE_MOD}, EXPR_BEG, "while"},
|
118
|
+
{{0, 0}}, {{0, 0}}, {{0, 0}}, {{0, 0}}, {{0, 0}},
|
119
|
+
{{0, 0}}, {{0, 0}}, {{0, 0}}, {{0, 0}}, {{0, 0}},
|
120
|
+
{{kALIAS, kALIAS}, EXPR_FNAME, "alias"}
|
121
|
+
};
|
122
|
+
|
123
|
+
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
124
|
+
{
|
125
|
+
register int key = hash (str, len);
|
126
|
+
|
127
|
+
if (key <= MAX_HASH_VALUE && key >= 0)
|
128
|
+
{
|
129
|
+
register const char *s = wordlist[key].name;
|
130
|
+
|
131
|
+
if (*str == *s && !strcmp (str + 1, s + 1))
|
132
|
+
return &wordlist[key];
|
133
|
+
}
|
134
|
+
}
|
135
|
+
return 0;
|
136
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#ifndef MEL_LOCALSTATE_HPP
|
2
|
+
#define MEL_LOCALSTATE_HPP
|
3
|
+
|
4
|
+
#include "var_table.hpp"
|
5
|
+
|
6
|
+
namespace MELBOURNE {
|
7
|
+
struct LocalState {
|
8
|
+
LocalState* prev;
|
9
|
+
var_table local_vars;
|
10
|
+
var_table block_vars;
|
11
|
+
|
12
|
+
LocalState(LocalState* prev)
|
13
|
+
: prev(prev)
|
14
|
+
, local_vars(var_table_create())
|
15
|
+
, block_vars(0)
|
16
|
+
{}
|
17
|
+
|
18
|
+
~LocalState() {
|
19
|
+
var_table_destroy(local_vars);
|
20
|
+
if(block_vars) {
|
21
|
+
var_table_destroy(block_vars);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
bool blocks_p() {
|
26
|
+
return block_vars != NULL;
|
27
|
+
}
|
28
|
+
|
29
|
+
static LocalState* push(LocalState* cur) {
|
30
|
+
return new LocalState(cur);
|
31
|
+
}
|
32
|
+
|
33
|
+
static LocalState* pop(LocalState* cur) {
|
34
|
+
LocalState* tmp = cur->prev;
|
35
|
+
delete cur;
|
36
|
+
return tmp;
|
37
|
+
}
|
38
|
+
};
|
39
|
+
};
|
40
|
+
|
41
|
+
#endif
|
@@ -0,0 +1,60 @@
|
|
1
|
+
#include "namespace.h"
|
2
|
+
#include "melbourne.hpp"
|
3
|
+
#include "grammar.hpp"
|
4
|
+
#include "symbols.hpp"
|
5
|
+
|
6
|
+
#ifdef __cplusplus
|
7
|
+
extern "C" {
|
8
|
+
#endif
|
9
|
+
|
10
|
+
VALUE MELBOURNE_STRING_TO_AST(VALUE self, VALUE source, VALUE name, VALUE line) {
|
11
|
+
StringValue(source);
|
12
|
+
StringValue(name);
|
13
|
+
bstring b_str = blk2bstr(RSTRING_PTR(source), (int)RSTRING_LEN(source));
|
14
|
+
VALUE result = MELBOURNE::string_to_ast(self,
|
15
|
+
RSTRING_PTR(name), b_str, FIX2INT(line));
|
16
|
+
bdestroy(b_str);
|
17
|
+
|
18
|
+
return result;
|
19
|
+
}
|
20
|
+
|
21
|
+
VALUE MELBOURNE_FILE_TO_AST(VALUE self, VALUE fname, VALUE start) {
|
22
|
+
StringValue(fname);
|
23
|
+
|
24
|
+
char* c_name = RSTRING_PTR(fname);
|
25
|
+
|
26
|
+
FILE *file = fopen(c_name, "r");
|
27
|
+
if(file) {
|
28
|
+
VALUE result = MELBOURNE::file_to_ast(self,
|
29
|
+
RSTRING_PTR(fname), file, FIX2INT(start));
|
30
|
+
fclose(file);
|
31
|
+
|
32
|
+
return result;
|
33
|
+
} else {
|
34
|
+
rb_raise(rb_eLoadError, "%s -- %s", strerror(errno), c_name);
|
35
|
+
return Qnil;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
void Init_melbourne(void) {
|
40
|
+
VALUE rb_cMelbourne, rb_mToolSet, rb_mTScurrent, rb_mTS;
|
41
|
+
|
42
|
+
MELBOURNE::init_symbols();
|
43
|
+
|
44
|
+
#ifndef RUBINIUS
|
45
|
+
VALUE rb_mRubinius = rb_const_get(rb_cObject, rb_intern("Rubinius"));
|
46
|
+
#endif
|
47
|
+
|
48
|
+
rb_mToolSet = rb_const_get(rb_mRubinius, rb_intern("ToolSet"));
|
49
|
+
rb_mTScurrent = rb_funcall(rb_mToolSet, rb_intern("current"), 0);
|
50
|
+
rb_mTS = rb_define_module_under(rb_mTScurrent, "TS");
|
51
|
+
rb_cMelbourne = rb_define_class_under(rb_mTS, "Melbourne", rb_cObject);
|
52
|
+
rb_define_method(rb_cMelbourne, "string_to_ast",
|
53
|
+
RUBY_METHOD_FUNC(MELBOURNE_STRING_TO_AST), 3);
|
54
|
+
rb_define_method(rb_cMelbourne, "file_to_ast",
|
55
|
+
RUBY_METHOD_FUNC(MELBOURNE_FILE_TO_AST), 2);
|
56
|
+
}
|
57
|
+
|
58
|
+
#ifdef __cplusplus
|
59
|
+
} /* extern "C" { */
|
60
|
+
#endif
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#include <stdio.h>
|
2
|
+
#include <errno.h>
|
3
|
+
#include <ctype.h>
|
4
|
+
#include <string.h>
|
5
|
+
#include <strings.h>
|
6
|
+
#include <stdbool.h>
|
7
|
+
#include <stdint.h>
|
8
|
+
#include <assert.h>
|
9
|
+
#include <stdlib.h>
|
10
|
+
#include <unistd.h>
|
11
|
+
#include <fcntl.h>
|
12
|
+
#include <sys/types.h>
|
13
|
+
#ifdef HAVE_ALLOCA_H
|
14
|
+
#include <alloca.h>
|
15
|
+
#endif
|
16
|
+
|
17
|
+
#define RSTRING_NOT_MODIFIED 1
|
18
|
+
|
19
|
+
#include "ruby.h"
|
@@ -0,0 +1,261 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
node.h -
|
4
|
+
|
5
|
+
$Author: nobu $
|
6
|
+
$Date: 2004/10/02 11:34:29 $
|
7
|
+
created at: Fri May 28 15:14:02 JST 1993
|
8
|
+
|
9
|
+
Copyright (C) 1993-2003 Yukihiro Matsumoto
|
10
|
+
|
11
|
+
**********************************************************************/
|
12
|
+
|
13
|
+
#ifndef MEL_NODE_HPP
|
14
|
+
#define MEL_NODE_HPP
|
15
|
+
|
16
|
+
#include "namespace.h"
|
17
|
+
#include "bstrlib.h"
|
18
|
+
#include "melbourne.hpp"
|
19
|
+
#include "quark.hpp"
|
20
|
+
|
21
|
+
namespace MELBOURNE {
|
22
|
+
|
23
|
+
#define QUID quark
|
24
|
+
|
25
|
+
typedef struct RNode {
|
26
|
+
unsigned long flags;
|
27
|
+
char *nd_file;
|
28
|
+
union {
|
29
|
+
RNode *node;
|
30
|
+
QUID id;
|
31
|
+
VALUE value;
|
32
|
+
QUID *tbl;
|
33
|
+
bstring string;
|
34
|
+
} u1;
|
35
|
+
union {
|
36
|
+
struct RNode *node;
|
37
|
+
QUID id;
|
38
|
+
long argc;
|
39
|
+
VALUE value;
|
40
|
+
} u2;
|
41
|
+
union {
|
42
|
+
struct RNode *node;
|
43
|
+
QUID id;
|
44
|
+
long state;
|
45
|
+
long cnt;
|
46
|
+
VALUE value;
|
47
|
+
bstring string;
|
48
|
+
} u3;
|
49
|
+
} NODE;
|
50
|
+
|
51
|
+
#define RNODE(obj) ((NODE*)(obj))
|
52
|
+
|
53
|
+
#ifndef FL_USHIFT
|
54
|
+
#define FL_USHIFT 11
|
55
|
+
#endif
|
56
|
+
|
57
|
+
#define FL_UMASK (0xff<<FL_USHIFT)
|
58
|
+
|
59
|
+
#define nd_type(n) ((int)(((RNODE(n))->flags>>FL_USHIFT)&0xff))
|
60
|
+
#define nd_set_type(n,t) \
|
61
|
+
RNODE(n)->flags=((RNODE(n)->flags&~FL_UMASK)|(((t)<<FL_USHIFT)&FL_UMASK))
|
62
|
+
|
63
|
+
#define NODE_LSHIFT (FL_USHIFT+8)
|
64
|
+
#define NODE_LMASK (((long)1<<(sizeof(NODE*)*CHAR_BIT-NODE_LSHIFT))-1)
|
65
|
+
#define nd_line(n) ((unsigned int)(((RNODE(n))->flags>>NODE_LSHIFT)&NODE_LMASK))
|
66
|
+
#define nd_set_line(n,l) \
|
67
|
+
RNODE(n)->flags=((RNODE(n)->flags&~(-1<<NODE_LSHIFT))|(((l)&NODE_LMASK)<<NODE_LSHIFT))
|
68
|
+
|
69
|
+
#define nd_head u1.node
|
70
|
+
#define nd_alen u2.argc
|
71
|
+
#define nd_next u3.node
|
72
|
+
|
73
|
+
#define nd_cond u1.node
|
74
|
+
#define nd_body u2.node
|
75
|
+
#define nd_else u3.node
|
76
|
+
|
77
|
+
#define nd_orig u3.string
|
78
|
+
|
79
|
+
#define nd_resq u2.node
|
80
|
+
#define nd_ensr u3.node
|
81
|
+
|
82
|
+
#define nd_1st u1.node
|
83
|
+
#define nd_2nd u2.node
|
84
|
+
|
85
|
+
#define nd_stts u1.node
|
86
|
+
|
87
|
+
#define nd_entry u3.entry
|
88
|
+
#define nd_vid u1.id
|
89
|
+
#define nd_cflag u2.id
|
90
|
+
#define nd_cval u3.value
|
91
|
+
|
92
|
+
#define nd_cnt u3.cnt
|
93
|
+
#define nd_tbl u1.tbl
|
94
|
+
|
95
|
+
#define nd_var u1.node
|
96
|
+
#define nd_ibdy u2.node
|
97
|
+
#define nd_iter u3.node
|
98
|
+
|
99
|
+
#define nd_value u2.node
|
100
|
+
#define nd_aid u3.id
|
101
|
+
|
102
|
+
#define nd_str u1.string
|
103
|
+
#define nd_lit u1.value
|
104
|
+
|
105
|
+
#define nd_frml u1.node
|
106
|
+
#define nd_rest u2.argc
|
107
|
+
#define nd_opt u1.node
|
108
|
+
#define nd_pid u1.id
|
109
|
+
#define nd_plen u2.argc
|
110
|
+
|
111
|
+
#define nd_recv u1.node
|
112
|
+
#define nd_mid u2.id
|
113
|
+
#define nd_args u3.node
|
114
|
+
|
115
|
+
#define nd_noex u1.id
|
116
|
+
#define nd_defn u3.node
|
117
|
+
|
118
|
+
#define nd_old u1.id
|
119
|
+
#define nd_new u2.id
|
120
|
+
|
121
|
+
#define nd_cfnc u1.cfunc
|
122
|
+
#define nd_argc u2.argc
|
123
|
+
|
124
|
+
#define nd_cpath u1.node
|
125
|
+
#define nd_super u3.node
|
126
|
+
|
127
|
+
#define nd_modl u1.id
|
128
|
+
#define nd_clss u1.value
|
129
|
+
|
130
|
+
#define nd_beg u1.node
|
131
|
+
#define nd_end u2.node
|
132
|
+
#define nd_state u3.state
|
133
|
+
#define nd_rval u2.value
|
134
|
+
|
135
|
+
#define nd_nth u2.argc
|
136
|
+
|
137
|
+
#define nd_tag u1.id
|
138
|
+
#define nd_tval u2.value
|
139
|
+
|
140
|
+
#define NEW_NODE(t,a0,a1,a2) node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
|
141
|
+
|
142
|
+
#define NEW_METHOD(n,x) NEW_NODE(NODE_METHOD,x,n,0)
|
143
|
+
#define NEW_FBODY(n,i,o) NEW_NODE(NODE_FBODY,n,i,o)
|
144
|
+
#define NEW_DEFN(i,a,d,p) NEW_NODE(NODE_DEFN,p,i,NEW_RFUNC(a,d))
|
145
|
+
#define NEW_DEFS(r,i,a,d) NEW_NODE(NODE_DEFS,r,i,NEW_RFUNC(a,d))
|
146
|
+
#define NEW_RFUNC(b1,b2) NEW_SCOPE(block_append(vps, b1,b2))
|
147
|
+
#define NEW_SCOPE(b) NEW_NODE(NODE_SCOPE,mel_local_tbl(vps),0,(b))
|
148
|
+
#define NEW_BLOCK(a) NEW_NODE(NODE_BLOCK,a,0,0)
|
149
|
+
#define NEW_IF(c,t,e) NEW_NODE(NODE_IF,c,t,e)
|
150
|
+
#define NEW_UNLESS(c,t,e) NEW_IF(c,e,t)
|
151
|
+
#define NEW_CASE(h,b) NEW_NODE(NODE_CASE,h,b,0)
|
152
|
+
#define NEW_WHEN(c,t,e) NEW_NODE(NODE_WHEN,c,t,e)
|
153
|
+
#define NEW_OPT_N(b) NEW_NODE(NODE_OPT_N,0,b,0)
|
154
|
+
#define NEW_WHILE(c,b,n) NEW_NODE(NODE_WHILE,c,b,n)
|
155
|
+
#define NEW_UNTIL(c,b,n) NEW_NODE(NODE_UNTIL,c,b,n)
|
156
|
+
#define NEW_FOR(v,i,b) NEW_NODE(NODE_FOR,v,b,i)
|
157
|
+
#define NEW_ITER(v,i,b) NEW_NODE(NODE_ITER,v,b,i)
|
158
|
+
#define NEW_BREAK(s) NEW_NODE(NODE_BREAK,s,0,0)
|
159
|
+
#define NEW_NEXT(s) NEW_NODE(NODE_NEXT,s,0,0)
|
160
|
+
#define NEW_REDO() NEW_NODE(NODE_REDO,0,0,0)
|
161
|
+
#define NEW_RETRY() NEW_NODE(NODE_RETRY,0,0,0)
|
162
|
+
#define NEW_BEGIN(b) NEW_NODE(NODE_BEGIN,0,b,0)
|
163
|
+
#define NEW_RESCUE(b,res,e) NEW_NODE(NODE_RESCUE,b,res,e)
|
164
|
+
#define NEW_RESBODY(a,ex,n) NEW_NODE(NODE_RESBODY,n,ex,a)
|
165
|
+
#define NEW_ENSURE(b,en) NEW_NODE(NODE_ENSURE,b,0,en)
|
166
|
+
#define NEW_RETURN(s) NEW_NODE(NODE_RETURN,s,0,0)
|
167
|
+
#define NEW_YIELD(a,s) NEW_NODE(NODE_YIELD,a,0,s)
|
168
|
+
#define NEW_LIST(a) NEW_ARRAY(a)
|
169
|
+
#define NEW_ARRAY(a) NEW_NODE(NODE_ARRAY,a,1,0)
|
170
|
+
#define NEW_ZARRAY() NEW_NODE(NODE_ZARRAY,0,0,0)
|
171
|
+
#define NEW_HASH(a) NEW_NODE(NODE_HASH,a,0,0)
|
172
|
+
#define NEW_POSITIONAL(a) NEW_NODE(NODE_HASH,a,1,0)
|
173
|
+
#define NEW_NOT(a) NEW_NODE(NODE_NOT,0,a,0)
|
174
|
+
#define NEW_MASGN(l,r) NEW_NODE(NODE_MASGN,l,0,r)
|
175
|
+
#define NEW_GASGN(v,val) NEW_NODE(NODE_GASGN,v,val,0)
|
176
|
+
#define NEW_LASGN(v,val) NEW_NODE(NODE_LASGN,v,val,local_cnt(v))
|
177
|
+
#define NEW_DASGN(v,val) NEW_NODE(NODE_DASGN,v,val,0)
|
178
|
+
#define NEW_DASGN_CURR(v,val) NEW_NODE(NODE_DASGN_CURR,v,val,0)
|
179
|
+
#define NEW_IASGN(v,val) NEW_NODE(NODE_IASGN,v,val,0)
|
180
|
+
#define NEW_CDECL(v,val,path) NEW_NODE(NODE_CDECL,v,val,path)
|
181
|
+
#define NEW_CVASGN(v,val) NEW_NODE(NODE_CVASGN,v,val,0)
|
182
|
+
#define NEW_CVDECL(v,val) NEW_NODE(NODE_CVDECL,v,val,0)
|
183
|
+
#define NEW_OP_ASGN1(p,id,a) NEW_NODE(NODE_OP_ASGN1,p,id,a)
|
184
|
+
#define NEW_OP_ASGN2(r,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o))
|
185
|
+
#define NEW_OP_ASGN22(i,o) NEW_NODE(NODE_OP_ASGN2,i,o,rb_id_attrset((rb_parser_state*) parser_state, i))
|
186
|
+
#define NEW_OP_ASGN_OR(i,val) NEW_NODE(NODE_OP_ASGN_OR,i,val,0)
|
187
|
+
#define NEW_OP_ASGN_AND(i,val) NEW_NODE(NODE_OP_ASGN_AND,i,val,0)
|
188
|
+
#define NEW_GVAR(v) NEW_NODE(NODE_GVAR,v,0,0)
|
189
|
+
#define NEW_LVAR(v) NEW_NODE(NODE_LVAR,v,0,local_cnt(v))
|
190
|
+
#define NEW_DVAR(v) NEW_NODE(NODE_DVAR,v,0,0)
|
191
|
+
#define NEW_IVAR(v) NEW_NODE(NODE_IVAR,v,0,0)
|
192
|
+
#define NEW_CONST(v) NEW_NODE(NODE_CONST,v,0,0)
|
193
|
+
#define NEW_CVAR(v) NEW_NODE(NODE_CVAR,v,0,0)
|
194
|
+
#define NEW_NTH_REF(n) NEW_NODE(NODE_NTH_REF,0,n,local_cnt('~'))
|
195
|
+
#define NEW_BACK_REF(n) NEW_NODE(NODE_BACK_REF,0,n,local_cnt('~'))
|
196
|
+
#define NEW_MATCH(c) NEW_NODE(NODE_MATCH,c,0,0)
|
197
|
+
#define NEW_MATCH2(n1,n2) NEW_NODE(NODE_MATCH2,n1,n2,0)
|
198
|
+
#define NEW_MATCH3(r,n2) NEW_NODE(NODE_MATCH3,r,n2,0)
|
199
|
+
#define NEW_LIT(l) NEW_NODE(NODE_LIT,l,0,0)
|
200
|
+
#define NEW_STR(s) NEW_NODE(NODE_STR,s,0,0)
|
201
|
+
#define NEW_DSTR(s) NEW_NODE(NODE_DSTR,s,1,0)
|
202
|
+
#define NEW_XSTR(s) NEW_NODE(NODE_XSTR,s,0,0)
|
203
|
+
#define NEW_DXSTR(s) NEW_NODE(NODE_DXSTR,s,0,0)
|
204
|
+
#define NEW_DSYM(s) NEW_NODE(NODE_DSYM,s,0,0)
|
205
|
+
#define NEW_EVSTR(n) NEW_NODE(NODE_EVSTR,0,(n),0)
|
206
|
+
#define NEW_CALL(r,m,a) NEW_NODE(NODE_CALL,r,m,a)
|
207
|
+
#define NEW_FCALL(m,a) NEW_NODE(NODE_FCALL,0,m,a)
|
208
|
+
#define NEW_VCALL(m) NEW_NODE(NODE_VCALL,0,m,0)
|
209
|
+
#define NEW_SUPER(a) NEW_NODE(NODE_SUPER,0,0,a)
|
210
|
+
#define NEW_ZSUPER() NEW_NODE(NODE_ZSUPER,0,0,0)
|
211
|
+
#define NEW_ARGS(f,o,r) NEW_NODE(NODE_ARGS,o,r,f)
|
212
|
+
#define NEW_ARGSCAT(a,b) NEW_NODE(NODE_ARGSCAT,a,b,0)
|
213
|
+
#define NEW_ARGSPUSH(a,b) NEW_NODE(NODE_ARGSPUSH,a,b,0)
|
214
|
+
#define NEW_SPLAT(a) NEW_NODE(NODE_SPLAT,a,0,0)
|
215
|
+
#define NEW_TO_ARY(a) NEW_NODE(NODE_TO_ARY,a,0,0)
|
216
|
+
#define NEW_SVALUE(a) NEW_NODE(NODE_SVALUE,a,0,0)
|
217
|
+
#define NEW_BLOCK_ARG(v) NEW_NODE(NODE_BLOCK_ARG,v,0,local_cnt(v))
|
218
|
+
#define NEW_BLOCK_PASS(b) NEW_NODE(NODE_BLOCK_PASS,0,b,0)
|
219
|
+
#define NEW_ALIAS(n,o) NEW_NODE(NODE_ALIAS,o,n,0)
|
220
|
+
#define NEW_VALIAS(n,o) NEW_NODE(NODE_VALIAS,o,n,0)
|
221
|
+
#define NEW_UNDEF(i) NEW_NODE(NODE_UNDEF,0,i,0)
|
222
|
+
#define NEW_CLASS(n,b,s) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(b),(s))
|
223
|
+
#define NEW_SCLASS(r,b) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(b),0)
|
224
|
+
#define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(b),0)
|
225
|
+
#define NEW_COLON2(c,i) NEW_NODE(NODE_COLON2,c,i,0)
|
226
|
+
#define NEW_COLON3(i) NEW_NODE(NODE_COLON3,0,i,0)
|
227
|
+
#define NEW_CREF(c) (NEW_NODE(NODE_CREF,0,0,c))
|
228
|
+
#define NEW_DOT2(b,e) NEW_NODE(NODE_DOT2,b,e,0)
|
229
|
+
#define NEW_DOT3(b,e) NEW_NODE(NODE_DOT3,b,e,0)
|
230
|
+
#define NEW_ATTRSET(a) NEW_NODE(NODE_ATTRSET,a,0,0)
|
231
|
+
#define NEW_SELF() NEW_NODE(NODE_SELF,0,0,0)
|
232
|
+
#define NEW_NIL() NEW_NODE(NODE_NIL,0,0,0)
|
233
|
+
#define NEW_TRUE() NEW_NODE(NODE_TRUE,0,0,0)
|
234
|
+
#define NEW_FALSE() NEW_NODE(NODE_FALSE,0,0,0)
|
235
|
+
#define NEW_DEFINED(e) NEW_NODE(NODE_DEFINED,e,0,0)
|
236
|
+
#define NEW_NEWLINE(n) NEW_NODE(NODE_NEWLINE,0,0,n)
|
237
|
+
#define NEW_PREEXE(b) NEW_NODE(NODE_PREEXE,0,0,0)
|
238
|
+
#define NEW_POSTEXE() NEW_NODE(NODE_POSTEXE,0,0,0)
|
239
|
+
#define NEW_DMETHOD(b) NEW_NODE(NODE_DMETHOD,0,0,b)
|
240
|
+
#define NEW_BMETHOD(b) NEW_NODE(NODE_BMETHOD,0,0,b)
|
241
|
+
#define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
|
242
|
+
#define NEW_FIXNUM(l) NEW_NODE(NODE_FIXNUM,0,0,l)
|
243
|
+
#define NEW_NUMBER(l) NEW_NODE(NODE_NUMBER,l,0,0)
|
244
|
+
#define NEW_HEXNUM(l) NEW_NODE(NODE_HEXNUM,l,0,0)
|
245
|
+
#define NEW_OCTNUM(l) NEW_NODE(NODE_OCTNUM,l,0,0)
|
246
|
+
#define NEW_BINNUM(l) NEW_NODE(NODE_BINNUM,l,0,0)
|
247
|
+
#define NEW_FLOAT(l) NEW_NODE(NODE_FLOAT,l,0,0)
|
248
|
+
#define NEW_NEGATE(l) NEW_NODE(NODE_NEGATE,l,0,0)
|
249
|
+
#define NEW_REGEX(l,o) NEW_NODE(NODE_REGEX,l,0,o)
|
250
|
+
#define NEW_FILE() NEW_NODE(NODE_FILE,0,0,0)
|
251
|
+
#define NOEX_PUBLIC 0
|
252
|
+
#define NOEX_NOSUPER 1
|
253
|
+
#define NOEX_PRIVATE 2
|
254
|
+
#define NOEX_PROTECTED 4
|
255
|
+
#define NOEX_MASK 6
|
256
|
+
|
257
|
+
#define NOEX_UNDEF NOEX_NOSUPER
|
258
|
+
|
259
|
+
};
|
260
|
+
|
261
|
+
#endif
|