ripper 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +31 -0
- data/Rakefile +22 -0
- data/ext/Makefile +195 -0
- data/ext/backports/backports.h +107 -0
- data/ext/backports/regenc.h +1 -0
- data/ext/backports/ruby/encoding.h +68 -0
- data/ext/depend +36 -0
- data/ext/eventids2.c +279 -0
- data/ext/extconf.rb +27 -0
- data/ext/extra/node.h +483 -0
- data/ext/extra/regenc.h +2 -0
- data/ext/id.c +50 -0
- data/ext/id.h +170 -0
- data/ext/lex.c +219 -0
- data/ext/parse.h +187 -0
- data/ext/parse.y +10637 -0
- data/ext/tools/generate-param-macros.rb +14 -0
- data/ext/tools/generate.rb +152 -0
- data/ext/tools/preproc.rb +91 -0
- data/ext/tools/strip.rb +12 -0
- data/ext/tools/ytab.sed +31 -0
- data/lib/ripper.rb +4 -0
- data/lib/ripper/core.rb +70 -0
- data/lib/ripper/filter.rb +70 -0
- data/lib/ripper/lexer.rb +179 -0
- data/lib/ripper/sexp.rb +99 -0
- metadata +94 -0
data/ext/extra/regenc.h
ADDED
data/ext/id.c
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
id.c -
|
4
|
+
|
5
|
+
$Author: akr $
|
6
|
+
created at: Thu Jul 12 04:37:51 2007
|
7
|
+
|
8
|
+
Copyright (C) 2004-2007 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
|
12
|
+
#include "ruby/ruby.h"
|
13
|
+
|
14
|
+
#include "id.h"
|
15
|
+
|
16
|
+
static void
|
17
|
+
Init_id(void)
|
18
|
+
{
|
19
|
+
#undef rb_intern
|
20
|
+
#define rb_intern(str) rb_intern_const(str)
|
21
|
+
rb_encoding *enc = rb_usascii_encoding();
|
22
|
+
|
23
|
+
REGISTER_SYMID(idNULL, "");
|
24
|
+
REGISTER_SYMID(idIFUNC, "<IFUNC>");
|
25
|
+
REGISTER_SYMID(idCFUNC, "<CFUNC>");
|
26
|
+
REGISTER_SYMID(idRespond_to, "respond_to?");
|
27
|
+
|
28
|
+
REGISTER_SYMID(id_core_set_method_alias, "core#set_method_alias");
|
29
|
+
REGISTER_SYMID(id_core_set_variable_alias, "core#set_variable_alias");
|
30
|
+
REGISTER_SYMID(id_core_undef_method, "core#undef_method");
|
31
|
+
REGISTER_SYMID(id_core_define_method, "core#define_method");
|
32
|
+
REGISTER_SYMID(id_core_define_singleton_method, "core#define_singleton_method");
|
33
|
+
REGISTER_SYMID(id_core_set_postexe, "core#set_postexe");
|
34
|
+
|
35
|
+
REGISTER_SYMID(idEach, "each");
|
36
|
+
REGISTER_SYMID(idLength, "length");
|
37
|
+
REGISTER_SYMID(idSize, "size");
|
38
|
+
REGISTER_SYMID(idLambda, "lambda");
|
39
|
+
REGISTER_SYMID(idIntern, "intern");
|
40
|
+
REGISTER_SYMID(idGets, "gets");
|
41
|
+
REGISTER_SYMID(idSucc, "succ");
|
42
|
+
REGISTER_SYMID(idMethodMissing, "method_missing");
|
43
|
+
#if SUPPORT_JOKE
|
44
|
+
REGISTER_SYMID(idBitblt, "bitblt");
|
45
|
+
REGISTER_SYMID(idAnswer, "the_answer_to_life_the_universe_and_everything");
|
46
|
+
#endif
|
47
|
+
REGISTER_SYMID(idSend, "send");
|
48
|
+
REGISTER_SYMID(id__send__, "__send__");
|
49
|
+
REGISTER_SYMID(idInitialize, "initialize");
|
50
|
+
}
|
data/ext/id.h
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
/* DO NOT EDIT THIS FILE DIRECTLY */
|
2
|
+
/**********************************************************************
|
3
|
+
|
4
|
+
id.h -
|
5
|
+
|
6
|
+
$Author: akr $
|
7
|
+
created at: Sun Oct 19 21:12:51 2008
|
8
|
+
|
9
|
+
Copyright (C) 2007 Koichi Sasada
|
10
|
+
|
11
|
+
**********************************************************************/
|
12
|
+
|
13
|
+
#ifndef RUBY_ID_H
|
14
|
+
#define RUBY_ID_H
|
15
|
+
|
16
|
+
#define ID_SCOPE_SHIFT 3
|
17
|
+
#define ID_SCOPE_MASK 0x07
|
18
|
+
#define ID_LOCAL 0x00
|
19
|
+
#define ID_INSTANCE 0x01
|
20
|
+
#define ID_GLOBAL 0x03
|
21
|
+
#define ID_ATTRSET 0x04
|
22
|
+
#define ID_CONST 0x05
|
23
|
+
#define ID_CLASS 0x06
|
24
|
+
#define ID_JUNK 0x07
|
25
|
+
#define ID_INTERNAL ID_JUNK
|
26
|
+
|
27
|
+
#ifdef USE_PARSE_H
|
28
|
+
#include "parse.h"
|
29
|
+
#endif
|
30
|
+
|
31
|
+
#define symIFUNC ID2SYM(idIFUNC)
|
32
|
+
#define symCFUNC ID2SYM(idCFUNC)
|
33
|
+
|
34
|
+
#if !defined tLAST_TOKEN && defined YYTOKENTYPE
|
35
|
+
#define tLAST_TOKEN tLAST_TOKEN
|
36
|
+
#endif
|
37
|
+
|
38
|
+
enum ruby_method_ids {
|
39
|
+
#ifndef tLAST_TOKEN
|
40
|
+
tUPLUS = 321,
|
41
|
+
tUMINUS = 322,
|
42
|
+
tPOW = 323,
|
43
|
+
tCMP = 324,
|
44
|
+
tEQ = 325,
|
45
|
+
tEQQ = 326,
|
46
|
+
tNEQ = 327,
|
47
|
+
tGEQ = 328,
|
48
|
+
tLEQ = 329,
|
49
|
+
tANDOP = 330,
|
50
|
+
tOROP = 331,
|
51
|
+
tMATCH = 332,
|
52
|
+
tNMATCH = 333,
|
53
|
+
tDOT2 = 334,
|
54
|
+
tDOT3 = 335,
|
55
|
+
tAREF = 336,
|
56
|
+
tASET = 337,
|
57
|
+
tLSHFT = 338,
|
58
|
+
tRSHFT = 339,
|
59
|
+
tLAMBDA = 352,
|
60
|
+
idNULL = 365,
|
61
|
+
idRespond_to = 366,
|
62
|
+
idIFUNC = 367,
|
63
|
+
idCFUNC = 368,
|
64
|
+
id_core_set_method_alias = 369,
|
65
|
+
id_core_set_variable_alias = 370,
|
66
|
+
id_core_undef_method = 371,
|
67
|
+
id_core_define_method = 372,
|
68
|
+
id_core_define_singleton_method = 373,
|
69
|
+
id_core_set_postexe = 374,
|
70
|
+
tLAST_TOKEN = 375,
|
71
|
+
#endif
|
72
|
+
idDot2 = tDOT2,
|
73
|
+
idDot3 = tDOT3,
|
74
|
+
idUPlus = tUPLUS,
|
75
|
+
idUMinus = tUMINUS,
|
76
|
+
idPow = tPOW,
|
77
|
+
idCmp = tCMP,
|
78
|
+
idPLUS = '+',
|
79
|
+
idMINUS = '-',
|
80
|
+
idMULT = '*',
|
81
|
+
idDIV = '/',
|
82
|
+
idMOD = '%',
|
83
|
+
idLT = '<',
|
84
|
+
idLTLT = tLSHFT,
|
85
|
+
idLE = tLEQ,
|
86
|
+
idGT = '>',
|
87
|
+
idGE = tGEQ,
|
88
|
+
idEq = tEQ,
|
89
|
+
idEqq = tEQQ,
|
90
|
+
idNeq = tNEQ,
|
91
|
+
idNot = '!',
|
92
|
+
idBackquote = '`',
|
93
|
+
idEqTilde = tMATCH,
|
94
|
+
idNeqTilde = tNMATCH,
|
95
|
+
idAREF = tAREF,
|
96
|
+
idASET = tASET,
|
97
|
+
idLAST_TOKEN = tLAST_TOKEN >> ID_SCOPE_SHIFT,
|
98
|
+
tIntern,
|
99
|
+
tMethodMissing,
|
100
|
+
tLength,
|
101
|
+
tSize,
|
102
|
+
tGets,
|
103
|
+
tSucc,
|
104
|
+
tEach,
|
105
|
+
tLambda,
|
106
|
+
tSend,
|
107
|
+
t__send__,
|
108
|
+
tInitialize,
|
109
|
+
#if SUPPORT_JOKE
|
110
|
+
tBitblt,
|
111
|
+
tAnswer,
|
112
|
+
#endif
|
113
|
+
tLAST_ID,
|
114
|
+
#define TOKEN2ID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
115
|
+
#if SUPPORT_JOKE
|
116
|
+
TOKEN2ID(Bitblt),
|
117
|
+
TOKEN2ID(Answer),
|
118
|
+
#endif
|
119
|
+
TOKEN2ID(Intern),
|
120
|
+
TOKEN2ID(MethodMissing),
|
121
|
+
TOKEN2ID(Length),
|
122
|
+
TOKEN2ID(Size),
|
123
|
+
TOKEN2ID(Gets),
|
124
|
+
TOKEN2ID(Succ),
|
125
|
+
TOKEN2ID(Each),
|
126
|
+
TOKEN2ID(Lambda),
|
127
|
+
TOKEN2ID(Send),
|
128
|
+
TOKEN2ID(__send__),
|
129
|
+
TOKEN2ID(Initialize)
|
130
|
+
};
|
131
|
+
|
132
|
+
#ifdef tLAST_TOKEN
|
133
|
+
struct ruby_method_ids_check {
|
134
|
+
#define ruby_method_id_check_for(name, value) \
|
135
|
+
int checking_for_##name[name == value ? 1 : -1]
|
136
|
+
ruby_method_id_check_for(tUPLUS, 321);
|
137
|
+
ruby_method_id_check_for(tUMINUS, 322);
|
138
|
+
ruby_method_id_check_for(tPOW, 323);
|
139
|
+
ruby_method_id_check_for(tCMP, 324);
|
140
|
+
ruby_method_id_check_for(tEQ, 325);
|
141
|
+
ruby_method_id_check_for(tEQQ, 326);
|
142
|
+
ruby_method_id_check_for(tNEQ, 327);
|
143
|
+
ruby_method_id_check_for(tGEQ, 328);
|
144
|
+
ruby_method_id_check_for(tLEQ, 329);
|
145
|
+
ruby_method_id_check_for(tANDOP, 330);
|
146
|
+
ruby_method_id_check_for(tOROP, 331);
|
147
|
+
ruby_method_id_check_for(tMATCH, 332);
|
148
|
+
ruby_method_id_check_for(tNMATCH, 333);
|
149
|
+
ruby_method_id_check_for(tDOT2, 334);
|
150
|
+
ruby_method_id_check_for(tDOT3, 335);
|
151
|
+
ruby_method_id_check_for(tAREF, 336);
|
152
|
+
ruby_method_id_check_for(tASET, 337);
|
153
|
+
ruby_method_id_check_for(tLSHFT, 338);
|
154
|
+
ruby_method_id_check_for(tRSHFT, 339);
|
155
|
+
ruby_method_id_check_for(tLAMBDA, 352);
|
156
|
+
ruby_method_id_check_for(idNULL, 365);
|
157
|
+
ruby_method_id_check_for(idRespond_to, 366);
|
158
|
+
ruby_method_id_check_for(idIFUNC, 367);
|
159
|
+
ruby_method_id_check_for(idCFUNC, 368);
|
160
|
+
ruby_method_id_check_for(id_core_set_method_alias, 369);
|
161
|
+
ruby_method_id_check_for(id_core_set_variable_alias, 370);
|
162
|
+
ruby_method_id_check_for(id_core_undef_method, 371);
|
163
|
+
ruby_method_id_check_for(id_core_define_method, 372);
|
164
|
+
ruby_method_id_check_for(id_core_define_singleton_method, 373);
|
165
|
+
ruby_method_id_check_for(id_core_set_postexe, 374);
|
166
|
+
ruby_method_id_check_for(tLAST_TOKEN, 375);
|
167
|
+
};
|
168
|
+
#endif
|
169
|
+
|
170
|
+
#endif /* RUBY_ID_H */
|
data/ext/lex.c
ADDED
@@ -0,0 +1,219 @@
|
|
1
|
+
/* C code produced by gperf version 3.0.4 */
|
2
|
+
/* Command-line: gperf -C -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' defs/keywords */
|
3
|
+
|
4
|
+
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
5
|
+
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
|
6
|
+
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
|
7
|
+
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
|
8
|
+
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
|
9
|
+
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
|
10
|
+
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
|
11
|
+
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
|
12
|
+
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
|
13
|
+
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
|
14
|
+
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
|
15
|
+
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
|
16
|
+
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
|
17
|
+
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
|
18
|
+
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
|
19
|
+
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
|
20
|
+
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
|
21
|
+
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
|
22
|
+
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
|
23
|
+
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
|
24
|
+
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
|
25
|
+
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
|
26
|
+
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
|
27
|
+
/* The character set is not based on ISO-646. */
|
28
|
+
error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
|
29
|
+
#endif
|
30
|
+
|
31
|
+
#line 1 "defs/keywords"
|
32
|
+
|
33
|
+
struct kwtable {const char *name; int id[2]; enum lex_state_e state;};
|
34
|
+
const struct kwtable *rb_reserved_word(const char *, unsigned int);
|
35
|
+
#ifdef RIPPER
|
36
|
+
static const struct kwtable *reserved_word(const char *, unsigned int);
|
37
|
+
#define rb_reserved_word(str, len) reserved_word(str, len)
|
38
|
+
#line 9 "defs/keywords"
|
39
|
+
struct kwtable;
|
40
|
+
|
41
|
+
#define TOTAL_KEYWORDS 41
|
42
|
+
#define MIN_WORD_LENGTH 2
|
43
|
+
#define MAX_WORD_LENGTH 12
|
44
|
+
#define MIN_HASH_VALUE 8
|
45
|
+
#define MAX_HASH_VALUE 50
|
46
|
+
/* maximum key range = 43, duplicates = 0 */
|
47
|
+
|
48
|
+
#ifdef __GNUC__
|
49
|
+
__inline
|
50
|
+
#else
|
51
|
+
#ifdef __cplusplus
|
52
|
+
inline
|
53
|
+
#endif
|
54
|
+
#endif
|
55
|
+
static unsigned int
|
56
|
+
hash (str, len)
|
57
|
+
register const char *str;
|
58
|
+
register unsigned int len;
|
59
|
+
{
|
60
|
+
static const unsigned char asso_values[] =
|
61
|
+
{
|
62
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
63
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
64
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
65
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
66
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
67
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
68
|
+
51, 51, 51, 26, 51, 51, 14, 51, 16, 8,
|
69
|
+
11, 13, 51, 51, 51, 51, 10, 51, 13, 51,
|
70
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
71
|
+
51, 51, 51, 51, 51, 11, 51, 13, 1, 26,
|
72
|
+
4, 1, 8, 28, 51, 23, 51, 1, 1, 27,
|
73
|
+
5, 19, 21, 51, 8, 3, 3, 11, 51, 21,
|
74
|
+
24, 16, 51, 51, 51, 51, 51, 51, 51, 51,
|
75
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
76
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
77
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
78
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
79
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
80
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
81
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
82
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
83
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
84
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
85
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
86
|
+
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
87
|
+
51, 51, 51, 51, 51, 51
|
88
|
+
};
|
89
|
+
register int hval = len;
|
90
|
+
|
91
|
+
switch (hval)
|
92
|
+
{
|
93
|
+
default:
|
94
|
+
hval += asso_values[(unsigned char)str[2]];
|
95
|
+
/*FALLTHROUGH*/
|
96
|
+
case 2:
|
97
|
+
case 1:
|
98
|
+
hval += asso_values[(unsigned char)str[0]];
|
99
|
+
break;
|
100
|
+
}
|
101
|
+
return hval + asso_values[(unsigned char)str[len - 1]];
|
102
|
+
}
|
103
|
+
|
104
|
+
#ifdef __GNUC__
|
105
|
+
__inline
|
106
|
+
#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
|
107
|
+
__attribute__ ((__gnu_inline__))
|
108
|
+
#endif
|
109
|
+
#endif
|
110
|
+
const struct kwtable *
|
111
|
+
rb_reserved_word (str, len)
|
112
|
+
register const char *str;
|
113
|
+
register unsigned int len;
|
114
|
+
{
|
115
|
+
static const struct kwtable wordlist[] =
|
116
|
+
{
|
117
|
+
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
118
|
+
#line 19 "defs/keywords"
|
119
|
+
{"break", {keyword_break, keyword_break}, EXPR_MID},
|
120
|
+
#line 25 "defs/keywords"
|
121
|
+
{"else", {keyword_else, keyword_else}, EXPR_BEG},
|
122
|
+
#line 35 "defs/keywords"
|
123
|
+
{"nil", {keyword_nil, keyword_nil}, EXPR_END},
|
124
|
+
#line 28 "defs/keywords"
|
125
|
+
{"ensure", {keyword_ensure, keyword_ensure}, EXPR_BEG},
|
126
|
+
#line 27 "defs/keywords"
|
127
|
+
{"end", {keyword_end, keyword_end}, EXPR_END},
|
128
|
+
#line 44 "defs/keywords"
|
129
|
+
{"then", {keyword_then, keyword_then}, EXPR_BEG},
|
130
|
+
#line 36 "defs/keywords"
|
131
|
+
{"not", {keyword_not, keyword_not}, EXPR_ARG},
|
132
|
+
#line 29 "defs/keywords"
|
133
|
+
{"false", {keyword_false, keyword_false}, EXPR_END},
|
134
|
+
#line 42 "defs/keywords"
|
135
|
+
{"self", {keyword_self, keyword_self}, EXPR_END},
|
136
|
+
#line 26 "defs/keywords"
|
137
|
+
{"elsif", {keyword_elsif, keyword_elsif}, EXPR_VALUE},
|
138
|
+
#line 39 "defs/keywords"
|
139
|
+
{"rescue", {keyword_rescue, modifier_rescue}, EXPR_MID},
|
140
|
+
#line 45 "defs/keywords"
|
141
|
+
{"true", {keyword_true, keyword_true}, EXPR_END},
|
142
|
+
#line 48 "defs/keywords"
|
143
|
+
{"until", {keyword_until, modifier_until}, EXPR_VALUE},
|
144
|
+
#line 47 "defs/keywords"
|
145
|
+
{"unless", {keyword_unless, modifier_unless}, EXPR_VALUE},
|
146
|
+
#line 41 "defs/keywords"
|
147
|
+
{"return", {keyword_return, keyword_return}, EXPR_MID},
|
148
|
+
#line 22 "defs/keywords"
|
149
|
+
{"def", {keyword_def, keyword_def}, EXPR_FNAME},
|
150
|
+
#line 17 "defs/keywords"
|
151
|
+
{"and", {keyword_and, keyword_and}, EXPR_VALUE},
|
152
|
+
#line 24 "defs/keywords"
|
153
|
+
{"do", {keyword_do, keyword_do}, EXPR_BEG},
|
154
|
+
#line 51 "defs/keywords"
|
155
|
+
{"yield", {keyword_yield, keyword_yield}, EXPR_ARG},
|
156
|
+
#line 30 "defs/keywords"
|
157
|
+
{"for", {keyword_for, keyword_for}, EXPR_VALUE},
|
158
|
+
#line 46 "defs/keywords"
|
159
|
+
{"undef", {keyword_undef, keyword_undef}, EXPR_FNAME},
|
160
|
+
#line 37 "defs/keywords"
|
161
|
+
{"or", {keyword_or, keyword_or}, EXPR_VALUE},
|
162
|
+
#line 32 "defs/keywords"
|
163
|
+
{"in", {keyword_in, keyword_in}, EXPR_VALUE},
|
164
|
+
#line 49 "defs/keywords"
|
165
|
+
{"when", {keyword_when, keyword_when}, EXPR_VALUE},
|
166
|
+
#line 40 "defs/keywords"
|
167
|
+
{"retry", {keyword_retry, keyword_retry}, EXPR_END},
|
168
|
+
#line 31 "defs/keywords"
|
169
|
+
{"if", {keyword_if, modifier_if}, EXPR_VALUE},
|
170
|
+
#line 20 "defs/keywords"
|
171
|
+
{"case", {keyword_case, keyword_case}, EXPR_VALUE},
|
172
|
+
#line 38 "defs/keywords"
|
173
|
+
{"redo", {keyword_redo, keyword_redo}, EXPR_END},
|
174
|
+
#line 34 "defs/keywords"
|
175
|
+
{"next", {keyword_next, keyword_next}, EXPR_MID},
|
176
|
+
#line 43 "defs/keywords"
|
177
|
+
{"super", {keyword_super, keyword_super}, EXPR_ARG},
|
178
|
+
#line 33 "defs/keywords"
|
179
|
+
{"module", {keyword_module, keyword_module}, EXPR_VALUE},
|
180
|
+
#line 18 "defs/keywords"
|
181
|
+
{"begin", {keyword_begin, keyword_begin}, EXPR_BEG},
|
182
|
+
#line 12 "defs/keywords"
|
183
|
+
{"__LINE__", {keyword__LINE__, keyword__LINE__}, EXPR_END},
|
184
|
+
#line 13 "defs/keywords"
|
185
|
+
{"__FILE__", {keyword__FILE__, keyword__FILE__}, EXPR_END},
|
186
|
+
#line 11 "defs/keywords"
|
187
|
+
{"__ENCODING__", {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END},
|
188
|
+
#line 15 "defs/keywords"
|
189
|
+
{"END", {keyword_END, keyword_END}, EXPR_END},
|
190
|
+
#line 16 "defs/keywords"
|
191
|
+
{"alias", {keyword_alias, keyword_alias}, EXPR_FNAME},
|
192
|
+
#line 14 "defs/keywords"
|
193
|
+
{"BEGIN", {keyword_BEGIN, keyword_BEGIN}, EXPR_END},
|
194
|
+
#line 23 "defs/keywords"
|
195
|
+
{"defined?", {keyword_defined, keyword_defined}, EXPR_ARG},
|
196
|
+
#line 21 "defs/keywords"
|
197
|
+
{"class", {keyword_class, keyword_class}, EXPR_CLASS},
|
198
|
+
{""}, {""},
|
199
|
+
#line 50 "defs/keywords"
|
200
|
+
{"while", {keyword_while, modifier_while}, EXPR_VALUE}
|
201
|
+
};
|
202
|
+
|
203
|
+
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
204
|
+
{
|
205
|
+
register int key = hash (str, len);
|
206
|
+
|
207
|
+
if (key <= MAX_HASH_VALUE && key >= 0)
|
208
|
+
{
|
209
|
+
register const char *s = wordlist[key].name;
|
210
|
+
|
211
|
+
if (*str == *s && !strcmp (str + 1, s + 1))
|
212
|
+
return &wordlist[key];
|
213
|
+
}
|
214
|
+
}
|
215
|
+
return 0;
|
216
|
+
}
|
217
|
+
#line 52 "defs/keywords"
|
218
|
+
|
219
|
+
#endif
|
data/ext/parse.h
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
/* A Bison parser, made by GNU Bison 2.4.3. */
|
2
|
+
|
3
|
+
/* Skeleton interface for Bison's Yacc-like parsers in C
|
4
|
+
|
5
|
+
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
6
|
+
2009, 2010 Free Software Foundation, Inc.
|
7
|
+
|
8
|
+
This program is free software: you can redistribute it and/or modify
|
9
|
+
it under the terms of the GNU General Public License as published by
|
10
|
+
the Free Software Foundation, either version 3 of the License, or
|
11
|
+
(at your option) any later version.
|
12
|
+
|
13
|
+
This program is distributed in the hope that it will be useful,
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
GNU General Public License for more details.
|
17
|
+
|
18
|
+
You should have received a copy of the GNU General Public License
|
19
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
20
|
+
|
21
|
+
/* As a special exception, you may create a larger work that contains
|
22
|
+
part or all of the Bison parser skeleton and distribute that work
|
23
|
+
under terms of your choice, so long as that work isn't itself a
|
24
|
+
parser generator using the skeleton or a modified version thereof
|
25
|
+
as a parser skeleton. Alternatively, if you modify or redistribute
|
26
|
+
the parser skeleton itself, you may (at your option) remove this
|
27
|
+
special exception, which will cause the skeleton and the resulting
|
28
|
+
Bison output files to be licensed under the GNU General Public
|
29
|
+
License without this special exception.
|
30
|
+
|
31
|
+
This special exception was added by the Free Software Foundation in
|
32
|
+
version 2.2 of Bison. */
|
33
|
+
|
34
|
+
|
35
|
+
/* Tokens. */
|
36
|
+
#ifndef YYTOKENTYPE
|
37
|
+
# define YYTOKENTYPE
|
38
|
+
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
39
|
+
know about them. */
|
40
|
+
enum yytokentype {
|
41
|
+
keyword_class = 258,
|
42
|
+
keyword_module = 259,
|
43
|
+
keyword_def = 260,
|
44
|
+
keyword_undef = 261,
|
45
|
+
keyword_begin = 262,
|
46
|
+
keyword_rescue = 263,
|
47
|
+
keyword_ensure = 264,
|
48
|
+
keyword_end = 265,
|
49
|
+
keyword_if = 266,
|
50
|
+
keyword_unless = 267,
|
51
|
+
keyword_then = 268,
|
52
|
+
keyword_elsif = 269,
|
53
|
+
keyword_else = 270,
|
54
|
+
keyword_case = 271,
|
55
|
+
keyword_when = 272,
|
56
|
+
keyword_while = 273,
|
57
|
+
keyword_until = 274,
|
58
|
+
keyword_for = 275,
|
59
|
+
keyword_break = 276,
|
60
|
+
keyword_next = 277,
|
61
|
+
keyword_redo = 278,
|
62
|
+
keyword_retry = 279,
|
63
|
+
keyword_in = 280,
|
64
|
+
keyword_do = 281,
|
65
|
+
keyword_do_cond = 282,
|
66
|
+
keyword_do_block = 283,
|
67
|
+
keyword_do_LAMBDA = 284,
|
68
|
+
keyword_return = 285,
|
69
|
+
keyword_yield = 286,
|
70
|
+
keyword_super = 287,
|
71
|
+
keyword_self = 288,
|
72
|
+
keyword_nil = 289,
|
73
|
+
keyword_true = 290,
|
74
|
+
keyword_false = 291,
|
75
|
+
keyword_and = 292,
|
76
|
+
keyword_or = 293,
|
77
|
+
keyword_not = 294,
|
78
|
+
modifier_if = 295,
|
79
|
+
modifier_unless = 296,
|
80
|
+
modifier_while = 297,
|
81
|
+
modifier_until = 298,
|
82
|
+
modifier_rescue = 299,
|
83
|
+
keyword_alias = 300,
|
84
|
+
keyword_defined = 301,
|
85
|
+
keyword_BEGIN = 302,
|
86
|
+
keyword_END = 303,
|
87
|
+
keyword__LINE__ = 304,
|
88
|
+
keyword__FILE__ = 305,
|
89
|
+
keyword__ENCODING__ = 306,
|
90
|
+
tIDENTIFIER = 307,
|
91
|
+
tFID = 308,
|
92
|
+
tGVAR = 309,
|
93
|
+
tIVAR = 310,
|
94
|
+
tCONSTANT = 311,
|
95
|
+
tCVAR = 312,
|
96
|
+
tLABEL = 313,
|
97
|
+
tINTEGER = 314,
|
98
|
+
tFLOAT = 315,
|
99
|
+
tSTRING_CONTENT = 316,
|
100
|
+
tCHAR = 317,
|
101
|
+
tNTH_REF = 318,
|
102
|
+
tBACK_REF = 319,
|
103
|
+
tREGEXP_END = 320,
|
104
|
+
tUPLUS = 321,
|
105
|
+
tUMINUS = 322,
|
106
|
+
tPOW = 323,
|
107
|
+
tCMP = 324,
|
108
|
+
tEQ = 325,
|
109
|
+
tEQQ = 326,
|
110
|
+
tNEQ = 327,
|
111
|
+
tGEQ = 328,
|
112
|
+
tLEQ = 329,
|
113
|
+
tANDOP = 330,
|
114
|
+
tOROP = 331,
|
115
|
+
tMATCH = 332,
|
116
|
+
tNMATCH = 333,
|
117
|
+
tDOT2 = 334,
|
118
|
+
tDOT3 = 335,
|
119
|
+
tAREF = 336,
|
120
|
+
tASET = 337,
|
121
|
+
tLSHFT = 338,
|
122
|
+
tRSHFT = 339,
|
123
|
+
tCOLON2 = 340,
|
124
|
+
tCOLON3 = 341,
|
125
|
+
tOP_ASGN = 342,
|
126
|
+
tASSOC = 343,
|
127
|
+
tLPAREN = 344,
|
128
|
+
tLPAREN_ARG = 345,
|
129
|
+
tRPAREN = 346,
|
130
|
+
tLBRACK = 347,
|
131
|
+
tLBRACE = 348,
|
132
|
+
tLBRACE_ARG = 349,
|
133
|
+
tSTAR = 350,
|
134
|
+
tAMPER = 351,
|
135
|
+
tLAMBDA = 352,
|
136
|
+
tSYMBEG = 353,
|
137
|
+
tSTRING_BEG = 354,
|
138
|
+
tXSTRING_BEG = 355,
|
139
|
+
tREGEXP_BEG = 356,
|
140
|
+
tWORDS_BEG = 357,
|
141
|
+
tQWORDS_BEG = 358,
|
142
|
+
tSTRING_DBEG = 359,
|
143
|
+
tSTRING_DVAR = 360,
|
144
|
+
tSTRING_END = 361,
|
145
|
+
tLAMBEG = 362,
|
146
|
+
tLOWEST = 363,
|
147
|
+
tUMINUS_NUM = 364,
|
148
|
+
idNULL = 365,
|
149
|
+
idRespond_to = 366,
|
150
|
+
idIFUNC = 367,
|
151
|
+
idCFUNC = 368,
|
152
|
+
id_core_set_method_alias = 369,
|
153
|
+
id_core_set_variable_alias = 370,
|
154
|
+
id_core_undef_method = 371,
|
155
|
+
id_core_define_method = 372,
|
156
|
+
id_core_define_singleton_method = 373,
|
157
|
+
id_core_set_postexe = 374,
|
158
|
+
tLAST_TOKEN = 375
|
159
|
+
};
|
160
|
+
#endif
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
165
|
+
typedef union YYSTYPE
|
166
|
+
{
|
167
|
+
|
168
|
+
/* Line 1685 of yacc.c */
|
169
|
+
|
170
|
+
VALUE val;
|
171
|
+
NODE *node;
|
172
|
+
ID id;
|
173
|
+
int num;
|
174
|
+
const struct vtable *vars;
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
/* Line 1685 of yacc.c */
|
179
|
+
} YYSTYPE;
|
180
|
+
# define YYSTYPE_IS_TRIVIAL 1
|
181
|
+
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
182
|
+
# define YYSTYPE_IS_DECLARED 1
|
183
|
+
#endif
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|