зеркало из https://github.com/github/ruby.git
* ext/socket/socket.c (sock_accept): revert to avoid ambiguity of
argument evaluation order. [ruby-dev:28861] * ext/socket/socket.c (sock_accept_nonblock): ditto. * io.c (pipe_open): avoid closing uninitialized file descriptors. a patch from <tommy at tmtm.org> [ruby-dev:28600] * parse.y: replace terminal token names with more descriptive name, i.e. kEND to keyword_end. [ruby-list:42477] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6fa7d6cb01
Коммит
e5f2b421c0
17
ChangeLog
17
ChangeLog
|
@ -3,6 +3,18 @@ Mon Jun 26 18:37:44 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||||
* ext/tk/tcltklib.c (ip_delete): fix SEGV when a slave-ip is
|
* ext/tk/tcltklib.c (ip_delete): fix SEGV when a slave-ip is
|
||||||
deleted on callback.
|
deleted on callback.
|
||||||
|
|
||||||
|
Mon Jun 26 15:40:26 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/socket/socket.c (sock_accept): revert to avoid ambiguity of
|
||||||
|
argument evaluation order. [ruby-dev:28861]
|
||||||
|
|
||||||
|
* ext/socket/socket.c (sock_accept_nonblock): ditto.
|
||||||
|
|
||||||
|
Mon Jun 26 10:47:42 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* io.c (pipe_open): avoid closing uninitialized file descriptors.
|
||||||
|
a patch from <tommy at tmtm.org> [ruby-dev:28600]
|
||||||
|
|
||||||
Sun Jun 25 23:02:12 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Jun 25 23:02:12 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* Makefile.in, mkconfig.rb: catch-up for latest autoconf.
|
* Makefile.in, mkconfig.rb: catch-up for latest autoconf.
|
||||||
|
@ -19,6 +31,11 @@ Sun Jun 25 17:18:33 2006 Masaki Suketa <masaki.suketa@nifty.ne.jp>
|
||||||
|
|
||||||
* test/win32ole/test_word.rb: ditto.
|
* test/win32ole/test_word.rb: ditto.
|
||||||
|
|
||||||
|
Sat Jun 24 23:48:08 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* parse.y: replace terminal token names with more descriptive
|
||||||
|
name, i.e. kEND to keyword_end. [ruby-list:42477]
|
||||||
|
|
||||||
Sat Jun 24 23:37:41 2006 Tanaka Akira <akr@m17n.org>
|
Sat Jun 24 23:37:41 2006 Tanaka Akira <akr@m17n.org>
|
||||||
|
|
||||||
* eval.c (rb_eval): use rb_ary_new2 instead of rb_ary_new4 to avoid
|
* eval.c (rb_eval): use rb_ary_new2 instead of rb_ary_new4 to avoid
|
||||||
|
|
|
@ -137,53 +137,53 @@ static struct token_assoc {
|
||||||
{';', &ripper_id_semicolon},
|
{';', &ripper_id_semicolon},
|
||||||
{'`', &ripper_id_backtick},
|
{'`', &ripper_id_backtick},
|
||||||
{'\n', &ripper_id_nl},
|
{'\n', &ripper_id_nl},
|
||||||
{kALIAS, &ripper_id_kw},
|
{keyword_alias, &ripper_id_kw},
|
||||||
{kAND, &ripper_id_kw},
|
{keyword_and, &ripper_id_kw},
|
||||||
{kBEGIN, &ripper_id_kw},
|
{keyword_begin, &ripper_id_kw},
|
||||||
{kBREAK, &ripper_id_kw},
|
{keyword_break, &ripper_id_kw},
|
||||||
{kCASE, &ripper_id_kw},
|
{keyword_case, &ripper_id_kw},
|
||||||
{kCLASS, &ripper_id_kw},
|
{keyword_class, &ripper_id_kw},
|
||||||
{kDEF, &ripper_id_kw},
|
{keyword_def, &ripper_id_kw},
|
||||||
{kDEFINED, &ripper_id_kw},
|
{keyword_defined, &ripper_id_kw},
|
||||||
{kDO, &ripper_id_kw},
|
{keyword_do, &ripper_id_kw},
|
||||||
{kDO_BLOCK, &ripper_id_kw},
|
{keyword_do_block, &ripper_id_kw},
|
||||||
{kDO_COND, &ripper_id_kw},
|
{keyword_do_cond, &ripper_id_kw},
|
||||||
{kELSE, &ripper_id_kw},
|
{keyword_else, &ripper_id_kw},
|
||||||
{kELSIF, &ripper_id_kw},
|
{keyword_elsif, &ripper_id_kw},
|
||||||
{kEND, &ripper_id_kw},
|
{keyword_end, &ripper_id_kw},
|
||||||
{kENSURE, &ripper_id_kw},
|
{keyword_ensure, &ripper_id_kw},
|
||||||
{kFALSE, &ripper_id_kw},
|
{keyword_false, &ripper_id_kw},
|
||||||
{kFOR, &ripper_id_kw},
|
{keyword_for, &ripper_id_kw},
|
||||||
{kIF, &ripper_id_kw},
|
{keyword_if, &ripper_id_kw},
|
||||||
{kIF_MOD, &ripper_id_kw},
|
{modifier_if, &ripper_id_kw},
|
||||||
{kIN, &ripper_id_kw},
|
{keyword_in, &ripper_id_kw},
|
||||||
{kMODULE, &ripper_id_kw},
|
{keyword_module, &ripper_id_kw},
|
||||||
{kNEXT, &ripper_id_kw},
|
{keyword_next, &ripper_id_kw},
|
||||||
{kNIL, &ripper_id_kw},
|
{keyword_nil, &ripper_id_kw},
|
||||||
{kNOT, &ripper_id_kw},
|
{keyword_not, &ripper_id_kw},
|
||||||
{kOR, &ripper_id_kw},
|
{keyword_or, &ripper_id_kw},
|
||||||
{kREDO, &ripper_id_kw},
|
{keyword_redo, &ripper_id_kw},
|
||||||
{kRESCUE, &ripper_id_kw},
|
{keyword_rescue, &ripper_id_kw},
|
||||||
{kRESCUE_MOD, &ripper_id_kw},
|
{modifier_rescue, &ripper_id_kw},
|
||||||
{kRETRY, &ripper_id_kw},
|
{keyword_retry, &ripper_id_kw},
|
||||||
{kRETURN, &ripper_id_kw},
|
{keyword_return, &ripper_id_kw},
|
||||||
{kSELF, &ripper_id_kw},
|
{keyword_self, &ripper_id_kw},
|
||||||
{kSUPER, &ripper_id_kw},
|
{keyword_super, &ripper_id_kw},
|
||||||
{kTHEN, &ripper_id_kw},
|
{keyword_then, &ripper_id_kw},
|
||||||
{kTRUE, &ripper_id_kw},
|
{keyword_true, &ripper_id_kw},
|
||||||
{kUNDEF, &ripper_id_kw},
|
{keyword_undef, &ripper_id_kw},
|
||||||
{kUNLESS, &ripper_id_kw},
|
{keyword_unless, &ripper_id_kw},
|
||||||
{kUNLESS_MOD, &ripper_id_kw},
|
{modifier_unless, &ripper_id_kw},
|
||||||
{kUNTIL, &ripper_id_kw},
|
{keyword_until, &ripper_id_kw},
|
||||||
{kUNTIL_MOD, &ripper_id_kw},
|
{modifier_until, &ripper_id_kw},
|
||||||
{kWHEN, &ripper_id_kw},
|
{keyword_when, &ripper_id_kw},
|
||||||
{kWHILE, &ripper_id_kw},
|
{keyword_while, &ripper_id_kw},
|
||||||
{kWHILE_MOD, &ripper_id_kw},
|
{modifier_while, &ripper_id_kw},
|
||||||
{kYIELD, &ripper_id_kw},
|
{keyword_yield, &ripper_id_kw},
|
||||||
{k__FILE__, &ripper_id_kw},
|
{keyword__FILE__, &ripper_id_kw},
|
||||||
{k__LINE__, &ripper_id_kw},
|
{keyword__LINE__, &ripper_id_kw},
|
||||||
{klBEGIN, &ripper_id_kw},
|
{keyword_BEGIN, &ripper_id_kw},
|
||||||
{klEND, &ripper_id_kw},
|
{keyword_END, &ripper_id_kw},
|
||||||
{tAMPER, &ripper_id_op},
|
{tAMPER, &ripper_id_op},
|
||||||
{tANDOP, &ripper_id_op},
|
{tANDOP, &ripper_id_op},
|
||||||
{tAREF, &ripper_id_op},
|
{tAREF, &ripper_id_op},
|
||||||
|
|
|
@ -2815,15 +2815,18 @@ sock_recvfrom_nonblock(int argc, VALUE *argv, VALUE sock)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
sock_accept(VALUE sock)
|
sock_accept(sock)
|
||||||
|
VALUE sock;
|
||||||
{
|
{
|
||||||
OpenFile *fptr;
|
OpenFile *fptr;
|
||||||
|
VALUE sock2;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
socklen_t len = sizeof buf;
|
socklen_t len = sizeof buf;
|
||||||
|
|
||||||
GetOpenFile(sock, fptr);
|
GetOpenFile(sock, fptr);
|
||||||
return rb_assoc_new(s_accept(rb_cSocket,fptr->fd,(struct sockaddr*)buf, &len),
|
sock2 = s_accept(rb_cSocket,fptr->fd,(struct sockaddr*)buf,&len);
|
||||||
rb_str_new(buf, len));
|
|
||||||
|
return rb_assoc_new(sock2, rb_str_new(buf, len));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2875,16 +2878,17 @@ sock_accept(VALUE sock)
|
||||||
* * Socket#accept
|
* * Socket#accept
|
||||||
*/
|
*/
|
||||||
static VALUE
|
static VALUE
|
||||||
sock_accept_nonblock(VALUE sock)
|
sock_accept_nonblock(sock)
|
||||||
|
VALUE sock;
|
||||||
{
|
{
|
||||||
OpenFile *fptr;
|
OpenFile *fptr;
|
||||||
|
VALUE sock2;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
socklen_t len = sizeof buf;
|
socklen_t len = sizeof buf;
|
||||||
|
|
||||||
GetOpenFile(sock, fptr);
|
GetOpenFile(sock, fptr);
|
||||||
return rb_assoc_new(s_accept_nonblock(rb_cSocket, fptr,
|
sock2 = s_accept_nonblock(rb_cSocket, fptr, (struct sockaddr *)buf, &len);
|
||||||
(struct sockaddr *)buf, &len),
|
return rb_assoc_new(sock2, rb_str_new(buf, len));
|
||||||
rb_str_new(buf, len));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
10
io.c
10
io.c
|
@ -3029,8 +3029,14 @@ pipe_open(int argc, VALUE *argv, const char *mode)
|
||||||
/* parent */
|
/* parent */
|
||||||
if (pid == -1) {
|
if (pid == -1) {
|
||||||
int e = errno;
|
int e = errno;
|
||||||
close(arg.pair[0]);
|
if ((modef & FMODE_READABLE)) {
|
||||||
close(arg.pair[1]);
|
close(arg.pair[0]);
|
||||||
|
close(arg.pair[1]);
|
||||||
|
}
|
||||||
|
if ((modef & FMODE_WRITABLE)) {
|
||||||
|
close(arg.pair[0]);
|
||||||
|
close(arg.pair[1]);
|
||||||
|
}
|
||||||
errno = e;
|
errno = e;
|
||||||
rb_sys_fail(cmd);
|
rb_sys_fail(cmd);
|
||||||
}
|
}
|
||||||
|
|
80
keywords
80
keywords
|
@ -3,45 +3,45 @@ const struct kwtable *rb_reserved_word _((const char *, unsigned int));
|
||||||
#ifndef RIPPER
|
#ifndef RIPPER
|
||||||
|
|
||||||
%%
|
%%
|
||||||
__LINE__, {k__LINE__, k__LINE__}, EXPR_END
|
__LINE__, {keyword__LINE__, keyword__LINE__}, EXPR_END
|
||||||
__FILE__, {k__FILE__, k__FILE__}, EXPR_END
|
__FILE__, {keyword__FILE__, keyword__FILE__}, EXPR_END
|
||||||
BEGIN, {klBEGIN, klBEGIN}, EXPR_END
|
BEGIN, {keyword_BEGIN, keyword_BEGIN}, EXPR_END
|
||||||
END, {klEND, klEND}, EXPR_END
|
END, {keyword_END, keyword_END}, EXPR_END
|
||||||
alias, {kALIAS, kALIAS}, EXPR_FNAME
|
alias, {keyword_alias, keyword_alias}, EXPR_FNAME
|
||||||
and, {kAND, kAND}, EXPR_VALUE
|
and, {keyword_and, keyword_and}, EXPR_VALUE
|
||||||
begin, {kBEGIN, kBEGIN}, EXPR_BEG
|
begin, {keyword_begin, keyword_begin}, EXPR_BEG
|
||||||
break, {kBREAK, kBREAK}, EXPR_MID
|
break, {keyword_break, keyword_break}, EXPR_MID
|
||||||
case, {kCASE, kCASE}, EXPR_VALUE
|
case, {keyword_case, keyword_case}, EXPR_VALUE
|
||||||
class, {kCLASS, kCLASS}, EXPR_CLASS
|
class, {keyword_class, keyword_class}, EXPR_CLASS
|
||||||
def, {kDEF, kDEF}, EXPR_FNAME
|
def, {keyword_def, keyword_def}, EXPR_FNAME
|
||||||
defined?, {kDEFINED, kDEFINED}, EXPR_ARG
|
defined?, {keyword_defined, keyword_defined}, EXPR_ARG
|
||||||
do, {kDO, kDO}, EXPR_BEG
|
do, {keyword_do, keyword_do}, EXPR_BEG
|
||||||
else, {kELSE, kELSE}, EXPR_BEG
|
else, {keyword_else, keyword_else}, EXPR_BEG
|
||||||
elsif, {kELSIF, kELSIF}, EXPR_VALUE
|
elsif, {keyword_elsif, keyword_elsif}, EXPR_VALUE
|
||||||
end, {kEND, kEND}, EXPR_END
|
end, {keyword_end, keyword_end}, EXPR_END
|
||||||
ensure, {kENSURE, kENSURE}, EXPR_BEG
|
ensure, {keyword_ensure, keyword_ensure}, EXPR_BEG
|
||||||
false, {kFALSE, kFALSE}, EXPR_END
|
false, {keyword_false, keyword_false}, EXPR_END
|
||||||
for, {kFOR, kFOR}, EXPR_VALUE
|
for, {keyword_for, keyword_for}, EXPR_VALUE
|
||||||
if, {kIF, kIF_MOD}, EXPR_VALUE
|
if, {keyword_if, modifier_if}, EXPR_VALUE
|
||||||
in, {kIN, kIN}, EXPR_VALUE
|
in, {keyword_in, keyword_in}, EXPR_VALUE
|
||||||
module, {kMODULE, kMODULE}, EXPR_VALUE
|
module, {keyword_module, keyword_module}, EXPR_VALUE
|
||||||
next, {kNEXT, kNEXT}, EXPR_MID
|
next, {keyword_next, keyword_next}, EXPR_MID
|
||||||
nil, {kNIL, kNIL}, EXPR_END
|
nil, {keyword_nil, keyword_nil}, EXPR_END
|
||||||
not, {kNOT, kNOT}, EXPR_VALUE
|
not, {keyword_not, keyword_not}, EXPR_VALUE
|
||||||
or, {kOR, kOR}, EXPR_VALUE
|
or, {keyword_or, keyword_or}, EXPR_VALUE
|
||||||
redo, {kREDO, kREDO}, EXPR_END
|
redo, {keyword_redo, keyword_redo}, EXPR_END
|
||||||
rescue, {kRESCUE, kRESCUE_MOD}, EXPR_MID
|
rescue, {keyword_rescue, modifier_rescue}, EXPR_MID
|
||||||
retry, {kRETRY, kRETRY}, EXPR_END
|
retry, {keyword_retry, keyword_retry}, EXPR_END
|
||||||
return, {kRETURN, kRETURN}, EXPR_MID
|
return, {keyword_return, keyword_return}, EXPR_MID
|
||||||
self, {kSELF, kSELF}, EXPR_END
|
self, {keyword_self, keyword_self}, EXPR_END
|
||||||
super, {kSUPER, kSUPER}, EXPR_ARG
|
super, {keyword_super, keyword_super}, EXPR_ARG
|
||||||
then, {kTHEN, kTHEN}, EXPR_BEG
|
then, {keyword_then, keyword_then}, EXPR_BEG
|
||||||
true, {kTRUE, kTRUE}, EXPR_END
|
true, {keyword_true, keyword_true}, EXPR_END
|
||||||
undef, {kUNDEF, kUNDEF}, EXPR_FNAME
|
undef, {keyword_undef, keyword_undef}, EXPR_FNAME
|
||||||
unless, {kUNLESS, kUNLESS_MOD}, EXPR_VALUE
|
unless, {keyword_unless, modifier_unless}, EXPR_VALUE
|
||||||
until, {kUNTIL, kUNTIL_MOD}, EXPR_VALUE
|
until, {keyword_until, modifier_until}, EXPR_VALUE
|
||||||
when, {kWHEN, kWHEN}, EXPR_VALUE
|
when, {keyword_when, keyword_when}, EXPR_VALUE
|
||||||
while, {kWHILE, kWHILE_MOD}, EXPR_VALUE
|
while, {keyword_while, modifier_while}, EXPR_VALUE
|
||||||
yield, {kYIELD, kYIELD}, EXPR_ARG
|
yield, {keyword_yield, keyword_yield}, EXPR_ARG
|
||||||
%%
|
%%
|
||||||
#endif
|
#endif
|
||||||
|
|
217
lex.c
217
lex.c
|
@ -1,16 +1,44 @@
|
||||||
/* C code produced by gperf version 2.7.2 */
|
/* C code produced by gperf version 3.0.1 */
|
||||||
/* Command-line: gperf -C -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' keywords */
|
/* Command-line: gperf -C -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' keywords */
|
||||||
|
|
||||||
|
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
||||||
|
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
|
||||||
|
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
|
||||||
|
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
|
||||||
|
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
|
||||||
|
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
|
||||||
|
&& ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
|
||||||
|
&& ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
|
||||||
|
&& ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
|
||||||
|
&& ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
|
||||||
|
&& ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
|
||||||
|
&& ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
|
||||||
|
&& ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
|
||||||
|
&& ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
|
||||||
|
&& ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
|
||||||
|
&& ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
|
||||||
|
&& ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
|
||||||
|
&& ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
|
||||||
|
&& ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
|
||||||
|
&& ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
|
||||||
|
&& ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
|
||||||
|
&& ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
|
||||||
|
&& ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
|
||||||
|
/* The character set is not based on ISO-646. */
|
||||||
|
error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#line 1 "keywords"
|
||||||
struct kwtable {char *name; int id[2]; enum lex_state_e state;};
|
struct kwtable {char *name; int id[2]; enum lex_state_e state;};
|
||||||
const struct kwtable *rb_reserved_word(const char *, unsigned int);
|
const struct kwtable *rb_reserved_word _((const char *, unsigned int));
|
||||||
#ifndef RIPPER
|
#ifndef RIPPER
|
||||||
;
|
|
||||||
|
|
||||||
#define TOTAL_KEYWORDS 40
|
#define TOTAL_KEYWORDS 40
|
||||||
#define MIN_WORD_LENGTH 2
|
#define MIN_WORD_LENGTH 2
|
||||||
#define MAX_WORD_LENGTH 8
|
#define MAX_WORD_LENGTH 8
|
||||||
#define MIN_HASH_VALUE 6
|
#define MIN_HASH_VALUE 6
|
||||||
#define MAX_HASH_VALUE 55
|
#define MAX_HASH_VALUE 50
|
||||||
/* maximum key range = 50, duplicates = 0 */
|
/* maximum key range = 45, duplicates = 0 */
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
__inline
|
__inline
|
||||||
|
@ -26,40 +54,40 @@ hash (str, len)
|
||||||
{
|
{
|
||||||
static const unsigned char asso_values[] =
|
static const unsigned char asso_values[] =
|
||||||
{
|
{
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 11, 56, 56, 36, 56, 1, 37,
|
51, 51, 51, 23, 51, 51, 13, 51, 1, 1,
|
||||||
31, 1, 56, 56, 56, 56, 29, 56, 1, 56,
|
11, 12, 51, 51, 51, 51, 10, 51, 12, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 1, 56, 32, 1, 2,
|
51, 51, 51, 51, 51, 11, 51, 13, 1, 26,
|
||||||
1, 1, 4, 23, 56, 17, 56, 20, 9, 2,
|
4, 1, 8, 28, 51, 23, 51, 1, 1, 27,
|
||||||
9, 26, 14, 56, 5, 1, 1, 16, 56, 21,
|
5, 19, 21, 51, 8, 3, 3, 11, 51, 21,
|
||||||
20, 9, 56, 56, 56, 56, 56, 56, 56, 56,
|
24, 16, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
|
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
|
||||||
56, 56, 56, 56, 56, 56
|
51, 51, 51, 51, 51, 51
|
||||||
};
|
};
|
||||||
register int hval = len;
|
register int hval = len;
|
||||||
|
|
||||||
switch (hval)
|
switch (hval)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 3:
|
|
||||||
hval += asso_values[(unsigned char)str[2]];
|
hval += asso_values[(unsigned char)str[2]];
|
||||||
|
/*FALLTHROUGH*/
|
||||||
case 2:
|
case 2:
|
||||||
case 1:
|
case 1:
|
||||||
hval += asso_values[(unsigned char)str[0]];
|
hval += asso_values[(unsigned char)str[0]];
|
||||||
|
@ -79,48 +107,89 @@ rb_reserved_word (str, len)
|
||||||
static const struct kwtable wordlist[] =
|
static const struct kwtable wordlist[] =
|
||||||
{
|
{
|
||||||
{""}, {""}, {""}, {""}, {""}, {""},
|
{""}, {""}, {""}, {""}, {""}, {""},
|
||||||
{"end", {kEND, kEND}, EXPR_END},
|
#line 9 "keywords"
|
||||||
{"else", {kELSE, kELSE}, EXPR_BEG},
|
{"END", {keyword_END, keyword_END}, EXPR_END},
|
||||||
{"case", {kCASE, kCASE}, EXPR_VALUE},
|
|
||||||
{"ensure", {kENSURE, kENSURE}, EXPR_BEG},
|
|
||||||
{"module", {kMODULE, kMODULE}, EXPR_VALUE},
|
|
||||||
{"elsif", {kELSIF, kELSIF}, EXPR_VALUE},
|
|
||||||
{"def", {kDEF, kDEF}, EXPR_FNAME},
|
|
||||||
{"rescue", {kRESCUE, kRESCUE_MOD}, EXPR_MID},
|
|
||||||
{"not", {kNOT, kNOT}, EXPR_VALUE},
|
|
||||||
{"then", {kTHEN, kTHEN}, EXPR_BEG},
|
|
||||||
{"yield", {kYIELD, kYIELD}, EXPR_ARG},
|
|
||||||
{"for", {kFOR, kFOR}, EXPR_VALUE},
|
|
||||||
{"self", {kSELF, kSELF}, EXPR_END},
|
|
||||||
{"false", {kFALSE, kFALSE}, EXPR_END},
|
|
||||||
{"retry", {kRETRY, kRETRY}, EXPR_END},
|
|
||||||
{"return", {kRETURN, kRETURN}, EXPR_MID},
|
|
||||||
{"true", {kTRUE, kTRUE}, EXPR_END},
|
|
||||||
{"if", {kIF, kIF_MOD}, EXPR_VALUE},
|
|
||||||
{"defined?", {kDEFINED, kDEFINED}, EXPR_ARG},
|
|
||||||
{"super", {kSUPER, kSUPER}, EXPR_ARG},
|
|
||||||
{"undef", {kUNDEF, kUNDEF}, EXPR_FNAME},
|
|
||||||
{"break", {kBREAK, kBREAK}, EXPR_MID},
|
|
||||||
{"in", {kIN, kIN}, EXPR_VALUE},
|
|
||||||
{"do", {kDO, kDO}, EXPR_BEG},
|
|
||||||
{"nil", {kNIL, kNIL}, EXPR_END},
|
|
||||||
{"until", {kUNTIL, kUNTIL_MOD}, EXPR_VALUE},
|
|
||||||
{"unless", {kUNLESS, kUNLESS_MOD}, EXPR_VALUE},
|
|
||||||
{"or", {kOR, kOR}, EXPR_VALUE},
|
|
||||||
{"next", {kNEXT, kNEXT}, EXPR_MID},
|
|
||||||
{"when", {kWHEN, kWHEN}, EXPR_VALUE},
|
|
||||||
{"redo", {kREDO, kREDO}, EXPR_END},
|
|
||||||
{"and", {kAND, kAND}, EXPR_VALUE},
|
|
||||||
{"begin", {kBEGIN, kBEGIN}, EXPR_BEG},
|
|
||||||
{"__LINE__", {k__LINE__, k__LINE__}, EXPR_END},
|
|
||||||
{"class", {kCLASS, kCLASS}, EXPR_CLASS},
|
|
||||||
{"__FILE__", {k__FILE__, k__FILE__}, EXPR_END},
|
|
||||||
{"END", {klEND, klEND}, EXPR_END},
|
|
||||||
{"BEGIN", {klBEGIN, klBEGIN}, EXPR_END},
|
|
||||||
{"while", {kWHILE, kWHILE_MOD}, EXPR_VALUE},
|
|
||||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
|
||||||
{""},
|
{""},
|
||||||
{"alias", {kALIAS, kALIAS}, EXPR_FNAME}
|
#line 13 "keywords"
|
||||||
|
{"break", {keyword_break, keyword_break}, EXPR_MID},
|
||||||
|
#line 19 "keywords"
|
||||||
|
{"else", {keyword_else, keyword_else}, EXPR_BEG},
|
||||||
|
#line 29 "keywords"
|
||||||
|
{"nil", {keyword_nil, keyword_nil}, EXPR_END},
|
||||||
|
#line 22 "keywords"
|
||||||
|
{"ensure", {keyword_ensure, keyword_ensure}, EXPR_BEG},
|
||||||
|
#line 21 "keywords"
|
||||||
|
{"end", {keyword_end, keyword_end}, EXPR_END},
|
||||||
|
#line 38 "keywords"
|
||||||
|
{"then", {keyword_then, keyword_then}, EXPR_BEG},
|
||||||
|
#line 30 "keywords"
|
||||||
|
{"not", {keyword_not, keyword_not}, EXPR_VALUE},
|
||||||
|
#line 23 "keywords"
|
||||||
|
{"false", {keyword_false, keyword_false}, EXPR_END},
|
||||||
|
#line 36 "keywords"
|
||||||
|
{"self", {keyword_self, keyword_self}, EXPR_END},
|
||||||
|
#line 20 "keywords"
|
||||||
|
{"elsif", {keyword_elsif, keyword_elsif}, EXPR_VALUE},
|
||||||
|
#line 33 "keywords"
|
||||||
|
{"rescue", {keyword_rescue, modifier_rescue}, EXPR_MID},
|
||||||
|
#line 39 "keywords"
|
||||||
|
{"true", {keyword_true, keyword_true}, EXPR_END},
|
||||||
|
#line 42 "keywords"
|
||||||
|
{"until", {keyword_until, modifier_until}, EXPR_VALUE},
|
||||||
|
#line 41 "keywords"
|
||||||
|
{"unless", {keyword_unless, modifier_unless}, EXPR_VALUE},
|
||||||
|
#line 35 "keywords"
|
||||||
|
{"return", {keyword_return, keyword_return}, EXPR_MID},
|
||||||
|
#line 16 "keywords"
|
||||||
|
{"def", {keyword_def, keyword_def}, EXPR_FNAME},
|
||||||
|
#line 11 "keywords"
|
||||||
|
{"and", {keyword_and, keyword_and}, EXPR_VALUE},
|
||||||
|
#line 18 "keywords"
|
||||||
|
{"do", {keyword_do, keyword_do}, EXPR_BEG},
|
||||||
|
#line 45 "keywords"
|
||||||
|
{"yield", {keyword_yield, keyword_yield}, EXPR_ARG},
|
||||||
|
#line 24 "keywords"
|
||||||
|
{"for", {keyword_for, keyword_for}, EXPR_VALUE},
|
||||||
|
#line 40 "keywords"
|
||||||
|
{"undef", {keyword_undef, keyword_undef}, EXPR_FNAME},
|
||||||
|
#line 31 "keywords"
|
||||||
|
{"or", {keyword_or, keyword_or}, EXPR_VALUE},
|
||||||
|
#line 26 "keywords"
|
||||||
|
{"in", {keyword_in, keyword_in}, EXPR_VALUE},
|
||||||
|
#line 43 "keywords"
|
||||||
|
{"when", {keyword_when, keyword_when}, EXPR_VALUE},
|
||||||
|
#line 34 "keywords"
|
||||||
|
{"retry", {keyword_retry, keyword_retry}, EXPR_END},
|
||||||
|
#line 25 "keywords"
|
||||||
|
{"if", {keyword_if, modifier_if}, EXPR_VALUE},
|
||||||
|
#line 14 "keywords"
|
||||||
|
{"case", {keyword_case, keyword_case}, EXPR_VALUE},
|
||||||
|
#line 32 "keywords"
|
||||||
|
{"redo", {keyword_redo, keyword_redo}, EXPR_END},
|
||||||
|
#line 28 "keywords"
|
||||||
|
{"next", {keyword_next, keyword_next}, EXPR_MID},
|
||||||
|
#line 37 "keywords"
|
||||||
|
{"super", {keyword_super, keyword_super}, EXPR_ARG},
|
||||||
|
#line 27 "keywords"
|
||||||
|
{"module", {keyword_module, keyword_module}, EXPR_VALUE},
|
||||||
|
#line 12 "keywords"
|
||||||
|
{"begin", {keyword_begin, keyword_begin}, EXPR_BEG},
|
||||||
|
#line 6 "keywords"
|
||||||
|
{"__LINE__", {keyword__LINE__, keyword__LINE__}, EXPR_END},
|
||||||
|
#line 7 "keywords"
|
||||||
|
{"__FILE__", {keyword__FILE__, keyword__FILE__}, EXPR_END},
|
||||||
|
#line 8 "keywords"
|
||||||
|
{"BEGIN", {keyword_BEGIN, keyword_BEGIN}, EXPR_END},
|
||||||
|
#line 17 "keywords"
|
||||||
|
{"defined?", {keyword_defined, keyword_defined}, EXPR_ARG},
|
||||||
|
#line 10 "keywords"
|
||||||
|
{"alias", {keyword_alias, keyword_alias}, EXPR_FNAME},
|
||||||
|
{""}, {""},
|
||||||
|
#line 15 "keywords"
|
||||||
|
{"class", {keyword_class, keyword_class}, EXPR_CLASS},
|
||||||
|
{""}, {""},
|
||||||
|
#line 44 "keywords"
|
||||||
|
{"while", {keyword_while, modifier_while}, EXPR_VALUE}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
|
@ -137,4 +206,6 @@ rb_reserved_word (str, len)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#line 46 "keywords"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
412
parse.y
412
parse.y
|
@ -471,54 +471,54 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...);
|
||||||
/*%
|
/*%
|
||||||
%token <val>
|
%token <val>
|
||||||
%*/
|
%*/
|
||||||
kCLASS
|
keyword_class
|
||||||
kMODULE
|
keyword_module
|
||||||
kDEF
|
keyword_def
|
||||||
kUNDEF
|
keyword_undef
|
||||||
kBEGIN
|
keyword_begin
|
||||||
kRESCUE
|
keyword_rescue
|
||||||
kENSURE
|
keyword_ensure
|
||||||
kEND
|
keyword_end
|
||||||
kIF
|
keyword_if
|
||||||
kUNLESS
|
keyword_unless
|
||||||
kTHEN
|
keyword_then
|
||||||
kELSIF
|
keyword_elsif
|
||||||
kELSE
|
keyword_else
|
||||||
kCASE
|
keyword_case
|
||||||
kWHEN
|
keyword_when
|
||||||
kWHILE
|
keyword_while
|
||||||
kUNTIL
|
keyword_until
|
||||||
kFOR
|
keyword_for
|
||||||
kBREAK
|
keyword_break
|
||||||
kNEXT
|
keyword_next
|
||||||
kREDO
|
keyword_redo
|
||||||
kRETRY
|
keyword_retry
|
||||||
kIN
|
keyword_in
|
||||||
kDO
|
keyword_do
|
||||||
kDO_COND
|
keyword_do_cond
|
||||||
kDO_BLOCK
|
keyword_do_block
|
||||||
kDO_LAMBDA
|
keyword_do_LAMBDA
|
||||||
kRETURN
|
keyword_return
|
||||||
kYIELD
|
keyword_yield
|
||||||
kSUPER
|
keyword_super
|
||||||
kSELF
|
keyword_self
|
||||||
kNIL
|
keyword_nil
|
||||||
kTRUE
|
keyword_true
|
||||||
kFALSE
|
keyword_false
|
||||||
kAND
|
keyword_and
|
||||||
kOR
|
keyword_or
|
||||||
kNOT
|
keyword_not
|
||||||
kIF_MOD
|
modifier_if
|
||||||
kUNLESS_MOD
|
modifier_unless
|
||||||
kWHILE_MOD
|
modifier_while
|
||||||
kUNTIL_MOD
|
modifier_until
|
||||||
kRESCUE_MOD
|
modifier_rescue
|
||||||
kALIAS
|
keyword_alias
|
||||||
kDEFINED
|
keyword_defined
|
||||||
klBEGIN
|
keyword_BEGIN
|
||||||
klEND
|
keyword_END
|
||||||
k__LINE__
|
keyword__LINE__
|
||||||
k__FILE__
|
keyword__FILE__
|
||||||
|
|
||||||
%token <id> tIDENTIFIER tFID tGVAR tIVAR tCONSTANT tCVAR tLABEL
|
%token <id> tIDENTIFIER tFID tGVAR tIVAR tCONSTANT tCVAR tLABEL
|
||||||
%token <node> tINTEGER tFLOAT tSTRING_CONTENT tCHAR
|
%token <node> tINTEGER tFLOAT tSTRING_CONTENT tCHAR
|
||||||
|
@ -587,12 +587,12 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...);
|
||||||
%nonassoc tLOWEST
|
%nonassoc tLOWEST
|
||||||
%nonassoc tLBRACE_ARG
|
%nonassoc tLBRACE_ARG
|
||||||
|
|
||||||
%nonassoc kIF_MOD kUNLESS_MOD kWHILE_MOD kUNTIL_MOD
|
%nonassoc modifier_if modifier_unless modifier_while modifier_until
|
||||||
%left kOR kAND
|
%left keyword_or keyword_and
|
||||||
%right kNOT
|
%right keyword_not
|
||||||
%nonassoc kDEFINED
|
%nonassoc keyword_defined
|
||||||
%right '=' tOP_ASGN
|
%right '=' tOP_ASGN
|
||||||
%left kRESCUE_MOD
|
%left modifier_rescue
|
||||||
%right '?' ':'
|
%right '?' ':'
|
||||||
%nonassoc tDOT2 tDOT3
|
%nonassoc tDOT2 tDOT3
|
||||||
%left tOROP
|
%left tOROP
|
||||||
|
@ -721,7 +721,7 @@ stmts : none
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_ALIAS($2, $4);
|
$$ = NEW_ALIAS($2, $4);
|
||||||
|
@ -729,7 +729,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
||||||
$$ = dispatch2(alias, $2, $4);
|
$$ = dispatch2(alias, $2, $4);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kALIAS tGVAR tGVAR
|
| keyword_alias tGVAR tGVAR
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_VALIAS($2, $3);
|
$$ = NEW_VALIAS($2, $3);
|
||||||
|
@ -737,7 +737,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
||||||
$$ = dispatch2(var_alias, $2, $3);
|
$$ = dispatch2(var_alias, $2, $3);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kALIAS tGVAR tBACK_REF
|
| keyword_alias tGVAR tBACK_REF
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
char buf[3];
|
char buf[3];
|
||||||
|
@ -748,7 +748,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
||||||
$$ = dispatch2(var_alias, $2, $3);
|
$$ = dispatch2(var_alias, $2, $3);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kALIAS tGVAR tNTH_REF
|
| keyword_alias tGVAR tNTH_REF
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
yyerror("can't make alias for the number variables");
|
yyerror("can't make alias for the number variables");
|
||||||
|
@ -758,7 +758,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
||||||
$$ = dispatch1(alias_error, $$);
|
$$ = dispatch1(alias_error, $$);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kUNDEF undef_list
|
| keyword_undef undef_list
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
|
@ -766,7 +766,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
||||||
$$ = dispatch1(undef, $2);
|
$$ = dispatch1(undef, $2);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| stmt kIF_MOD expr_value
|
| stmt modifier_if expr_value
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_IF(cond($3), $1, 0);
|
$$ = NEW_IF(cond($3), $1, 0);
|
||||||
|
@ -779,7 +779,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
||||||
$$ = dispatch2(if_mod, $3, $1);
|
$$ = dispatch2(if_mod, $3, $1);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| stmt kUNLESS_MOD expr_value
|
| stmt modifier_unless expr_value
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_UNLESS(cond($3), $1, 0);
|
$$ = NEW_UNLESS(cond($3), $1, 0);
|
||||||
|
@ -792,7 +792,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
||||||
$$ = dispatch2(unless_mod, $3, $1);
|
$$ = dispatch2(unless_mod, $3, $1);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| stmt kWHILE_MOD expr_value
|
| stmt modifier_while expr_value
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
if ($1 && nd_type($1) == NODE_BEGIN) {
|
if ($1 && nd_type($1) == NODE_BEGIN) {
|
||||||
|
@ -808,7 +808,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
||||||
$$ = dispatch2(while_mod, $3, $1);
|
$$ = dispatch2(while_mod, $3, $1);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| stmt kUNTIL_MOD expr_value
|
| stmt modifier_until expr_value
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
if ($1 && nd_type($1) == NODE_BEGIN) {
|
if ($1 && nd_type($1) == NODE_BEGIN) {
|
||||||
|
@ -824,7 +824,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
||||||
$$ = dispatch2(until_mod, $3, $1);
|
$$ = dispatch2(until_mod, $3, $1);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| stmt kRESCUE_MOD stmt
|
| stmt modifier_rescue stmt
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_RESCUE($1, NEW_RESBODY(0,$3,0), 0);
|
$$ = NEW_RESCUE($1, NEW_RESBODY(0,$3,0), 0);
|
||||||
|
@ -832,7 +832,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
||||||
$$ = dispatch2(rescue_mod, $3, $1);
|
$$ = dispatch2(rescue_mod, $3, $1);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| klBEGIN
|
| keyword_BEGIN
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
if (in_def || in_single) {
|
if (in_def || in_single) {
|
||||||
|
@ -856,7 +856,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
||||||
$$ = dispatch1(BEGIN, $4);
|
$$ = dispatch1(BEGIN, $4);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| klEND '{' compstmt '}'
|
| keyword_END '{' compstmt '}'
|
||||||
{
|
{
|
||||||
if (in_def || in_single) {
|
if (in_def || in_single) {
|
||||||
rb_warn0("END in method; use at_exit");
|
rb_warn0("END in method; use at_exit");
|
||||||
|
@ -1025,7 +1025,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
||||||
;
|
;
|
||||||
|
|
||||||
expr : command_call
|
expr : command_call
|
||||||
| expr kAND expr
|
| expr keyword_and expr
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = logop(NODE_AND, $1, $3);
|
$$ = logop(NODE_AND, $1, $3);
|
||||||
|
@ -1033,7 +1033,7 @@ expr : command_call
|
||||||
$$ = dispatch3(binary, $1, ripper_intern("and"), $3);
|
$$ = dispatch3(binary, $1, ripper_intern("and"), $3);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| expr kOR expr
|
| expr keyword_or expr
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = logop(NODE_OR, $1, $3);
|
$$ = logop(NODE_OR, $1, $3);
|
||||||
|
@ -1041,7 +1041,7 @@ expr : command_call
|
||||||
$$ = dispatch3(binary, $1, ripper_intern("or"), $3);
|
$$ = dispatch3(binary, $1, ripper_intern("or"), $3);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kNOT expr
|
| keyword_not expr
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_NOT(cond($2));
|
$$ = NEW_NOT(cond($2));
|
||||||
|
@ -1073,7 +1073,7 @@ expr_value : expr
|
||||||
|
|
||||||
command_call : command
|
command_call : command
|
||||||
| block_command
|
| block_command
|
||||||
| kRETURN call_args
|
| keyword_return call_args
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_RETURN(ret_args($2));
|
$$ = NEW_RETURN(ret_args($2));
|
||||||
|
@ -1081,7 +1081,7 @@ command_call : command
|
||||||
$$ = dispatch1(return, $2);
|
$$ = dispatch1(return, $2);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kBREAK call_args
|
| keyword_break call_args
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_BREAK(ret_args($2));
|
$$ = NEW_BREAK(ret_args($2));
|
||||||
|
@ -1089,7 +1089,7 @@ command_call : command
|
||||||
$$ = dispatch1(break, $2);
|
$$ = dispatch1(break, $2);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kNEXT call_args
|
| keyword_next call_args
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_NEXT(ret_args($2));
|
$$ = NEW_NEXT(ret_args($2));
|
||||||
|
@ -1204,7 +1204,7 @@ command : operation command_args %prec tLOWEST
|
||||||
$$ = dispatch2(iter_block, $$, $5);
|
$$ = dispatch2(iter_block, $$, $5);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kSUPER command_args
|
| keyword_super command_args
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_SUPER($2);
|
$$ = NEW_SUPER($2);
|
||||||
|
@ -1213,7 +1213,7 @@ command : operation command_args %prec tLOWEST
|
||||||
$$ = dispatch1(super, $2);
|
$$ = dispatch1(super, $2);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kYIELD command_args
|
| keyword_yield command_args
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = new_yield($2);
|
$$ = new_yield($2);
|
||||||
|
@ -1649,13 +1649,17 @@ op : '|' { ifndef_ripper($$ = '|'); }
|
||||||
| '`' { ifndef_ripper($$ = '`'); }
|
| '`' { ifndef_ripper($$ = '`'); }
|
||||||
;
|
;
|
||||||
|
|
||||||
reswords : k__LINE__ | k__FILE__ | klBEGIN | klEND
|
reswords : keyword__LINE__ | keyword__FILE__ | keyword_BEGIN | keyword_END
|
||||||
| kALIAS | kAND | kBEGIN | kBREAK | kCASE | kCLASS | kDEF
|
| keyword_alias | keyword_and | keyword_begin
|
||||||
| kDEFINED | kDO | kELSE | kELSIF | kEND | kENSURE | kFALSE
|
| keyword_break | keyword_case | keyword_class | keyword_def
|
||||||
| kFOR | kIN | kMODULE | kNEXT | kNIL | kNOT
|
| keyword_defined | keyword_do | keyword_else | keyword_elsif
|
||||||
| kOR | kREDO | kRESCUE | kRETRY | kRETURN | kSELF | kSUPER
|
| keyword_end | keyword_ensure | keyword_false
|
||||||
| kTHEN | kTRUE | kUNDEF | kWHEN | kYIELD
|
| keyword_for | keyword_in | keyword_module | keyword_next
|
||||||
| kIF | kUNLESS | kWHILE | kUNTIL
|
| keyword_nil | keyword_not | keyword_or | keyword_redo
|
||||||
|
| keyword_rescue | keyword_retry | keyword_return | keyword_self
|
||||||
|
| keyword_super | keyword_then | keyword_true | keyword_undef
|
||||||
|
| keyword_when | keyword_yield | keyword_if | keyword_unless
|
||||||
|
| keyword_while | keyword_until
|
||||||
;
|
;
|
||||||
|
|
||||||
arg : lhs '=' arg
|
arg : lhs '=' arg
|
||||||
|
@ -1666,7 +1670,7 @@ arg : lhs '=' arg
|
||||||
$$ = dispatch2(assign, $1, $3);
|
$$ = dispatch2(assign, $1, $3);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| lhs '=' arg kRESCUE_MOD arg
|
| lhs '=' arg modifier_rescue arg
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = node_assign($1, NEW_RESCUE($3, NEW_RESBODY(0,$5,0), 0));
|
$$ = node_assign($1, NEW_RESCUE($3, NEW_RESBODY(0,$5,0), 0));
|
||||||
|
@ -2080,7 +2084,7 @@ arg : lhs '=' arg
|
||||||
$$ = dispatch3(binary, $1, ripper_intern("||"), $3);
|
$$ = dispatch3(binary, $1, ripper_intern("||"), $3);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kDEFINED opt_nl {in_defined = 1;} arg
|
| keyword_defined opt_nl {in_defined = 1;} arg
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
in_defined = 0;
|
in_defined = 0;
|
||||||
|
@ -2376,7 +2380,7 @@ primary : literal
|
||||||
$$ = method_arg(dispatch1(fcall, $1), arg_new());
|
$$ = method_arg(dispatch1(fcall, $1), arg_new());
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kBEGIN
|
| keyword_begin
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$<num>1 = ruby_sourceline;
|
$<num>1 = ruby_sourceline;
|
||||||
|
@ -2384,7 +2388,7 @@ primary : literal
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
bodystmt
|
bodystmt
|
||||||
kEND
|
keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
if ($3 == NULL) {
|
if ($3 == NULL) {
|
||||||
|
@ -2456,7 +2460,7 @@ primary : literal
|
||||||
$$ = dispatch1(hash, escape_Qundef($2));
|
$$ = dispatch1(hash, escape_Qundef($2));
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kRETURN
|
| keyword_return
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_RETURN(0);
|
$$ = NEW_RETURN(0);
|
||||||
|
@ -2464,7 +2468,7 @@ primary : literal
|
||||||
$$ = dispatch0(return0);
|
$$ = dispatch0(return0);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kYIELD '(' call_args rparen
|
| keyword_yield '(' call_args rparen
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = new_yield($3);
|
$$ = new_yield($3);
|
||||||
|
@ -2472,7 +2476,7 @@ primary : literal
|
||||||
$$ = dispatch1(yield, dispatch1(paren, $3));
|
$$ = dispatch1(yield, dispatch1(paren, $3));
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kYIELD '(' rparen
|
| keyword_yield '(' rparen
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_YIELD(0, Qfalse);
|
$$ = NEW_YIELD(0, Qfalse);
|
||||||
|
@ -2480,7 +2484,7 @@ primary : literal
|
||||||
$$ = dispatch1(yield, dispatch1(paren, arg_new()));
|
$$ = dispatch1(yield, dispatch1(paren, arg_new()));
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kYIELD
|
| keyword_yield
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_YIELD(0, Qfalse);
|
$$ = NEW_YIELD(0, Qfalse);
|
||||||
|
@ -2488,7 +2492,7 @@ primary : literal
|
||||||
$$ = dispatch0(yield0);
|
$$ = dispatch0(yield0);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kDEFINED opt_nl '(' {in_defined = 1;} expr rparen
|
| keyword_defined opt_nl '(' {in_defined = 1;} expr rparen
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
in_defined = 0;
|
in_defined = 0;
|
||||||
|
@ -2525,10 +2529,10 @@ primary : literal
|
||||||
{
|
{
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
}
|
}
|
||||||
| kIF expr_value then
|
| keyword_if expr_value then
|
||||||
compstmt
|
compstmt
|
||||||
if_tail
|
if_tail
|
||||||
kEND
|
keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_IF(cond($2), $4, $5);
|
$$ = NEW_IF(cond($2), $4, $5);
|
||||||
|
@ -2542,10 +2546,10 @@ primary : literal
|
||||||
$$ = dispatch3(if, $2, $4, escape_Qundef($5));
|
$$ = dispatch3(if, $2, $4, escape_Qundef($5));
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kUNLESS expr_value then
|
| keyword_unless expr_value then
|
||||||
compstmt
|
compstmt
|
||||||
opt_else
|
opt_else
|
||||||
kEND
|
keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_UNLESS(cond($2), $4, $5);
|
$$ = NEW_UNLESS(cond($2), $4, $5);
|
||||||
|
@ -2559,9 +2563,9 @@ primary : literal
|
||||||
$$ = dispatch3(unless, $2, $4, escape_Qundef($5));
|
$$ = dispatch3(unless, $2, $4, escape_Qundef($5));
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kWHILE {COND_PUSH(1);} expr_value do {COND_POP();}
|
| keyword_while {COND_PUSH(1);} expr_value do {COND_POP();}
|
||||||
compstmt
|
compstmt
|
||||||
kEND
|
keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_WHILE(cond($3), $6, 1);
|
$$ = NEW_WHILE(cond($3), $6, 1);
|
||||||
|
@ -2573,9 +2577,9 @@ primary : literal
|
||||||
$$ = dispatch2(while, $3, $6);
|
$$ = dispatch2(while, $3, $6);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kUNTIL {COND_PUSH(1);} expr_value do {COND_POP();}
|
| keyword_until {COND_PUSH(1);} expr_value do {COND_POP();}
|
||||||
compstmt
|
compstmt
|
||||||
kEND
|
keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_UNTIL(cond($3), $6, 1);
|
$$ = NEW_UNTIL(cond($3), $6, 1);
|
||||||
|
@ -2587,9 +2591,9 @@ primary : literal
|
||||||
$$ = dispatch2(until, $3, $6);
|
$$ = dispatch2(until, $3, $6);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kCASE expr_value opt_terms
|
| keyword_case expr_value opt_terms
|
||||||
case_body
|
case_body
|
||||||
kEND
|
keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_CASE($2, $4);
|
$$ = NEW_CASE($2, $4);
|
||||||
|
@ -2598,7 +2602,7 @@ primary : literal
|
||||||
$$ = dispatch2(case, $2, $4);
|
$$ = dispatch2(case, $2, $4);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kCASE expr_value opt_terms kELSE compstmt kEND
|
| keyword_case expr_value opt_terms keyword_else compstmt keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = block_append($2, $5);
|
$$ = block_append($2, $5);
|
||||||
|
@ -2606,7 +2610,7 @@ primary : literal
|
||||||
$$ = dispatch2(case, $2, dispatch1(else, $5));
|
$$ = dispatch2(case, $2, dispatch1(else, $5));
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kCASE opt_terms case_body kEND
|
| keyword_case opt_terms case_body keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
|
@ -2614,7 +2618,7 @@ primary : literal
|
||||||
$$ = dispatch2(case, Qnil, $3);
|
$$ = dispatch2(case, Qnil, $3);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kCASE opt_terms kELSE compstmt kEND
|
| keyword_case opt_terms keyword_else compstmt keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = $4;
|
$$ = $4;
|
||||||
|
@ -2622,9 +2626,9 @@ primary : literal
|
||||||
$$ = dispatch2(case, Qnil, dispatch1(else, $4));
|
$$ = dispatch2(case, Qnil, dispatch1(else, $4));
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kFOR for_var kIN {COND_PUSH(1);} expr_value do {COND_POP();}
|
| keyword_for for_var keyword_in {COND_PUSH(1);} expr_value do {COND_POP();}
|
||||||
compstmt
|
compstmt
|
||||||
kEND
|
keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_FOR($2, $5, $8);
|
$$ = NEW_FOR($2, $5, $8);
|
||||||
|
@ -2633,7 +2637,7 @@ primary : literal
|
||||||
$$ = dispatch3(for, $2, $5, $8);
|
$$ = dispatch3(for, $2, $5, $8);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kCLASS cpath superclass
|
| keyword_class cpath superclass
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
if (in_def || in_single)
|
if (in_def || in_single)
|
||||||
|
@ -2648,7 +2652,7 @@ primary : literal
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
bodystmt
|
bodystmt
|
||||||
kEND
|
keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_CLASS($2, $5, $3);
|
$$ = NEW_CLASS($2, $5, $3);
|
||||||
|
@ -2660,7 +2664,7 @@ primary : literal
|
||||||
class_nest--;
|
class_nest--;
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kCLASS tLSHFT expr
|
| keyword_class tLSHFT expr
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$<num>$ = in_def;
|
$<num>$ = in_def;
|
||||||
|
@ -2683,7 +2687,7 @@ primary : literal
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
bodystmt
|
bodystmt
|
||||||
kEND
|
keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_SCLASS($3, $7);
|
$$ = NEW_SCLASS($3, $7);
|
||||||
|
@ -2699,7 +2703,7 @@ primary : literal
|
||||||
in_single = $<val>6;
|
in_single = $<val>6;
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kMODULE cpath
|
| keyword_module cpath
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
if (in_def || in_single)
|
if (in_def || in_single)
|
||||||
|
@ -2714,7 +2718,7 @@ primary : literal
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
bodystmt
|
bodystmt
|
||||||
kEND
|
keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_MODULE($2, $4);
|
$$ = NEW_MODULE($2, $4);
|
||||||
|
@ -2726,7 +2730,7 @@ primary : literal
|
||||||
class_nest--;
|
class_nest--;
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kDEF fname
|
| keyword_def fname
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$<id>$ = cur_mid;
|
$<id>$ = cur_mid;
|
||||||
|
@ -2741,7 +2745,7 @@ primary : literal
|
||||||
}
|
}
|
||||||
f_arglist
|
f_arglist
|
||||||
bodystmt
|
bodystmt
|
||||||
kEND
|
keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
NODE *body = remove_begin($5);
|
NODE *body = remove_begin($5);
|
||||||
|
@ -2757,7 +2761,7 @@ primary : literal
|
||||||
cur_mid = $<id>3;
|
cur_mid = $<id>3;
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kDEF singleton dot_or_colon {lex_state = EXPR_FNAME;} fname
|
| keyword_def singleton dot_or_colon {lex_state = EXPR_FNAME;} fname
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
in_single++;
|
in_single++;
|
||||||
|
@ -2770,7 +2774,7 @@ primary : literal
|
||||||
}
|
}
|
||||||
f_arglist
|
f_arglist
|
||||||
bodystmt
|
bodystmt
|
||||||
kEND
|
keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
NODE *body = remove_begin($8);
|
NODE *body = remove_begin($8);
|
||||||
|
@ -2784,7 +2788,7 @@ primary : literal
|
||||||
in_single--;
|
in_single--;
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kBREAK
|
| keyword_break
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_BREAK(0);
|
$$ = NEW_BREAK(0);
|
||||||
|
@ -2792,7 +2796,7 @@ primary : literal
|
||||||
$$ = dispatch1(break, arg_new());
|
$$ = dispatch1(break, arg_new());
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kNEXT
|
| keyword_next
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_NEXT(0);
|
$$ = NEW_NEXT(0);
|
||||||
|
@ -2800,7 +2804,7 @@ primary : literal
|
||||||
$$ = dispatch1(next, arg_new());
|
$$ = dispatch1(next, arg_new());
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kREDO
|
| keyword_redo
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_REDO();
|
$$ = NEW_REDO();
|
||||||
|
@ -2808,7 +2812,7 @@ primary : literal
|
||||||
$$ = dispatch0(redo);
|
$$ = dispatch0(redo);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kRETRY
|
| keyword_retry
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_RETRY();
|
$$ = NEW_RETRY();
|
||||||
|
@ -2834,8 +2838,8 @@ then : term
|
||||||
/*%c
|
/*%c
|
||||||
{ $$ = Qnil; }
|
{ $$ = Qnil; }
|
||||||
%*/
|
%*/
|
||||||
| kTHEN
|
| keyword_then
|
||||||
| term kTHEN
|
| term keyword_then
|
||||||
/*%c%*/
|
/*%c%*/
|
||||||
/*%c
|
/*%c
|
||||||
{ $$ = $2; }
|
{ $$ = $2; }
|
||||||
|
@ -2847,11 +2851,11 @@ do : term
|
||||||
/*%c
|
/*%c
|
||||||
{ $$ = Qnil; }
|
{ $$ = Qnil; }
|
||||||
%*/
|
%*/
|
||||||
| kDO_COND
|
| keyword_do_cond
|
||||||
;
|
;
|
||||||
|
|
||||||
if_tail : opt_else
|
if_tail : opt_else
|
||||||
| kELSIF expr_value then
|
| keyword_elsif expr_value then
|
||||||
compstmt
|
compstmt
|
||||||
if_tail
|
if_tail
|
||||||
{
|
{
|
||||||
|
@ -2865,7 +2869,7 @@ if_tail : opt_else
|
||||||
;
|
;
|
||||||
|
|
||||||
opt_else : none
|
opt_else : none
|
||||||
| kELSE compstmt
|
| keyword_else compstmt
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
|
@ -3168,13 +3172,13 @@ lambda_body : tLAMBEG compstmt '}'
|
||||||
{
|
{
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
}
|
}
|
||||||
| kDO_LAMBDA compstmt kEND
|
| keyword_do_LAMBDA compstmt keyword_end
|
||||||
{
|
{
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
do_block : kDO_BLOCK
|
do_block : keyword_do_block
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$<vars>$ = dyna_push();
|
$<vars>$ = dyna_push();
|
||||||
|
@ -3188,7 +3192,7 @@ do_block : kDO_BLOCK
|
||||||
/*% %*/
|
/*% %*/
|
||||||
}
|
}
|
||||||
compstmt
|
compstmt
|
||||||
kEND
|
keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$3->nd_body = block_append($3->nd_body,
|
$3->nd_body = block_append($3->nd_body,
|
||||||
|
@ -3292,7 +3296,7 @@ method_call : operation paren_args
|
||||||
$$ = method_optarg($$, $3);
|
$$ = method_optarg($$, $3);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kSUPER paren_args
|
| keyword_super paren_args
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_SUPER($2);
|
$$ = NEW_SUPER($2);
|
||||||
|
@ -3300,7 +3304,7 @@ method_call : operation paren_args
|
||||||
$$ = dispatch1(super, $2);
|
$$ = dispatch1(super, $2);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kSUPER
|
| keyword_super
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = NEW_ZSUPER();
|
$$ = NEW_ZSUPER();
|
||||||
|
@ -3348,7 +3352,7 @@ brace_block : '{'
|
||||||
$$ = dispatch2(brace_block, escape_Qundef($3), $5);
|
$$ = dispatch2(brace_block, escape_Qundef($3), $5);
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
| kDO
|
| keyword_do
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$<vars>$ = dyna_push();
|
$<vars>$ = dyna_push();
|
||||||
|
@ -3362,7 +3366,7 @@ brace_block : '{'
|
||||||
/*%
|
/*%
|
||||||
%*/
|
%*/
|
||||||
}
|
}
|
||||||
compstmt kEND
|
compstmt keyword_end
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$3->nd_body = block_append($3->nd_body,
|
$3->nd_body = block_append($3->nd_body,
|
||||||
|
@ -3376,7 +3380,7 @@ brace_block : '{'
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
case_body : kWHEN args then
|
case_body : keyword_when args then
|
||||||
compstmt
|
compstmt
|
||||||
cases
|
cases
|
||||||
{
|
{
|
||||||
|
@ -3392,7 +3396,7 @@ cases : opt_else
|
||||||
| case_body
|
| case_body
|
||||||
;
|
;
|
||||||
|
|
||||||
opt_rescue : kRESCUE exc_list exc_var then
|
opt_rescue : keyword_rescue exc_list exc_var then
|
||||||
compstmt
|
compstmt
|
||||||
opt_rescue
|
opt_rescue
|
||||||
{
|
{
|
||||||
|
@ -3433,7 +3437,7 @@ exc_var : tASSOC lhs
|
||||||
| none
|
| none
|
||||||
;
|
;
|
||||||
|
|
||||||
opt_ensure : kENSURE compstmt
|
opt_ensure : keyword_ensure compstmt
|
||||||
{
|
{
|
||||||
/*%%%*/
|
/*%%%*/
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
|
@ -3824,12 +3828,12 @@ variable : tIDENTIFIER
|
||||||
| tGVAR
|
| tGVAR
|
||||||
| tCONSTANT
|
| tCONSTANT
|
||||||
| tCVAR
|
| tCVAR
|
||||||
| kNIL {ifndef_ripper($$ = kNIL);}
|
| keyword_nil {ifndef_ripper($$ = keyword_nil);}
|
||||||
| kSELF {ifndef_ripper($$ = kSELF);}
|
| keyword_self {ifndef_ripper($$ = keyword_self);}
|
||||||
| kTRUE {ifndef_ripper($$ = kTRUE);}
|
| keyword_true {ifndef_ripper($$ = keyword_true);}
|
||||||
| kFALSE {ifndef_ripper($$ = kFALSE);}
|
| keyword_false {ifndef_ripper($$ = keyword_false);}
|
||||||
| k__FILE__ {ifndef_ripper($$ = k__FILE__);}
|
| keyword__FILE__ {ifndef_ripper($$ = keyword__FILE__);}
|
||||||
| k__LINE__ {ifndef_ripper($$ = k__LINE__);}
|
| keyword__LINE__ {ifndef_ripper($$ = keyword__LINE__);}
|
||||||
;
|
;
|
||||||
|
|
||||||
var_ref : variable
|
var_ref : variable
|
||||||
|
@ -6735,18 +6739,18 @@ parser_yylex(struct parser_params *parser)
|
||||||
set_yylval_id(rb_intern(kw->name));
|
set_yylval_id(rb_intern(kw->name));
|
||||||
return kw->id[0];
|
return kw->id[0];
|
||||||
}
|
}
|
||||||
if (kw->id[0] == kDO) {
|
if (kw->id[0] == keyword_do) {
|
||||||
if (lpar_beg && lpar_beg == paren_nest) {
|
if (lpar_beg && lpar_beg == paren_nest) {
|
||||||
lpar_beg = 0;
|
lpar_beg = 0;
|
||||||
--paren_nest;
|
--paren_nest;
|
||||||
return kDO_LAMBDA;
|
return keyword_do_LAMBDA;
|
||||||
}
|
}
|
||||||
if (COND_P()) return kDO_COND;
|
if (COND_P()) return keyword_do_cond;
|
||||||
if (CMDARG_P() && state != EXPR_CMDARG)
|
if (CMDARG_P() && state != EXPR_CMDARG)
|
||||||
return kDO_BLOCK;
|
return keyword_do_block;
|
||||||
if (state == EXPR_ENDARG || state == EXPR_BEG)
|
if (state == EXPR_ENDARG || state == EXPR_BEG)
|
||||||
return kDO_BLOCK;
|
return keyword_do_block;
|
||||||
return kDO;
|
return keyword_do;
|
||||||
}
|
}
|
||||||
if (state == EXPR_BEG || state == EXPR_VALUE)
|
if (state == EXPR_BEG || state == EXPR_VALUE)
|
||||||
return kw->id[0];
|
return kw->id[0];
|
||||||
|
@ -7112,22 +7116,22 @@ match_op_gen(struct parser_params *parser, NODE *node1, NODE *node2)
|
||||||
static NODE*
|
static NODE*
|
||||||
gettable_gen(struct parser_params *parser, ID id)
|
gettable_gen(struct parser_params *parser, ID id)
|
||||||
{
|
{
|
||||||
if (id == kSELF) {
|
if (id == keyword_self) {
|
||||||
return NEW_SELF();
|
return NEW_SELF();
|
||||||
}
|
}
|
||||||
else if (id == kNIL) {
|
else if (id == keyword_nil) {
|
||||||
return NEW_NIL();
|
return NEW_NIL();
|
||||||
}
|
}
|
||||||
else if (id == kTRUE) {
|
else if (id == keyword_true) {
|
||||||
return NEW_TRUE();
|
return NEW_TRUE();
|
||||||
}
|
}
|
||||||
else if (id == kFALSE) {
|
else if (id == keyword_false) {
|
||||||
return NEW_FALSE();
|
return NEW_FALSE();
|
||||||
}
|
}
|
||||||
else if (id == k__FILE__) {
|
else if (id == keyword__FILE__) {
|
||||||
return NEW_STR(rb_str_new2(ruby_sourcefile));
|
return NEW_STR(rb_str_new2(ruby_sourcefile));
|
||||||
}
|
}
|
||||||
else if (id == k__LINE__) {
|
else if (id == keyword__LINE__) {
|
||||||
return NEW_LIT(INT2FIX(ruby_sourceline));
|
return NEW_LIT(INT2FIX(ruby_sourceline));
|
||||||
}
|
}
|
||||||
else if (is_local_id(id)) {
|
else if (is_local_id(id)) {
|
||||||
|
@ -7157,22 +7161,22 @@ static NODE*
|
||||||
assignable_gen(struct parser_params *parser, ID id, NODE *val)
|
assignable_gen(struct parser_params *parser, ID id, NODE *val)
|
||||||
{
|
{
|
||||||
value_expr(val);
|
value_expr(val);
|
||||||
if (id == kSELF) {
|
if (id == keyword_self) {
|
||||||
yyerror("Can't change the value of self");
|
yyerror("Can't change the value of self");
|
||||||
}
|
}
|
||||||
else if (id == kNIL) {
|
else if (id == keyword_nil) {
|
||||||
yyerror("Can't assign to nil");
|
yyerror("Can't assign to nil");
|
||||||
}
|
}
|
||||||
else if (id == kTRUE) {
|
else if (id == keyword_true) {
|
||||||
yyerror("Can't assign to true");
|
yyerror("Can't assign to true");
|
||||||
}
|
}
|
||||||
else if (id == kFALSE) {
|
else if (id == keyword_false) {
|
||||||
yyerror("Can't assign to false");
|
yyerror("Can't assign to false");
|
||||||
}
|
}
|
||||||
else if (id == k__FILE__) {
|
else if (id == keyword__FILE__) {
|
||||||
yyerror("Can't assign to __FILE__");
|
yyerror("Can't assign to __FILE__");
|
||||||
}
|
}
|
||||||
else if (id == k__LINE__) {
|
else if (id == keyword__LINE__) {
|
||||||
yyerror("Can't assign to __LINE__");
|
yyerror("Can't assign to __LINE__");
|
||||||
}
|
}
|
||||||
else if (is_local_id(id)) {
|
else if (is_local_id(id)) {
|
||||||
|
@ -8844,53 +8848,53 @@ static struct kw_assoc {
|
||||||
ID id;
|
ID id;
|
||||||
const char *name;
|
const char *name;
|
||||||
} keyword_to_name[] = {
|
} keyword_to_name[] = {
|
||||||
{kCLASS, "class"},
|
{keyword_class, "class"},
|
||||||
{kMODULE, "module"},
|
{keyword_module, "module"},
|
||||||
{kDEF, "def"},
|
{keyword_def, "def"},
|
||||||
{kUNDEF, "undef"},
|
{keyword_undef, "undef"},
|
||||||
{kBEGIN, "begin"},
|
{keyword_begin, "begin"},
|
||||||
{kRESCUE, "rescue"},
|
{keyword_rescue, "rescue"},
|
||||||
{kENSURE, "ensure"},
|
{keyword_ensure, "ensure"},
|
||||||
{kEND, "end"},
|
{keyword_end, "end"},
|
||||||
{kIF, "if"},
|
{keyword_if, "if"},
|
||||||
{kUNLESS, "unless"},
|
{keyword_unless, "unless"},
|
||||||
{kTHEN, "then"},
|
{keyword_then, "then"},
|
||||||
{kELSIF, "elsif"},
|
{keyword_elsif, "elsif"},
|
||||||
{kELSE, "else"},
|
{keyword_else, "else"},
|
||||||
{kCASE, "case"},
|
{keyword_case, "case"},
|
||||||
{kWHEN, "when"},
|
{keyword_when, "when"},
|
||||||
{kWHILE, "while"},
|
{keyword_while, "while"},
|
||||||
{kUNTIL, "until"},
|
{keyword_until, "until"},
|
||||||
{kFOR, "for"},
|
{keyword_for, "for"},
|
||||||
{kBREAK, "break"},
|
{keyword_break, "break"},
|
||||||
{kNEXT, "next"},
|
{keyword_next, "next"},
|
||||||
{kREDO, "redo"},
|
{keyword_redo, "redo"},
|
||||||
{kRETRY, "retry"},
|
{keyword_retry, "retry"},
|
||||||
{kIN, "in"},
|
{keyword_in, "in"},
|
||||||
{kDO, "do"},
|
{keyword_do, "do"},
|
||||||
{kDO_COND, "do"},
|
{keyword_do_cond, "do"},
|
||||||
{kDO_BLOCK, "do"},
|
{keyword_do_block, "do"},
|
||||||
{kRETURN, "return"},
|
{keyword_return, "return"},
|
||||||
{kYIELD, "yield"},
|
{keyword_yield, "yield"},
|
||||||
{kSUPER, "super"},
|
{keyword_super, "super"},
|
||||||
{kSELF, "self"},
|
{keyword_self, "self"},
|
||||||
{kNIL, "nil"},
|
{keyword_nil, "nil"},
|
||||||
{kTRUE, "true"},
|
{keyword_true, "true"},
|
||||||
{kFALSE, "false"},
|
{keyword_false, "false"},
|
||||||
{kAND, "and"},
|
{keyword_and, "and"},
|
||||||
{kOR, "or"},
|
{keyword_or, "or"},
|
||||||
{kNOT, "not"},
|
{keyword_not, "not"},
|
||||||
{kIF_MOD, "if"},
|
{modifier_if, "if"},
|
||||||
{kUNLESS_MOD, "unless"},
|
{modifier_unless, "unless"},
|
||||||
{kWHILE_MOD, "while"},
|
{modifier_while, "while"},
|
||||||
{kUNTIL_MOD, "until"},
|
{modifier_until, "until"},
|
||||||
{kRESCUE_MOD, "rescue"},
|
{modifier_rescue, "rescue"},
|
||||||
{kALIAS, "alias"},
|
{keyword_alias, "alias"},
|
||||||
{kDEFINED, "defined"},
|
{keyword_defined, "defined?"},
|
||||||
{klBEGIN, "BEGIN"},
|
{keyword_BEGIN, "BEGIN"},
|
||||||
{klEND, "END"},
|
{keyword_END, "END"},
|
||||||
{k__LINE__, "__LINE__"},
|
{keyword__LINE__, "__LINE__"},
|
||||||
{k__FILE__, "__FILE__"},
|
{keyword__FILE__, "__FILE__"},
|
||||||
{0, NULL}
|
{0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче