Created
August 1, 2010 05:04
-
-
Save moriyoshi/502964 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: defs/lex.c.src | |
=================================================================== | |
--- defs/lex.c.src (revision 28816) | |
+++ defs/lex.c.src (working copy) | |
@@ -49,5 +49,6 @@ | |
when, {keyword_when, keyword_when}, EXPR_VALUE | |
while, {keyword_while, modifier_while}, EXPR_VALUE | |
yield, {keyword_yield, keyword_yield}, EXPR_ARG | |
+pass, {keyword_pass, keyword_pass}, EXPR_VALUE | |
%% | |
#endif | |
Index: defs/keywords | |
=================================================================== | |
--- defs/keywords (revision 28816) | |
+++ defs/keywords (working copy) | |
@@ -49,5 +49,6 @@ | |
when, {keyword_when, keyword_when}, EXPR_VALUE | |
while, {keyword_while, modifier_while}, EXPR_VALUE | |
yield, {keyword_yield, keyword_yield}, EXPR_ARG | |
+pass, {keyword_pass, keyword_pass}, EXPR_VALUE | |
%% | |
#endif | |
Index: lex.c.blt | |
=================================================================== | |
--- lex.c.blt (revision 28816) | |
+++ lex.c.blt (working copy) | |
@@ -1,4 +1,4 @@ | |
-/* C code produced by gperf version 3.0.4 */ | |
+/* C code produced by gperf version 3.0.3 */ | |
/* Command-line: gperf -C -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' defs/keywords */ | |
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | |
@@ -38,12 +38,12 @@ | |
#line 9 "defs/keywords" | |
struct kwtable; | |
-#define TOTAL_KEYWORDS 41 | |
+#define TOTAL_KEYWORDS 42 | |
#define MIN_WORD_LENGTH 2 | |
#define MAX_WORD_LENGTH 12 | |
-#define MIN_HASH_VALUE 8 | |
-#define MAX_HASH_VALUE 50 | |
-/* maximum key range = 43, duplicates = 0 */ | |
+#define MIN_HASH_VALUE 7 | |
+#define MAX_HASH_VALUE 48 | |
+/* maximum key range = 42, duplicates = 0 */ | |
#ifdef __GNUC__ | |
__inline | |
@@ -59,32 +59,32 @@ | |
{ | |
static const unsigned char asso_values[] = | |
{ | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 26, 51, 51, 14, 51, 16, 8, | |
- 11, 13, 51, 51, 51, 51, 10, 51, 13, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 11, 51, 13, 1, 26, | |
- 4, 1, 8, 28, 51, 23, 51, 1, 1, 27, | |
- 5, 19, 21, 51, 8, 3, 3, 11, 51, 21, | |
- 24, 16, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, | |
- 51, 51, 51, 51, 51, 51 | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 24, 49, 49, 14, 49, 16, 11, | |
+ 12, 14, 49, 49, 49, 49, 11, 49, 14, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 11, 49, 9, 16, 29, | |
+ 8, 2, 8, 12, 49, 16, 49, 16, 4, 21, | |
+ 7, 19, 1, 49, 1, 1, 1, 13, 49, 20, | |
+ 23, 23, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | |
+ 49, 49, 49, 49, 49, 49 | |
}; | |
register int hval = len; | |
@@ -103,7 +103,7 @@ | |
#ifdef __GNUC__ | |
__inline | |
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ | |
+#ifdef __GNUC_STDC_INLINE__ | |
__attribute__ ((__gnu_inline__)) | |
#endif | |
#endif | |
@@ -114,90 +114,91 @@ | |
{ | |
static const struct kwtable wordlist[] = | |
{ | |
- {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | |
-#line 19 "defs/keywords" | |
- {"break", {keyword_break, keyword_break}, EXPR_MID}, | |
+ {""}, {""}, {""}, {""}, {""}, {""}, {""}, | |
+#line 52 "defs/keywords" | |
+ {"pass", {keyword_pass, keyword_pass}, EXPR_VALUE}, | |
+#line 43 "defs/keywords" | |
+ {"super", {keyword_super, keyword_super}, EXPR_ARG}, | |
#line 25 "defs/keywords" | |
{"else", {keyword_else, keyword_else}, EXPR_BEG}, | |
-#line 35 "defs/keywords" | |
- {"nil", {keyword_nil, keyword_nil}, EXPR_END}, | |
+#line 39 "defs/keywords" | |
+ {"rescue", {keyword_rescue, modifier_rescue}, EXPR_MID}, | |
#line 28 "defs/keywords" | |
{"ensure", {keyword_ensure, keyword_ensure}, EXPR_BEG}, | |
-#line 27 "defs/keywords" | |
- {"end", {keyword_end, keyword_end}, EXPR_END}, | |
+#line 36 "defs/keywords" | |
+ {"not", {keyword_not, keyword_not}, EXPR_ARG}, | |
+#line 30 "defs/keywords" | |
+ {"for", {keyword_for, keyword_for}, EXPR_VALUE}, | |
#line 44 "defs/keywords" | |
{"then", {keyword_then, keyword_then}, EXPR_BEG}, | |
-#line 36 "defs/keywords" | |
- {"not", {keyword_not, keyword_not}, EXPR_ARG}, | |
+#line 41 "defs/keywords" | |
+ {"return", {keyword_return, keyword_return}, EXPR_MID}, | |
+#line 26 "defs/keywords" | |
+ {"elsif", {keyword_elsif, keyword_elsif}, EXPR_VALUE}, | |
+#line 42 "defs/keywords" | |
+ {"self", {keyword_self, keyword_self}, EXPR_END}, | |
+#line 35 "defs/keywords" | |
+ {"nil", {keyword_nil, keyword_nil}, EXPR_END}, | |
#line 29 "defs/keywords" | |
{"false", {keyword_false, keyword_false}, EXPR_END}, | |
-#line 42 "defs/keywords" | |
- {"self", {keyword_self, keyword_self}, EXPR_END}, | |
-#line 26 "defs/keywords" | |
- {"elsif", {keyword_elsif, keyword_elsif}, EXPR_VALUE}, | |
-#line 39 "defs/keywords" | |
- {"rescue", {keyword_rescue, modifier_rescue}, EXPR_MID}, | |
#line 45 "defs/keywords" | |
{"true", {keyword_true, keyword_true}, EXPR_END}, | |
+#line 27 "defs/keywords" | |
+ {"end", {keyword_end, keyword_end}, EXPR_END}, | |
+#line 37 "defs/keywords" | |
+ {"or", {keyword_or, keyword_or}, EXPR_VALUE}, | |
#line 48 "defs/keywords" | |
{"until", {keyword_until, modifier_until}, EXPR_VALUE}, | |
#line 47 "defs/keywords" | |
{"unless", {keyword_unless, modifier_unless}, EXPR_VALUE}, | |
-#line 41 "defs/keywords" | |
- {"return", {keyword_return, keyword_return}, EXPR_MID}, | |
+#line 32 "defs/keywords" | |
+ {"in", {keyword_in, keyword_in}, EXPR_VALUE}, | |
+#line 31 "defs/keywords" | |
+ {"if", {keyword_if, modifier_if}, EXPR_VALUE}, | |
#line 22 "defs/keywords" | |
{"def", {keyword_def, keyword_def}, EXPR_FNAME}, | |
#line 17 "defs/keywords" | |
{"and", {keyword_and, keyword_and}, EXPR_VALUE}, | |
#line 24 "defs/keywords" | |
{"do", {keyword_do, keyword_do}, EXPR_BEG}, | |
-#line 51 "defs/keywords" | |
- {"yield", {keyword_yield, keyword_yield}, EXPR_ARG}, | |
-#line 30 "defs/keywords" | |
- {"for", {keyword_for, keyword_for}, EXPR_VALUE}, | |
-#line 46 "defs/keywords" | |
- {"undef", {keyword_undef, keyword_undef}, EXPR_FNAME}, | |
-#line 37 "defs/keywords" | |
- {"or", {keyword_or, keyword_or}, EXPR_VALUE}, | |
-#line 32 "defs/keywords" | |
- {"in", {keyword_in, keyword_in}, EXPR_VALUE}, | |
-#line 49 "defs/keywords" | |
- {"when", {keyword_when, keyword_when}, EXPR_VALUE}, | |
#line 40 "defs/keywords" | |
{"retry", {keyword_retry, keyword_retry}, EXPR_END}, | |
-#line 31 "defs/keywords" | |
- {"if", {keyword_if, modifier_if}, EXPR_VALUE}, | |
-#line 20 "defs/keywords" | |
- {"case", {keyword_case, keyword_case}, EXPR_VALUE}, | |
+#line 16 "defs/keywords" | |
+ {"alias", {keyword_alias, keyword_alias}, EXPR_FNAME}, | |
#line 38 "defs/keywords" | |
{"redo", {keyword_redo, keyword_redo}, EXPR_END}, | |
+#line 49 "defs/keywords" | |
+ {"when", {keyword_when, keyword_when}, EXPR_VALUE}, | |
+#line 46 "defs/keywords" | |
+ {"undef", {keyword_undef, keyword_undef}, EXPR_FNAME}, | |
#line 34 "defs/keywords" | |
{"next", {keyword_next, keyword_next}, EXPR_MID}, | |
-#line 43 "defs/keywords" | |
- {"super", {keyword_super, keyword_super}, EXPR_ARG}, | |
+#line 20 "defs/keywords" | |
+ {"case", {keyword_case, keyword_case}, EXPR_VALUE}, | |
#line 33 "defs/keywords" | |
{"module", {keyword_module, keyword_module}, EXPR_VALUE}, | |
+#line 51 "defs/keywords" | |
+ {"yield", {keyword_yield, keyword_yield}, EXPR_ARG}, | |
+#line 19 "defs/keywords" | |
+ {"break", {keyword_break, keyword_break}, EXPR_MID}, | |
#line 18 "defs/keywords" | |
{"begin", {keyword_begin, keyword_begin}, EXPR_BEG}, | |
#line 12 "defs/keywords" | |
{"__LINE__", {keyword__LINE__, keyword__LINE__}, EXPR_END}, | |
#line 13 "defs/keywords" | |
{"__FILE__", {keyword__FILE__, keyword__FILE__}, EXPR_END}, | |
+#line 50 "defs/keywords" | |
+ {"while", {keyword_while, modifier_while}, EXPR_VALUE}, | |
+#line 21 "defs/keywords" | |
+ {"class", {keyword_class, keyword_class}, EXPR_CLASS}, | |
#line 11 "defs/keywords" | |
{"__ENCODING__", {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END}, | |
#line 15 "defs/keywords" | |
{"END", {keyword_END, keyword_END}, EXPR_END}, | |
-#line 16 "defs/keywords" | |
- {"alias", {keyword_alias, keyword_alias}, EXPR_FNAME}, | |
#line 14 "defs/keywords" | |
{"BEGIN", {keyword_BEGIN, keyword_BEGIN}, EXPR_END}, | |
#line 23 "defs/keywords" | |
- {"defined?", {keyword_defined, keyword_defined}, EXPR_ARG}, | |
-#line 21 "defs/keywords" | |
- {"class", {keyword_class, keyword_class}, EXPR_CLASS}, | |
- {""}, {""}, | |
-#line 50 "defs/keywords" | |
- {"while", {keyword_while, modifier_while}, EXPR_VALUE} | |
+ {"defined?", {keyword_defined, keyword_defined}, EXPR_ARG} | |
}; | |
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | |
@@ -214,6 +215,6 @@ | |
} | |
return 0; | |
} | |
-#line 52 "defs/keywords" | |
+#line 53 "defs/keywords" | |
#endif | |
Index: enc/trans/emoji_sjis_docomo.trans | |
=================================================================== | |
--- enc/trans/emoji_sjis_docomo.trans (revision 28816) | |
+++ enc/trans/emoji_sjis_docomo.trans (working copy) | |
@@ -1,7 +1,7 @@ | |
#include "transcode_data.h" | |
<% | |
- transcode_tblgen "SJIS-DOCOMO", "UTF8-DOCOMO", | |
+ transcode_tblgen("SJIS-DOCOMO", "UTF8-DOCOMO", | |
[["{00-7f}", :nomap]] + | |
citrus_decode_mapsrc("mskanji", 1, "JISX0201-KANA/UCS") + | |
citrus_decode_mapsrc("mskanji", 2, %w(EMOJI_SHIFT_JIS-DOCOMO/UCS | |
@@ -10,9 +10,9 @@ | |
CP932VDC:IBM/UCS | |
CP932UDA/UCS | |
JISX0208:MS/UCS).join(",")), | |
- ValidEncoding('Shift_JIS') | |
+ ValidEncoding('Shift_JIS')) | |
- transcode_tblgen "UTF8-DOCOMO", "SJIS-DOCOMO", | |
+ transcode_tblgen("UTF8-DOCOMO", "SJIS-DOCOMO", | |
[["{00-7f}", :nomap]] + | |
citrus_decode_mapsrc("mskanji", 1, "UCS/JISX0201-KANA") + | |
citrus_decode_mapsrc("mskanji", 2, %w(UCS/EMOJI_SHIFT_JIS-DOCOMO | |
@@ -21,7 +21,7 @@ | |
UCS/CP932VDC:IBM | |
UCS/CP932UDA | |
UCS/JISX0208:MS).join(",")), | |
- ValidEncoding('UTF-8') | |
+ ValidEncoding('UTF-8')) | |
%> | |
<%= transcode_generated_code %> | |
Index: enc/trans/emoji_iso2022_kddi.trans | |
=================================================================== | |
--- enc/trans/emoji_iso2022_kddi.trans (revision 28816) | |
+++ enc/trans/emoji_iso2022_kddi.trans (working copy) | |
@@ -25,7 +25,7 @@ | |
transcode_generate_node(ActionMap.parse(map), "iso2022jp_kddi_encoder") | |
# mapping from stateless-ISO-2022-JP-KDDI to UTF8-KDDI | |
- transcode_tblgen "stateless-ISO-2022-JP-KDDI", "UTF8-KDDI", | |
+ transcode_tblgen("stateless-ISO-2022-JP-KDDI", "UTF8-KDDI", | |
[["{00-7f}", :nomap]] + | |
citrus_decode_mapsrc("stateless_iso", 0222, %w(EMOJI_ISO-2022-JP-KDDI/UCS | |
JISX0208VDC:NEC/UCS | |
@@ -33,10 +33,10 @@ | |
CP932VDC:IBM/UCS | |
CP932UDA/UCS | |
JISX0208:MS/UCS).join(",")), | |
- nil | |
+ nil) | |
# mapping from UTF8-KDDI to stateless-ISO-2022-JP-KDDI | |
- transcode_tblgen "UTF8-KDDI", "stateless-ISO-2022-JP-KDDI", | |
+ transcode_tblgen("UTF8-KDDI", "stateless-ISO-2022-JP-KDDI", | |
[["{00-7f}", :nomap]] + | |
citrus_decode_mapsrc("stateless_iso", 0222, %w(UCS/EMOJI_ISO-2022-JP-KDDI | |
UCS/EMOJI_ISO-2022-JP-KDDI-UNDOC | |
@@ -45,7 +45,7 @@ | |
UCS/CP932VDC:IBM | |
UCS/CP932UDA | |
UCS/JISX0208:MS).join(",")), | |
- ValidEncoding('UTF-8') | |
+ ValidEncoding('UTF-8')) | |
%> | |
<%= transcode_generated_code %> | |
Index: enc/trans/emoji_sjis_softbank.trans | |
=================================================================== | |
--- enc/trans/emoji_sjis_softbank.trans (revision 28816) | |
+++ enc/trans/emoji_sjis_softbank.trans (working copy) | |
@@ -1,7 +1,7 @@ | |
#include "transcode_data.h" | |
<% | |
- transcode_tblgen "SJIS-SoftBank", "UTF8-SoftBank", | |
+ transcode_tblgen("SJIS-SoftBank", "UTF8-SoftBank", | |
[["{00-7f}", :nomap]] + | |
citrus_decode_mapsrc("mskanji", 1, "JISX0201-KANA/UCS") + | |
citrus_decode_mapsrc("mskanji", 2, %w(EMOJI_SHIFT_JIS-SOFTBANK/UCS | |
@@ -10,9 +10,9 @@ | |
CP932VDC:IBM/UCS | |
CP932UDA/UCS | |
JISX0208:MS/UCS).join(",")), | |
- ValidEncoding('Shift_JIS') | |
+ ValidEncoding('Shift_JIS')) | |
- transcode_tblgen "UTF8-SoftBank", "SJIS-SoftBank", | |
+ transcode_tblgen("UTF8-SoftBank", "SJIS-SoftBank", | |
[["{00-7f}", :nomap]] + | |
citrus_decode_mapsrc("mskanji", 1, "UCS/JISX0201-KANA") + | |
citrus_decode_mapsrc("mskanji", 2, %w(UCS/EMOJI_SHIFT_JIS-SOFTBANK | |
@@ -21,7 +21,7 @@ | |
UCS/CP932VDC:IBM | |
UCS/CP932UDA | |
UCS/JISX0208:MS).join(",")), | |
- ValidEncoding('UTF-8') | |
+ ValidEncoding('UTF-8')) | |
%> | |
<%= transcode_generated_code %> | |
Index: enc/trans/emoji_sjis_kddi.trans | |
=================================================================== | |
--- enc/trans/emoji_sjis_kddi.trans (revision 28816) | |
+++ enc/trans/emoji_sjis_kddi.trans (working copy) | |
@@ -1,7 +1,7 @@ | |
#include "transcode_data.h" | |
<% | |
- transcode_tblgen "SJIS-KDDI", "UTF8-KDDI", | |
+ transcode_tblgen("SJIS-KDDI", "UTF8-KDDI", | |
[["{00-7f}", :nomap]] + | |
citrus_decode_mapsrc("mskanji", 1, "JISX0201-KANA/UCS") + | |
citrus_decode_mapsrc("mskanji", 2, %w(EMOJI_SHIFT_JIS-KDDI/UCS | |
@@ -10,9 +10,9 @@ | |
CP932VDC:IBM/UCS | |
CP932UDA/UCS | |
JISX0208:MS/UCS).join(",")), | |
- ValidEncoding('Shift_JIS') | |
+ ValidEncoding('Shift_JIS')) | |
- transcode_tblgen "UTF8-KDDI", "SJIS-KDDI", | |
+ transcode_tblgen("UTF8-KDDI", "SJIS-KDDI", | |
[["{00-7f}", :nomap]] + | |
citrus_decode_mapsrc("mskanji", 1, "UCS/JISX0201-KANA") + | |
citrus_decode_mapsrc("mskanji", 2, %w(UCS/EMOJI_SHIFT_JIS-KDDI | |
@@ -22,7 +22,7 @@ | |
UCS/CP932VDC:IBM | |
UCS/CP932UDA | |
UCS/JISX0208:MS).join(",")), | |
- ValidEncoding('UTF-8') | |
+ ValidEncoding('UTF-8')) | |
%> | |
<%= transcode_generated_code %> | |
Index: lib/rdoc.rb | |
=================================================================== | |
--- lib/rdoc.rb (revision 28816) | |
+++ lib/rdoc.rb (working copy) | |
@@ -414,8 +414,7 @@ | |
## | |
# RDoc modifiers for methods | |
- METHOD_MODIFIERS = GENERAL_MODIFIERS + | |
- %w[arg args yield yields notnew not-new not_new doc] | |
+ METHOD_MODIFIERS = GENERAL_MODIFIERS + %w[arg args yield yields notnew not-new not_new doc] | |
end | |
Index: lib/pp.rb | |
=================================================================== | |
--- lib/pp.rb (revision 28816) | |
+++ lib/pp.rb (working copy) | |
@@ -234,24 +234,24 @@ | |
group(1) { | |
breakable '' | |
pp(obj.instance_eval(v)) | |
+ } | |
} | |
} | |
- } | |
end | |
def pp_hash(obj) | |
group(1, '{', '}') { | |
- seplist(obj, nil, :each_pair) {|k, v| | |
+ seplist(obj, nil, :each_pair) { |k, v| | |
group { | |
pp k | |
text '=>' | |
group(1) { | |
breakable '' | |
pp v | |
+ } | |
} | |
} | |
} | |
- } | |
end | |
end | |
@@ -412,16 +412,13 @@ | |
self.ftype, | |
(m & 0400 == 0 ? ?- : ?r), | |
(m & 0200 == 0 ? ?- : ?w), | |
- (m & 0100 == 0 ? (m & 04000 == 0 ? ?- : ?S) : | |
- (m & 04000 == 0 ? ?x : ?s)), | |
+ (m & 0100 == 0 ? (m & 04000 == 0 ? ?- : ?S) : (m & 04000 == 0 ? ?x : ?s)), | |
(m & 0040 == 0 ? ?- : ?r), | |
(m & 0020 == 0 ? ?- : ?w), | |
- (m & 0010 == 0 ? (m & 02000 == 0 ? ?- : ?S) : | |
- (m & 02000 == 0 ? ?x : ?s)), | |
+ (m & 0010 == 0 ? (m & 02000 == 0 ? ?- : ?S) : (m & 02000 == 0 ? ?x : ?s)), | |
(m & 0004 == 0 ? ?- : ?r), | |
(m & 0002 == 0 ? ?- : ?w), | |
- (m & 0001 == 0 ? (m & 01000 == 0 ? ?- : ?T) : | |
- (m & 01000 == 0 ? ?x : ?t))) | |
+ (m & 0001 == 0 ? (m & 01000 == 0 ? ?- : ?T) : (m & 01000 == 0 ? ?x : ?t))) | |
} | |
q.comma_breakable | |
q.text "nlink="; q.pp self.nlink; q.comma_breakable | |
Index: lib/rubygems/dependency.rb | |
=================================================================== | |
--- lib/rubygems/dependency.rb (revision 28816) | |
+++ lib/rubygems/dependency.rb (working copy) | |
@@ -77,8 +77,7 @@ | |
end | |
def inspect # :nodoc: | |
- "<%s type=%p name=%p requirements=%p>" % | |
- [self.class, @type, @name, requirement.to_s] | |
+ "<%s type=%p name=%p requirements=%p>" % [self.class, @type, @name, requirement.to_s] | |
end | |
## | |
@@ -172,10 +171,7 @@ | |
end | |
def == other # :nodoc: | |
- Gem::Dependency === other && | |
- self.name == other.name && | |
- self.type == other.type && | |
- self.requirement == other.requirement | |
+ Gem::Dependency === other && self.name == other.name && self.type == other.type && self.requirement == other.requirement | |
end | |
## | |
Index: lib/rubygems/config_file.rb | |
=================================================================== | |
--- lib/rubygems/config_file.rb (revision 28816) | |
+++ lib/rubygems/config_file.rb (working copy) | |
@@ -45,13 +45,14 @@ | |
PLATFORM_DEFAULTS = {} | |
- system_config_path = | |
+ system_config_path = ( | |
begin | |
require 'etc.so' | |
Etc.sysconfdir | |
rescue LoadError | |
'/etc' | |
end | |
+ ) | |
SYSTEM_WIDE_CONFIG_FILE = File.join system_config_path, 'gemrc' | |
@@ -272,17 +273,12 @@ | |
# to_yaml only overwrites things you can't override on the command line. | |
def to_yaml # :nodoc: | |
yaml_hash = {} | |
- yaml_hash[:backtrace] = @hash.key?(:backtrace) ? @hash[:backtrace] : | |
- DEFAULT_BACKTRACE | |
- yaml_hash[:benchmark] = @hash.key?(:benchmark) ? @hash[:benchmark] : | |
- DEFAULT_BENCHMARK | |
- yaml_hash[:bulk_threshold] = @hash.key?(:bulk_threshold) ? | |
- @hash[:bulk_threshold] : DEFAULT_BULK_THRESHOLD | |
+ yaml_hash[:backtrace] = @hash.key?(:backtrace) ? @hash[:backtrace] : DEFAULT_BACKTRACE | |
+ yaml_hash[:benchmark] = @hash.key?(:benchmark) ? @hash[:benchmark] : DEFAULT_BENCHMARK | |
+ yaml_hash[:bulk_threshold] = @hash.key?(:bulk_threshold) ? @hash[:bulk_threshold] : DEFAULT_BULK_THRESHOLD | |
yaml_hash[:sources] = Gem.sources | |
- yaml_hash[:update_sources] = @hash.key?(:update_sources) ? | |
- @hash[:update_sources] : DEFAULT_UPDATE_SOURCES | |
- yaml_hash[:verbose] = @hash.key?(:verbose) ? @hash[:verbose] : | |
- DEFAULT_VERBOSITY | |
+ yaml_hash[:update_sources] = @hash.key?(:update_sources) ? @hash[:update_sources] : DEFAULT_UPDATE_SOURCES | |
+ yaml_hash[:verbose] = @hash.key?(:verbose) ? @hash[:verbose] : DEFAULT_VERBOSITY | |
keys = yaml_hash.keys.map { |key| key.to_s } | |
keys << 'debug' | |
Index: lib/rubygems/specification.rb | |
=================================================================== | |
--- lib/rubygems/specification.rb (revision 28816) | |
+++ lib/rubygems/specification.rb (working copy) | |
@@ -432,8 +432,8 @@ | |
def initialize_copy(other_spec) | |
other_ivars = other_spec.instance_variables | |
- other_ivars = other_ivars.map { |ivar| ivar.intern } if # for 1.9 | |
- other_ivars.any? { |ivar| String === ivar } | |
+ other_ivars = other_ivars.map { |ivar| ivar.intern } if (# for 1.9 | |
+ other_ivars.any? { |ivar| String === ivar }) | |
self.class.array_attributes.each do |name| | |
name = :"@#{name}" | |
@@ -487,9 +487,9 @@ | |
raise Gem::Exception, "YAML data doesn't evaluate to gem specification" | |
end | |
- unless (spec.instance_variables.include? '@specification_version' or | |
+ unless ((spec.instance_variables.include? '@specification_version' or | |
spec.instance_variables.include? :@specification_version) and | |
- spec.instance_variable_get :@specification_version | |
+ spec.instance_variable_get :@specification_version) | |
spec.instance_variable_set :@specification_version, | |
NONEXISTENT_SPECIFICATION_VERSION | |
end | |
@@ -531,8 +531,8 @@ | |
# Ignore unknown attributes while loading | |
def method_missing(sym, *a, &b) # :nodoc: | |
- if @specification_version > CURRENT_SPECIFICATION_VERSION and | |
- sym.to_s =~ /=$/ then | |
+ if (@specification_version > CURRENT_SPECIFICATION_VERSION and | |
+ sym.to_s =~ /=$/) then | |
warn "ignoring #{sym} loading #{full_name}" if $DEBUG | |
else | |
super | |
@@ -625,8 +625,7 @@ | |
# Checks if this specification meets the requirement of +dependency+. | |
def satisfies_requirement?(dependency) | |
- return @name == dependency.name && | |
- dependency.requirement.satisfied_by?(@version) | |
+ return @name == dependency.name && dependency.requirement.satisfied_by?(@version) | |
end | |
## | |
@@ -757,8 +756,8 @@ | |
attributes.each do |attr_name, default| | |
next if handled.include? attr_name | |
current_value = self.send(attr_name) | |
- if current_value != default or | |
- self.class.required_attribute? attr_name then | |
+ if (current_value != default or | |
+ self.class.required_attribute? attr_name) then | |
result << " s.#{attr_name} = #{ruby_code current_value}" | |
end | |
end | |
@@ -866,8 +865,8 @@ | |
"invalid platform #{platform.inspect}, see Gem::Platform" | |
end | |
- unless Array === authors and | |
- authors.all? { |author| String === author } then | |
+ unless (Array === authors and | |
+ authors.all? { |author| String === author }) then | |
raise Gem::InvalidSpecificationException, | |
'authors must be Array of Strings' | |
end | |
@@ -901,8 +900,8 @@ | |
'"FIXME" or "TODO" is not a summary' | |
end | |
- if homepage and not homepage.empty? and | |
- homepage !~ /\A[a-z][a-z\d+.-]*:/i then | |
+ if (homepage and not homepage.empty? and | |
+ homepage !~ /\A[a-z][a-z\d+.-]*:/i) then | |
raise Gem::InvalidSpecificationException, | |
"\"#{homepage}\" is not a URI" | |
end | |
@@ -979,8 +978,8 @@ | |
attributes.each do |attr_name, default| | |
current_value = self.send attr_name | |
- if current_value != default or | |
- self.class.required_attribute? attr_name then | |
+ if (current_value != default or | |
+ self.class.required_attribute? attr_name) then | |
q.text "s.#{attr_name} = " | |
@@ -1010,8 +1009,8 @@ | |
requirements.flatten | |
end | |
- unless dependency.respond_to?(:name) && | |
- dependency.respond_to?(:version_requirements) | |
+ unless (dependency.respond_to?(:name) && | |
+ dependency.respond_to?(:version_requirements)) | |
dependency = Gem::Dependency.new(dependency, requirements, type) | |
end | |
@@ -1383,8 +1382,8 @@ | |
end | |
overwrite_accessor :platform= do |platform| | |
- if @original_platform.nil? or | |
- @original_platform == Gem::Platform::RUBY then | |
+ if (@original_platform.nil? or | |
+ @original_platform == Gem::Platform::RUBY) then | |
@original_platform = platform | |
end | |
Index: lib/rubygems/platform.rb | |
=================================================================== | |
--- lib/rubygems/platform.rb (revision 28816) | |
+++ lib/rubygems/platform.rb (working copy) | |
@@ -19,8 +19,7 @@ | |
def self.match(platform) | |
Gem.platforms.any? do |local_platform| | |
- platform.nil? or local_platform == platform or | |
- (local_platform != Gem::Platform::RUBY and local_platform =~ platform) | |
+ platform.nil? or local_platform == platform or (local_platform != Gem::Platform::RUBY and local_platform =~ platform) | |
end | |
end | |
@@ -115,8 +114,7 @@ | |
# the same CPU, OS and version. | |
def ==(other) | |
- self.class === other and | |
- @cpu == other.cpu and @os == other.os and @version == other.version | |
+ self.class === other and @cpu == other.cpu and @os == other.os and @version == other.version | |
end | |
## | |
Index: lib/rubygems/version.rb | |
=================================================================== | |
--- lib/rubygems/version.rb (revision 28816) | |
+++ lib/rubygems/version.rb (working copy) | |
@@ -179,8 +179,7 @@ | |
# series of digits or ASCII letters separated by dots. | |
def initialize version | |
- raise ArgumentError, "Malformed version number string #{version}" unless | |
- self.class.correct?(version) | |
+ raise ArgumentError, "Malformed version number string #{version}" unless self.class.correct?(version) | |
@version = version.to_s | |
@version.strip! | |
Index: lib/rubygems/source_index.rb | |
=================================================================== | |
--- lib/rubygems/source_index.rb (revision 28816) | |
+++ lib/rubygems/source_index.rb (working copy) | |
@@ -172,11 +172,11 @@ | |
prev_ver = latest.key?(name) ? latest[name].version : nil | |
next if curr_ver.prerelease? | |
- next unless prev_ver.nil? or curr_ver >= prev_ver or | |
- latest[name].platform != Gem::Platform::RUBY | |
+ next unless (prev_ver.nil? or curr_ver >= prev_ver or | |
+ latest[name].platform != Gem::Platform::RUBY) | |
- if prev_ver.nil? or | |
- (curr_ver > prev_ver and spec.platform == Gem::Platform::RUBY) then | |
+ if (prev_ver.nil? or | |
+ (curr_ver > prev_ver and spec.platform == Gem::Platform::RUBY)) then | |
result[name].clear | |
latest[name] = spec | |
end | |
@@ -321,8 +321,7 @@ | |
end | |
specs = all_gems.values.select do |spec| | |
- spec.name =~ gem_pattern and | |
- version_requirement.satisfied_by? spec.version | |
+ spec.name =~ gem_pattern and version_requirement.satisfied_by? spec.version | |
end | |
if only_platform then | |
@@ -464,8 +463,7 @@ | |
end | |
def fetch_bulk_index(source_uri) | |
- say "Bulk updating Gem source index for: #{source_uri}" if | |
- Gem.configuration.verbose | |
+ say "Bulk updating Gem source index for: #{source_uri}" if Gem.configuration.verbose | |
index = fetch_index_from(source_uri) | |
if index.nil? then | |
@@ -487,8 +485,7 @@ | |
unzip(zipped_index).split("\n") | |
rescue ::Exception => e | |
unless all then | |
- say "Latest index not found, using quick index" if | |
- Gem.configuration.really_verbose | |
+ say "Latest index not found, using quick index" if Gem.configuration.really_verbose | |
fetch_quick_index source_uri, true | |
else | |
Index: lib/rubygems/gem_path_searcher.rb | |
=================================================================== | |
--- lib/rubygems/gem_path_searcher.rb (revision 28816) | |
+++ lib/rubygems/gem_path_searcher.rb (working copy) | |
@@ -92,8 +92,7 @@ | |
# '/usr/local/lib/ruby/gems/1.8/gems/foobar-1.0/{lib,ext}' | |
def lib_dirs_for(spec) | |
- "#{spec.full_gem_path}/{#{spec.require_paths.join(',')}}" if | |
- spec.require_paths | |
+ "#{spec.full_gem_path}/{#{spec.require_paths.join(',')}}" if spec.require_paths | |
end | |
end | |
Index: lib/rubygems.rb | |
=================================================================== | |
--- lib/rubygems.rb (revision 28816) | |
+++ lib/rubygems.rb (working copy) | |
@@ -210,8 +210,8 @@ | |
version_requirements = Gem::Requirement.default | |
end | |
- unless gem.respond_to?(:name) and | |
- gem.respond_to?(:requirement) then | |
+ unless (gem.respond_to?(:name) and | |
+ gem.respond_to?(:requirement)) then | |
gem = Gem::Dependency.new(gem, version_requirements) | |
end | |
@@ -306,8 +306,8 @@ | |
def self.available?(gem, *requirements) | |
requirements = Gem::Requirement.default if requirements.empty? | |
- unless gem.respond_to?(:name) and | |
- gem.respond_to?(:requirement) then | |
+ unless (gem.respond_to?(:name) and | |
+ gem.respond_to?(:requirement)) then | |
gem = Gem::Dependency.new gem, requirements | |
end | |
@@ -321,12 +321,10 @@ | |
# you to specify specific gem versions. | |
def self.bin_path(name, exec_name = nil, *version_requirements) | |
- version_requirements = Gem::Requirement.default if | |
- version_requirements.empty? | |
+ version_requirements = Gem::Requirement.default if version_requirements.empty? | |
spec = Gem.source_index.find_name(name, version_requirements).last | |
- raise Gem::GemNotFoundException, | |
- "can't find gem #{name} (#{version_requirements})" unless spec | |
+ raise Gem::GemNotFoundException, "can't find gem #{name} (#{version_requirements})" unless spec | |
exec_name ||= spec.default_executable | |
@@ -354,8 +352,7 @@ | |
# The path where gem executables are to be installed. | |
def self.bindir(install_dir=Gem.dir) | |
- return File.join(install_dir, 'bin') unless | |
- install_dir.to_s == Gem.default_dir | |
+ return File.join(install_dir, 'bin') unless install_dir.to_s == Gem.default_dir | |
Gem.default_bindir | |
end | |
@@ -686,9 +683,9 @@ | |
dir = File.dirname File.expand_path(__FILE__) | |
prefix = File.dirname dir | |
- if prefix == File.expand_path(ConfigMap[:sitelibdir]) or | |
+ if (prefix == File.expand_path(ConfigMap[:sitelibdir]) or | |
prefix == File.expand_path(ConfigMap[:libdir]) or | |
- 'lib' != File.basename(dir) then | |
+ 'lib' != File.basename(dir)) then | |
nil | |
else | |
prefix | |
@@ -1076,8 +1073,7 @@ | |
# "#{ConfigMap[:datadir]}/#{package_name}". | |
def RbConfig.datadir(package_name) | |
- Gem.datadir(package_name) || | |
- File.join(Gem::ConfigMap[:datadir], package_name) | |
+ Gem.datadir(package_name) || File.join(Gem::ConfigMap[:datadir], package_name) | |
end | |
require 'rubygems/exceptions' | |
Index: lib/irb/notifier.rb | |
=================================================================== | |
--- lib/irb/notifier.rb (revision 28816) | |
+++ lib/irb/notifier.rb (working copy) | |
@@ -15,10 +15,8 @@ | |
module IRB | |
module Notifier | |
extend Exception2MessageMapper | |
- def_exception :ErrUndefinedNotifier, | |
- "undefined notifier level: %d is specified" | |
- def_exception :ErrUnrecognizedLevel, | |
- "unrecognized notifier level: %s is specified" | |
+ def_exception :ErrUndefinedNotifier, "undefined notifier level: %d is specified" | |
+ def_exception :ErrUnrecognizedLevel, "unrecognized notifier level: %s is specified" | |
def def_notifier(prefix = "", output_method = StdioOutputMethod.new) | |
CompositeNotifier.new(prefix, output_method) | |
Index: lib/irb/extend-command.rb | |
=================================================================== | |
--- lib/irb/extend-command.rb (revision 28816) | |
+++ lib/irb/extend-command.rb (working copy) | |
@@ -156,9 +156,9 @@ | |
to = to.id2name unless to.kind_of?(String) | |
from = from.id2name unless from.kind_of?(String) | |
- if override == OVERRIDE_ALL or | |
+ if (override == OVERRIDE_ALL or | |
(override == OVERRIDE_PRIVATE_ONLY) && !respond_to?(to) or | |
- (override == NO_OVERRIDE) && !respond_to?(to, true) | |
+ (override == NO_OVERRIDE) && !respond_to?(to, true)) | |
target = self | |
(class << self; self; end).instance_eval{ | |
if target.respond_to?(to, true) && | |
Index: lib/irb/ruby-lex.rb | |
=================================================================== | |
--- lib/irb/ruby-lex.rb (revision 28816) | |
+++ lib/irb/ruby-lex.rb (working copy) | |
@@ -403,8 +403,8 @@ | |
@OP.def_rules("<<") do | |
|op, io| | |
tk = nil | |
- if @lex_state != EXPR_END && @lex_state != EXPR_CLASS && | |
- (@lex_state != EXPR_ARG || @space_seen) | |
+ if (@lex_state != EXPR_END && @lex_state != EXPR_CLASS && | |
+ (@lex_state != EXPR_ARG || @space_seen)) | |
c = peek(0) | |
if /\S/ =~ c && (/["'`]/ =~ c || /\w/ =~ c || c == "-") | |
tk = identify_here_document | |
Index: lib/rdoc/generator/darkfish.rb | |
=================================================================== | |
--- lib/rdoc/generator/darkfish.rb (revision 28816) | |
+++ lib/rdoc/generator/darkfish.rb (working copy) | |
@@ -102,8 +102,7 @@ | |
File.directory? dir | |
end | |
- raise RDoc::Error, "could not find template #{template.inspect}" unless | |
- template_dir | |
+ raise RDoc::Error, "could not find template #{template.inspect}" unless template_dir | |
@template_dir = Pathname.new File.expand_path(template_dir) | |
Index: lib/rdoc/rdoc.rb | |
=================================================================== | |
--- lib/rdoc/rdoc.rb (revision 28816) | |
+++ lib/rdoc/rdoc.rb (working copy) | |
@@ -225,8 +225,7 @@ | |
# The effect of this is that if you want a file with a non-standard | |
# extension parsed, you must name it explicitly. | |
- def normalized_file_list(relative_files, force_doc = false, | |
- exclude_pattern = nil) | |
+ def normalized_file_list(relative_files, force_doc = false, exclude_pattern = nil) | |
file_list = [] | |
relative_files.each do |rel_file_name| | |
Index: lib/rdoc/constant.rb | |
=================================================================== | |
--- lib/rdoc/constant.rb (revision 28816) | |
+++ lib/rdoc/constant.rb (working copy) | |
@@ -35,9 +35,7 @@ | |
end | |
def == other | |
- self.class == other.class and | |
- @parent == other.parent and | |
- @name == other.name | |
+ self.class == other.class and @parent == other.parent and @name == other.name | |
end | |
def inspect # :nodoc: | |
Index: lib/rdoc/parser.rb | |
=================================================================== | |
--- lib/rdoc/parser.rb (revision 28816) | |
+++ lib/rdoc/parser.rb (working copy) | |
@@ -89,9 +89,7 @@ | |
def self.zip? file | |
zip_signature = File.read file, 4 | |
- zip_signature == "PK\x03\x04" or | |
- zip_signature == "PK\x05\x06" or | |
- zip_signature == "PK\x07\x08" | |
+ zip_signature == "PK\x03\x04" or zip_signature == "PK\x05\x06" or zip_signature == "PK\x07\x08" | |
end | |
## | |
Index: lib/rdoc/markup/document.rb | |
=================================================================== | |
--- lib/rdoc/markup/document.rb (revision 28816) | |
+++ lib/rdoc/markup/document.rb (working copy) | |
@@ -28,8 +28,7 @@ | |
end | |
when String then | |
raise ArgumentError, | |
- "expected RDoc::Markup::Document and friends, got String" unless | |
- part.empty? | |
+ "expected RDoc::Markup::Document and friends, got String" unless part.empty? | |
else | |
parts << part | |
end | |
Index: lib/rdoc/markup/list_item.rb | |
=================================================================== | |
--- lib/rdoc/markup/list_item.rb (revision 28816) | |
+++ lib/rdoc/markup/list_item.rb (working copy) | |
@@ -30,9 +30,7 @@ | |
end | |
def == other # :nodoc: | |
- self.class == other.class and | |
- @label == other.label and | |
- @parts == other.parts | |
+ self.class == other.class and @label == other.label and @parts == other.parts | |
end | |
def accept visitor | |
Index: lib/rdoc/markup/parser.rb | |
=================================================================== | |
--- lib/rdoc/markup/parser.rb (revision 28816) | |
+++ lib/rdoc/markup/parser.rb (working copy) | |
@@ -125,8 +125,7 @@ | |
if :NEWLINE == peek_token.first then | |
get | |
peek_type, new_indent, peek_column, = peek_token | |
- indent = new_indent if | |
- peek_type == :INDENT and peek_column >= column | |
+ indent = new_indent if peek_type == :INDENT and peek_column >= column | |
unget | |
end | |
else | |
@@ -161,9 +160,9 @@ | |
until @tokens.empty? do | |
type, data, column = get | |
- if column < indent and | |
+ if (column < indent and | |
not type == :NEWLINE and | |
- (type != :INDENT or data < indent) then | |
+ (type != :INDENT or data < indent)) then | |
unget | |
break | |
end | |
@@ -191,9 +190,7 @@ | |
return nil if list_item.empty? | |
- list_item.parts.shift if | |
- RDoc::Markup::BlankLine === list_item.parts.first and | |
- list_item.length > 1 | |
+ list_item.parts.shift if RDoc::Markup::BlankLine === list_item.parts.first and list_item.length > 1 | |
list_item | |
end | |
@@ -395,8 +392,7 @@ | |
unget | |
- raise ParseError, "expected #{token_type} got #{@current_token.inspect}" if | |
- error | |
+ raise ParseError, "expected #{token_type} got #{@current_token.inspect}" if error | |
end | |
## | |
Index: lib/rdoc/markup/attribute_manager.rb | |
=================================================================== | |
--- lib/rdoc/markup/attribute_manager.rb (revision 28816) | |
+++ lib/rdoc/markup/attribute_manager.rb (working copy) | |
@@ -182,8 +182,7 @@ | |
# am.add_word_pair '*', '*', :BOLD | |
def add_word_pair(start, stop, name) | |
- raise ArgumentError, "Word flags may not start with '<'" if | |
- start[0,1] == '<' | |
+ raise ArgumentError, "Word flags may not start with '<'" if start[0,1] == '<' | |
bitmap = RDoc::Markup::Attribute.bitmap_for name | |
@@ -287,8 +286,7 @@ | |
current_attr = new_attr | |
if (current_attr & RDoc::Markup::Attribute::SPECIAL) != 0 then | |
- i += 1 while | |
- i < str_len and (@attrs[i] & RDoc::Markup::Attribute::SPECIAL) != 0 | |
+ i += 1 while i < str_len and (@attrs[i] & RDoc::Markup::Attribute::SPECIAL) != 0 | |
res << RDoc::Markup::Special.new(current_attr, | |
copy_string(start_pos, i)) | |
Index: lib/rdoc/markup/to_html.rb | |
=================================================================== | |
--- lib/rdoc/markup/to_html.rb (revision 28816) | |
+++ lib/rdoc/markup/to_html.rb (working copy) | |
@@ -95,8 +95,8 @@ | |
end | |
end | |
- if (type == "http" or type == "link") and | |
- url =~ /\.(gif|png|jpg|jpeg|bmp)$/ then | |
+ if ((type == "http" or type == "link") and | |
+ url =~ /\.(gif|png|jpg|jpeg|bmp)$/) then | |
"<img src=\"#{url}\" />" | |
else | |
"<a href=\"#{url}\">#{text.sub(%r{^#{type}:/*}, '')}</a>" | |
@@ -256,29 +256,29 @@ | |
item.gsub(/&/, '&'). | |
# convert -- to em-dash, (-- to en-dash) | |
- gsub(/---?/, '—'). #gsub(/--/, '–'). | |
+ gsub(/---?/, '—'). #gsub(/--/, '–'). | |
# convert ... to elipsis (and make sure .... becomes .<elipsis>) | |
- gsub(/\.\.\.\./, '.…').gsub(/\.\.\./, '…'). | |
+ gsub(/\.\.\.\./, '.…').gsub(/\.\.\./, '…'). | |
# convert single closing quote | |
- gsub(%r{([^ \t\r\n\[\{\(])\'}, '\1’'). # } | |
- gsub(%r{\'(?=\W|s\b)}, '’'). | |
+ gsub(%r{([^ \t\r\n\[\{\(])\'}, '\1’'). # } | |
+ gsub(%r{\'(?=\W|s\b)}, '’'). | |
# convert single opening quote | |
- gsub(/'/, '‘'). | |
+ gsub(/'/, '‘'). | |
# convert double closing quote | |
- gsub(%r{([^ \t\r\n\[\{\(])\"(?=\W)}, '\1”'). # } | |
+ gsub(%r{([^ \t\r\n\[\{\(])\"(?=\W)}, '\1”'). # } | |
# convert double opening quote | |
- gsub(/"/, '“'). | |
+ gsub(/"/, '“'). | |
# convert copyright | |
- gsub(/\(c\)/, '©'). | |
+ gsub(/\(c\)/, '©'). | |
# convert registered trademark | |
- gsub(/\(r\)/, '®') | |
+ gsub(/\(r\)/, '®') | |
end | |
## | |
@@ -308,17 +308,14 @@ | |
annotate("<li>") | |
when :LABEL then | |
- annotate("<dt>") + | |
- convert_flow(@am.flow(list_item.label)) + | |
- annotate("</dt>") + | |
- annotate("<dd>") | |
+ annotate("<dt>") + convert_flow(@am.flow(list_item.label)) + annotate("</dt>") + annotate("<dd>") | |
when :NOTE then | |
- annotate("<tr>") + | |
+ annotate("<tr>") + ( | |
annotate("<td valign=\"top\">") + | |
convert_flow(@am.flow(list_item.label)) + | |
annotate("</td>") + | |
- annotate("<td>") | |
+ annotate("<td>") ) | |
else | |
raise RDoc::Error, "Invalid list type: #{list_type.inspect}" | |
end | |
Index: lib/rdoc/markup/list.rb | |
=================================================================== | |
--- lib/rdoc/markup/list.rb (revision 28816) | |
+++ lib/rdoc/markup/list.rb (working copy) | |
@@ -30,9 +30,7 @@ | |
end | |
def == other # :nodoc: | |
- self.class == other.class and | |
- @type == other.type and | |
- @items == other.items | |
+ self.class == other.class and @type == other.type and @items == other.items | |
end | |
def accept visitor | |
Index: lib/rdoc/stats.rb | |
=================================================================== | |
--- lib/rdoc/stats.rb (revision 28816) | |
+++ lib/rdoc/stats.rb (working copy) | |
@@ -86,15 +86,13 @@ | |
end.length | |
items = num_classes + @num_constants + num_modules + @num_methods | |
- doc_items = items - | |
- nodoc_classes - @nodoc_constants - nodoc_modules - @nodoc_methods | |
+ doc_items = items - nodoc_classes - @nodoc_constants - nodoc_modules - @nodoc_methods | |
percent_doc = doc_items.to_f / items * 100 | |
puts "Files: %5d" % @num_files | |
puts "Classes: %5d (%5d undocumented)" % [num_classes, nodoc_classes] | |
- puts "Constants: %5d (%5d undocumented)" % | |
- [@num_constants, @nodoc_constants] | |
+ puts "Constants: %5d (%5d undocumented)" % [@num_constants, @nodoc_constants] | |
puts "Modules: %5d (%5d undocumented)" % [num_modules, nodoc_modules] | |
puts "Methods: %5d (%5d undocumented)" % [@num_methods, @nodoc_methods] | |
puts "%6.2f%% documented" % percent_doc | |
@@ -114,42 +112,42 @@ | |
## | |
# Prints a message at the beginning of parsing | |
- def begin_adding(*) end | |
+ def begin_adding(*) ; end | |
## | |
# Prints when an alias is added | |
- def print_alias(*) end | |
+ def print_alias(*) ; end | |
## | |
# Prints when a class is added | |
- def print_class(*) end | |
+ def print_class(*) ; end | |
## | |
# Prints when a constant is added | |
- def print_constant(*) end | |
+ def print_constant(*) ; end | |
## | |
# Prints when a file is added | |
- def print_file(*) end | |
+ def print_file(*) ; end | |
## | |
# Prints when a method is added | |
- def print_method(*) end | |
+ def print_method(*) ; end | |
## | |
# Prints when a module is added | |
- def print_module(*) end | |
+ def print_module(*) ; end | |
## | |
# Prints when RDoc is done | |
- def done_adding(*) end | |
+ def done_adding(*) ; end | |
end | |
Index: lib/rdoc/class_module.rb | |
=================================================================== | |
--- lib/rdoc/class_module.rb (revision 28816) | |
+++ lib/rdoc/class_module.rb (working copy) | |
@@ -35,8 +35,7 @@ | |
def comment=(comment) | |
return if comment.empty? | |
- comment = "#{@comment}\n---\n#{normalize_comment comment}" unless | |
- @comment.empty? | |
+ comment = "#{@comment}\n---\n#{normalize_comment comment}" unless @comment.empty? | |
super | |
end | |
Index: lib/rdoc/include.rb | |
=================================================================== | |
--- lib/rdoc/include.rb (revision 28816) | |
+++ lib/rdoc/include.rb (working copy) | |
@@ -29,8 +29,7 @@ | |
end | |
def == other # :nodoc: | |
- self.class == other.class and | |
- self.name == other.name | |
+ self.class == other.class and self.name == other.name | |
end | |
## | |
Index: lib/rdoc/ruby_lex.rb | |
=================================================================== | |
--- lib/rdoc/ruby_lex.rb (revision 28816) | |
+++ lib/rdoc/ruby_lex.rb (working copy) | |
@@ -320,8 +320,7 @@ | |
tk = @OP.match(self) | |
@space_seen = tk.kind_of?(TkSPACE) | |
rescue SyntaxError => e | |
- raise RDoc::Error, "syntax error: #{e.message}" if | |
- @exception_on_syntax_error | |
+ raise RDoc::Error, "syntax error: #{e.message}" if @exception_on_syntax_error | |
tk = TkError.new(@seek, @line_no, @char_no) | |
end | |
@@ -452,8 +451,7 @@ | |
@OP.def_rules("<<") do | |
|op, io| | |
tk = nil | |
- if @lex_state != EXPR_END && @lex_state != EXPR_CLASS && | |
- (@lex_state != EXPR_ARG || @space_seen) | |
+ if @lex_state != EXPR_END && @lex_state != EXPR_CLASS && (@lex_state != EXPR_ARG || @space_seen) | |
c = peek(0) | |
if /\S/ =~ c && (/["'`]/ =~ c || /\w/ =~ c || c == "-") | |
tk = identify_here_document | |
Index: lib/rdoc/parser/ruby.rb | |
=================================================================== | |
--- lib/rdoc/parser/ruby.rb (revision 28816) | |
+++ lib/rdoc/parser/ruby.rb (working copy) | |
@@ -386,8 +386,7 @@ | |
when 'main' then | |
@options.main_page = param | |
'' | |
- when 'method', 'singleton-method', | |
- 'attr', 'attr_accessor', 'attr_reader', 'attr_writer' then | |
+ when 'method', 'singleton-method', 'attr', 'attr_accessor', 'attr_reader', 'attr_writer' then | |
false # handled elsewhere | |
when 'section' then | |
context.set_current_section param, comment | |
@@ -615,8 +614,7 @@ | |
case tk | |
when TkSEMICOLON then | |
break | |
- when TkLPAREN, TkfLPAREN, TkLBRACE, TkLBRACK, TkDO, TkIF, TkUNLESS, | |
- TkCASE then | |
+ when TkLPAREN, TkfLPAREN, TkLBRACE, TkLBRACK, TkDO, TkIF, TkUNLESS, TkCASE then | |
nest += 1 | |
when TkRPAREN, TkRBRACE, TkRBRACK, TkEND then | |
nest -= 1 | |
@@ -640,8 +638,7 @@ | |
break | |
end | |
when TkNL then | |
- if nest <= 0 && | |
- (@scanner.lex_state == EXPR_END || !@scanner.continue) then | |
+ if nest <= 0 && (@scanner.lex_state == EXPR_END || !@scanner.continue) then | |
unget_tk tk | |
break | |
end | |
@@ -1220,8 +1217,7 @@ | |
when TkIDENTIFIER then | |
if nest == 1 and current_method.nil? then | |
case tk.name | |
- when 'private', 'protected', 'public', 'private_class_method', | |
- 'public_class_method', 'module_function' then | |
+ when 'private', 'protected', 'public', 'private_class_method', 'public_class_method', 'module_function' then | |
parse_visibility container, single, tk | |
keep_comment = true | |
when 'attr' then | |
@@ -1229,8 +1225,7 @@ | |
when /^attr_(reader|writer|accessor)$/ then | |
parse_attr_accessor container, single, tk, comment | |
when 'alias_method' then | |
- parse_alias container, single, tk, comment if | |
- container.document_self | |
+ parse_alias container, single, tk, comment if container.document_self | |
when 'require', 'include' then | |
# ignore | |
else | |
Index: lib/rdoc/parser/c.rb | |
=================================================================== | |
--- lib/rdoc/parser/c.rb (revision 28816) | |
+++ lib/rdoc/parser/c.rb (working copy) | |
@@ -431,12 +431,12 @@ | |
# use it for the parameters. | |
def find_modifiers(comment, meth_obj) | |
- if comment.sub!(/:nodoc:\s*^\s*\*?\s*$/m, '') or | |
- comment.sub!(/\A\/\*\s*:nodoc:\s*\*\/\Z/, '') | |
+ if (comment.sub!(/:nodoc:\s*^\s*\*?\s*$/m, '') or | |
+ comment.sub!(/\A\/\*\s*:nodoc:\s*\*\/\Z/, '')) | |
meth_obj.document_self = false | |
end | |
- if comment.sub!(/call-seq:(.*?)^\s*\*?\s*$/m, '') or | |
- comment.sub!(/\A\/\*\s*call-seq:(.*?)\*\/\Z/, '') | |
+ if (comment.sub!(/call-seq:(.*?)^\s*\*?\s*$/m, '') or | |
+ comment.sub!(/\A\/\*\s*call-seq:(.*?)\*\/\Z/, '')) | |
seq = $1 | |
seq.gsub!(/^\s*\*\s*/, '') | |
meth_obj.call_seq = seq | |
Index: lib/rdoc/options.rb | |
=================================================================== | |
--- lib/rdoc/options.rb (revision 28816) | |
+++ lib/rdoc/options.rb (working copy) | |
@@ -160,26 +160,19 @@ | |
opt.separator "Parsing Options:" | |
opt.separator nil | |
- opt.on("--all", "-a", | |
- "Include all methods (not just public) in", | |
- "the output.") do |value| | |
+ opt.on("--all", "-a", "Include all methods (not just public) in", "the output.") do |value| | |
@show_all = value | |
end | |
opt.separator nil | |
- opt.on("--exclude=PATTERN", "-x", Regexp, | |
- "Do not process files or directories", | |
- "matching PATTERN.") do |value| | |
+ opt.on("--exclude=PATTERN", "-x", Regexp, "Do not process files or directories", "matching PATTERN.") do |value| | |
@exclude << value | |
end | |
opt.separator nil | |
- opt.on("--extension=NEW=OLD", "-E", | |
- "Treat files ending with .new as if they", | |
- "ended with .old. Using '-E cgi=rb' will", | |
- "cause xxx.cgi to be parsed as a Ruby file.") do |value| | |
+ opt.on("--extension=NEW=OLD", "-E", "Treat files ending with .new as if they", "ended with .old. Using '-E cgi=rb' will", "cause xxx.cgi to be parsed as a Ruby file.") do |value| | |
new, old = value.split(/=/, 2) | |
unless new and old then | |
@@ -193,16 +186,13 @@ | |
opt.separator nil | |
- opt.on("--[no-]force-update", "-U", | |
- "Forces rdoc to scan all sources even if", | |
- "newer than the flag file.") do |value| | |
+ opt.on("--[no-]force-update", "-U", "Forces rdoc to scan all sources even if", "newer than the flag file.") do |value| | |
@force_update = value | |
end | |
opt.separator nil | |
- opt.on("--pipe", | |
- "Convert RDoc on stdin to HTML") do | |
+ opt.on("--pipe", "Convert RDoc on stdin to HTML") do | |
@pipe = true | |
end | |
@@ -210,8 +200,7 @@ | |
opt.separator "Generator Options:" | |
opt.separator nil | |
- opt.on("--charset=CHARSET", "-c", | |
- "Specifies the output HTML character-set.") do |value| | |
+ opt.on("--charset=CHARSET", "-c", "Specifies the output HTML character-set.") do |value| | |
@charset = value | |
end | |
@@ -219,75 +208,56 @@ | |
generator_text = @generators.keys.map { |name| " #{name}" }.sort | |
- opt.on("--fmt=FORMAT", "--format=FORMAT", "-f", @generators.keys, | |
- "Set the output formatter. One of:", *generator_text) do |value| | |
+ opt.on("--fmt=FORMAT", "--format=FORMAT", "-f", @generators.keys, "Set the output formatter. One of:", *generator_text) do |value| | |
@generator_name = value.downcase | |
setup_generator | |
end | |
opt.separator nil | |
- opt.on("--include=DIRECTORIES", "-i", Array, | |
- "Set (or add to) the list of directories to", | |
- "be searched when satisfying :include:", | |
- "requests. Can be used more than once.") do |value| | |
+ opt.on("--include=DIRECTORIES", "-i", Array, "Set (or add to) the list of directories to", "be searched when satisfying :include:", "requests. Can be used more than once.") do |value| | |
@rdoc_include.concat value.map { |dir| dir.strip } | |
end | |
opt.separator nil | |
- opt.on("--main=NAME", "-m", | |
- "NAME will be the initial page displayed.") do |value| | |
+ opt.on("--main=NAME", "-m", "NAME will be the initial page displayed.") do |value| | |
@main_page = value | |
end | |
opt.separator nil | |
- opt.on("--output=DIR", "--op", "-o", | |
- "Set the output directory.") do |value| | |
+ opt.on("--output=DIR", "--op", "-o", "Set the output directory.") do |value| | |
@op_dir = value | |
end | |
opt.separator nil | |
- opt.on("--show-hash", "-H", | |
- "A name of the form #name in a comment is a", | |
- "possible hyperlink to an instance method", | |
- "name. When displayed, the '#' is removed", | |
- "unless this option is specified.") do |value| | |
+ opt.on("--show-hash", "-H", "A name of the form #name in a comment is a", "possible hyperlink to an instance method", "name. When displayed, the '#' is removed", "unless this option is specified.") do |value| | |
@show_hash = value | |
end | |
opt.separator nil | |
- opt.on("--tab-width=WIDTH", "-w", OptionParser::DecimalInteger, | |
- "Set the width of tab characters.") do |value| | |
+ opt.on("--tab-width=WIDTH", "-w", OptionParser::DecimalInteger, "Set the width of tab characters.") do |value| | |
@tab_width = value | |
end | |
opt.separator nil | |
- opt.on("--template=NAME", "-T", | |
- "Set the template used when generating", | |
- "output.") do |value| | |
+ opt.on("--template=NAME", "-T", "Set the template used when generating", "output.") do |value| | |
@template = value | |
end | |
opt.separator nil | |
- opt.on("--title=TITLE", "-t", | |
- "Set TITLE as the title for HTML output.") do |value| | |
+ opt.on("--title=TITLE", "-t", "Set TITLE as the title for HTML output.") do |value| | |
@title = value | |
end | |
opt.separator nil | |
- opt.on("--webcvs=URL", "-W", | |
- "Specify a URL for linking to a web frontend", | |
- "to CVS. If the URL contains a '\%s', the", | |
- "name of the current file will be", | |
- "substituted; if the URL doesn't contain a", | |
- "'\%s', the filename will be appended to it.") do |value| | |
+ opt.on("--webcvs=URL", "-W", "Specify a URL for linking to a web frontend", "to CVS. If the URL contains a '\%s', the", "name of the current file will be", "substituted; if the URL doesn't contain a", "'\%s', the filename will be appended to it.") do |value| | |
@webcvs = value | |
end | |
@@ -299,12 +269,7 @@ | |
opt.separator "ri Generator Options:" | |
opt.separator nil | |
- opt.on("--ri", "-r", | |
- "Generate output for use by `ri`. The files", | |
- "are stored in the '.rdoc' directory under", | |
- "your home directory unless overridden by a", | |
- "subsequent --op parameter, so no special", | |
- "privileges are needed.") do |value| | |
+ opt.on("--ri", "-r", "Generate output for use by `ri`. The files", "are stored in the '.rdoc' directory under", "your home directory unless overridden by a", "subsequent --op parameter, so no special", "privileges are needed.") do |value| | |
@generator_name = "ri" | |
@op_dir ||= RDoc::RI::Paths::HOMEDIR | |
setup_generator | |
@@ -312,11 +277,7 @@ | |
opt.separator nil | |
- opt.on("--ri-site", "-R", | |
- "Generate output for use by `ri`. The files", | |
- "are stored in a site-wide directory,", | |
- "making them accessible to others, so", | |
- "special privileges are needed.") do |value| | |
+ opt.on("--ri-site", "-R", "Generate output for use by `ri`. The files", "are stored in a site-wide directory,", "making them accessible to others, so", "special privileges are needed.") do |value| | |
@generator_name = "ri" | |
@op_dir = RDoc::RI::Paths::SITEDIR | |
setup_generator | |
@@ -326,23 +287,19 @@ | |
opt.separator "Generic Options:" | |
opt.separator nil | |
- opt.on("-D", "--[no-]debug", | |
- "Displays lots on internal stuff.") do |value| | |
+ opt.on("-D", "--[no-]debug", "Displays lots on internal stuff.") do |value| | |
$DEBUG_RDOC = value | |
end | |
- opt.on("--[no-]ignore-invalid", | |
- "Ignore invalid options and continue.") do |value| | |
+ opt.on("--[no-]ignore-invalid", "Ignore invalid options and continue.") do |value| | |
ignore_invalid = value | |
end | |
- opt.on("--quiet", "-q", | |
- "Don't show progress as we parse.") do |value| | |
+ opt.on("--quiet", "-q", "Don't show progress as we parse.") do |value| | |
@verbosity = 0 | |
end | |
- opt.on("--verbose", "-v", | |
- "Display extra progress as we parse.") do |value| | |
+ opt.on("--verbose", "-v", "Display extra progress as we parse.") do |value| | |
@verbosity = 2 | |
end | |
Index: lib/rdoc/attr.rb | |
=================================================================== | |
--- lib/rdoc/attr.rb (revision 28816) | |
+++ lib/rdoc/attr.rb (working copy) | |
@@ -48,9 +48,7 @@ | |
# Attributes are equal when their names and rw is identical | |
def == other | |
- self.class == other.class and | |
- self.name == other.name and | |
- self.rw == other.rw | |
+ self.class == other.class and self.name == other.name and self.rw == other.rw | |
end | |
## | |
Index: lib/optparse.rb | |
=================================================================== | |
--- lib/optparse.rb (revision 28816) | |
+++ lib/optparse.rb (working copy) | |
@@ -313,8 +313,7 @@ | |
short = nil, long = nil, arg = nil, | |
desc = ([] if short or long), block = Proc.new) | |
raise if Array === pattern | |
- @pattern, @conv, @short, @long, @arg, @desc, @block = | |
- pattern, conv, short, long, arg, desc, block | |
+ @pattern, @conv, @short, @long, @arg, @desc, @block = pattern, conv, short, long, arg, desc, block | |
end | |
# | |
@@ -536,8 +535,7 @@ | |
# | |
def accept(t, pat = /.*/m, &block) | |
if pat | |
- pat.respond_to?(:match) or | |
- raise TypeError, "has no `match'", ParseError.filter_backtrace(caller(2)) | |
+ pat.respond_to?(:match) or raise TypeError, "has no `match'", ParseError.filter_backtrace(caller(2)) | |
else | |
pat = t if t.respond_to?(:match) | |
end | |
@@ -735,8 +733,7 @@ | |
require 'optparse/version' | |
rescue LoadError | |
else | |
- show_version(*pkg.split(/,/)) or | |
- abort("#{parser.program_name}: no version found in package #{pkg}") | |
+ show_version(*pkg.split(/,/)) or abort("#{parser.program_name}: no version found in package #{pkg}") | |
exit | |
end | |
end | |
@@ -1185,9 +1182,7 @@ | |
s = (style || default_style).new(pattern, | |
conv, nil, nil, arg, desc, block) | |
end | |
- return s, short, long, | |
- (not_style.new(not_pattern, not_conv, sdesc, ldesc, nil, desc, block) if not_style), | |
- nolong | |
+ return s, short, long, (not_style.new(not_pattern, not_conv, sdesc, ldesc, nil, desc, block) if not_style), nolong | |
end | |
def define(*opts, &block) | |
Index: lib/cgi/util.rb | |
=================================================================== | |
--- lib/cgi/util.rb (revision 28816) | |
+++ lib/cgi/util.rb (working copy) | |
@@ -62,18 +62,18 @@ | |
when 'lt' then '<' | |
when /\A#0*(\d+)\z/ | |
n = $1.to_i | |
- if enc == Encoding::UTF_8 or | |
+ if (enc == Encoding::UTF_8 or | |
enc == Encoding::ISO_8859_1 && n < 256 or | |
- asciicompat && n < 128 | |
+ asciicompat && n < 128) | |
n.chr(enc) | |
else | |
"&##{$1};" | |
end | |
when /\A#x([0-9a-f]+)\z/i | |
n = $1.hex | |
- if enc == Encoding::UTF_8 or | |
+ if (enc == Encoding::UTF_8 or | |
enc == Encoding::ISO_8859_1 && n < 256 or | |
- asciicompat && n < 128 | |
+ asciicompat && n < 128) | |
n.chr(enc) | |
else | |
"&#x#{$1};" | |
Index: lib/cgi/core.rb | |
=================================================================== | |
--- lib/cgi/core.rb (revision 28816) | |
+++ lib/cgi/core.rb (working copy) | |
@@ -574,8 +574,8 @@ | |
# Handles multipart forms (in particular, forms that involve file uploads). | |
# Reads query parameters in the @params field, and cookies into @cookies. | |
def initialize_query() | |
- if ("POST" == env_table['REQUEST_METHOD']) and | |
- %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|.match(env_table['CONTENT_TYPE']) | |
+ if (("POST" == env_table['REQUEST_METHOD']) and | |
+ %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|.match(env_table['CONTENT_TYPE'])) | |
raise StandardError.new("too large multipart data.") if env_table['CONTENT_LENGTH'].to_i > MAX_MULTIPART_LENGTH | |
boundary = $1.dup | |
@multipart = true | |
Index: lib/date/format.rb | |
=================================================================== | |
--- lib/date/format.rb (revision 28816) | |
+++ lib/date/format.rb (working copy) | |
@@ -209,8 +209,7 @@ | |
emit_a(e, w, f) | |
end | |
- private :emit, :emit_w, :emit_n, :emit_sn, :emit_z, | |
- :emit_a, :emit_ad, :emit_au | |
+ private :emit, :emit_w, :emit_n, :emit_sn, :emit_z, :emit_a, :emit_ad, :emit_au | |
def strftime(fmt='%F') | |
fmt.gsub(/%([-_0^#]+)?(\d+)?([EO]?(?::{1,3}z|.))/m) do | |
@@ -396,14 +395,12 @@ | |
if s | |
case s | |
when 'A', 'a' | |
- return unless str.sub!(/\A(#{Format::DAYS.keys.join('|')})/io, '') || | |
- str.sub!(/\A(#{Format::ABBR_DAYS.keys.join('|')})/io, '') | |
+ return unless str.sub!(/\A(#{Format::DAYS.keys.join('|')})/io, '') || str.sub!(/\A(#{Format::ABBR_DAYS.keys.join('|')})/io, '') | |
val = Format::DAYS[$1.downcase] || Format::ABBR_DAYS[$1.downcase] | |
return unless val | |
e.wday = val | |
when 'B', 'b', 'h' | |
- return unless str.sub!(/\A(#{Format::MONTHS.keys.join('|')})/io, '') || | |
- str.sub!(/\A(#{Format::ABBR_MONTHS.keys.join('|')})/io, '') | |
+ return unless str.sub!(/\A(#{Format::MONTHS.keys.join('|')})/io, '') || str.sub!(/\A(#{Format::ABBR_MONTHS.keys.join('|')})/io, '') | |
val = Format::MONTHS[$1.downcase] || Format::ABBR_MONTHS[$1.downcase] | |
return unless val | |
e.mon = val | |
@@ -816,13 +813,11 @@ | |
e.mon = $1.to_i | |
e.mday = $2.to_i if $2 | |
true | |
- elsif /[,.](\d{2}|\d{4})-\d{3}\b/ !~ str && | |
- str.sub!(/\b(\d{2}|\d{4})-(\d{3})\b/, ' ') | |
+ elsif /[,.](\d{2}|\d{4})-\d{3}\b/ !~ str && str.sub!(/\b(\d{2}|\d{4})-(\d{3})\b/, ' ') | |
e.year = $1.to_i | |
e.yday = $2.to_i | |
true | |
- elsif /\d-\d{3}\b/ !~ str && | |
- str.sub!(/\b-(\d{3})\b/, ' ') | |
+ elsif /\d-\d{3}\b/ !~ str && str.sub!(/\b-(\d{3})\b/, ' ') | |
e.yday = $1.to_i | |
true | |
end | |
@@ -1022,10 +1017,7 @@ | |
end | |
end | |
- private_class_method :_parse_day, :_parse_time, # :_parse_beat, | |
- :_parse_eu, :_parse_us, :_parse_iso, :_parse_iso2, | |
- :_parse_jis, :_parse_vms, :_parse_sla, :_parse_dot, | |
- :_parse_year, :_parse_mon, :_parse_mday, :_parse_ddd | |
+ private_class_method :_parse_day, :_parse_time, :_parse_eu, :_parse_us, :_parse_iso, :_parse_iso2, :_parse_jis, :_parse_vms, :_parse_sla, :_parse_dot, :_parse_year, :_parse_mon, :_parse_mday, :_parse_ddd | |
def self._parse(str, comp=true) | |
str = str.dup | |
@@ -1076,14 +1068,12 @@ | |
if e._comp | |
if e.cwyear | |
if e.cwyear >= 0 && e.cwyear <= 99 | |
- e.cwyear += if e.cwyear >= 69 | |
- then 1900 else 2000 end | |
+ e.cwyear += (if e.cwyear >= 69 then 1900 else 2000 end) | |
end | |
end | |
if e.year | |
if e.year >= 0 && e.year <= 99 | |
- e.year += if e.year >= 69 | |
- then 1900 else 2000 end | |
+ e.year += (if e.year >= 69 then 1900 else 2000 end) | |
end | |
end | |
end | |
Index: lib/irb.rb | |
=================================================================== | |
--- lib/irb.rb (revision 28816) | |
+++ lib/irb.rb (working copy) | |
@@ -126,8 +126,7 @@ | |
end | |
if @context.auto_indent_mode | |
unless ltype | |
- ind = prompt(@context.prompt_i, ltype, indent, line_no)[/.*\z/].size + | |
- indent * 2 - p.size | |
+ ind = prompt(@context.prompt_i, ltype, indent, line_no)[/.*\z/].size + indent * 2 - p.size | |
ind += 2 if continue | |
@context.io.prompt = p + " " * ind if ind > 0 | |
end | |
@@ -166,8 +165,7 @@ | |
end | |
if exc | |
print exc.class, ": ", exc, "\n" | |
- if exc.backtrace[0] =~ /irb(2)?(\/.*|-.*|\.rb)?:/ && exc.class.to_s !~ /^IRB/ && | |
- !(SyntaxError === exc) | |
+ if exc.backtrace[0] =~ /irb(2)?(\/.*|-.*|\.rb)?:/ && exc.class.to_s !~ /^IRB/ && !(SyntaxError === exc) | |
irb_bug = true | |
else | |
irb_bug = false | |
Index: lib/time.rb | |
=================================================================== | |
--- lib/time.rb (revision 28816) | |
+++ lib/time.rb (working copy) | |
@@ -189,8 +189,7 @@ | |
off = zone_offset(zone, year) if zone | |
if off | |
- year, mon, day, hour, min, sec = | |
- apply_offset(year, mon, day, hour, min, sec, off) | |
+ year, mon, day, hour, min, sec = apply_offset(year, mon, day, hour, min, sec, off) | |
t = self.utc(year, mon, day, hour, min, sec, usec) | |
t.localtime if !zone_utc?(zone) | |
t | |
@@ -330,8 +329,7 @@ | |
year | |
end | |
- year, mon, day, hour, min, sec = | |
- apply_offset(year, mon, day, hour, min, sec, zone_offset(zone)) | |
+ year, mon, day, hour, min, sec = apply_offset(year, mon, day, hour, min, sec, zone_offset(zone)) | |
t = self.utc(year, mon, day, hour, min, sec) | |
t.localtime if !zone_utc?(zone) | |
t | |
@@ -425,8 +423,7 @@ | |
end | |
if $8 | |
zone = $8 | |
- year, mon, day, hour, min, sec = | |
- apply_offset(year, mon, day, hour, min, sec, zone_offset(zone)) | |
+ year, mon, day, hour, min, sec = apply_offset(year, mon, day, hour, min, sec, zone_offset(zone)) | |
self.utc(year, mon, day, hour, min, sec, usec) | |
else | |
self.local(year, mon, day, hour, min, sec, usec) | |
Index: parse.y | |
=================================================================== | |
--- parse.y (revision 28816) | |
+++ parse.y (working copy) | |
@@ -26,6 +26,9 @@ | |
#include <errno.h> | |
#include <ctype.h> | |
+#define MAXINDENT 100 /* Max indentation level */ | |
+#define TABSIZE 8 | |
+ | |
#define numberof(array) (int)(sizeof(array) / sizeof((array)[0])) | |
#define YYMALLOC(size) rb_parser_malloc(parser, size) | |
@@ -208,6 +211,7 @@ | |
stack_type parser_cmdarg_stack; | |
int parser_class_nest; | |
int parser_paren_nest; | |
+ int parser_brace_nest; | |
int parser_lpar_beg; | |
int parser_in_single; | |
int parser_in_def; | |
@@ -239,6 +243,15 @@ | |
int parser_yydebug; | |
+ int tabsize; /* Tab spacing */ | |
+ int indent; /* Current indentation index */ | |
+ int indstack[MAXINDENT]; /* Stack of indents */ | |
+ int atbol; /* Nonzero if at begin of new line */ | |
+ int pendin; /* Pending indents (if > 0) or dedents (if < 0) */ | |
+ int alttabsize; /* Alternate tab spacing */ | |
+ int altindstack[MAXINDENT]; /* Stack of alternate indents */ | |
+ int emit_dummy_lf; | |
+ | |
#ifndef RIPPER | |
/* Ruby core only */ | |
NODE *parser_eval_tree_begin; | |
@@ -290,6 +303,7 @@ | |
#define cmdarg_stack (parser->parser_cmdarg_stack) | |
#define class_nest (parser->parser_class_nest) | |
#define paren_nest (parser->parser_paren_nest) | |
+#define brace_nest (parser->parser_brace_nest) | |
#define lpar_beg (parser->parser_lpar_beg) | |
#define in_single (parser->parser_in_single) | |
#define in_def (parser->parser_in_def) | |
@@ -617,12 +631,18 @@ | |
%pure_parser | |
%parse-param {struct parser_params *parser} | |
+//%expect 170 | |
+%expect 19 | |
%union { | |
VALUE val; | |
NODE *node; | |
ID id; | |
int num; | |
+ struct { | |
+ NODE *first; | |
+ NODE *second; | |
+ } pair; | |
const struct vtable *vars; | |
} | |
@@ -680,6 +700,9 @@ | |
keyword__LINE__ | |
keyword__FILE__ | |
keyword__ENCODING__ | |
+ keyword_pass | |
+ tINDENT | |
+ tDEDENT | |
%token <id> tIDENTIFIER tFID tGVAR tIVAR tCONSTANT tCVAR tLABEL | |
%token <node> tINTEGER tFLOAT tSTRING_CONTENT tCHAR | |
@@ -691,23 +714,26 @@ | |
%type <node> words qwords word_list qword_list word | |
%type <node> literal numeric dsym cpath | |
%type <node> top_compstmt top_stmts top_stmt | |
-%type <node> bodystmt compstmt stmts stmt expr arg primary command command_call method_call | |
+%type <node> bodystmt bodystmt_ compstmt compstmt_ stmts stmts_ stmt stmt_ expr arg primary command command_call method_call | |
%type <node> expr_value arg_value primary_value | |
-%type <node> if_tail opt_else case_body cases opt_rescue exc_list exc_var opt_ensure | |
+%type <node> if_tail if_tail_ opt_else opt_else_ case_body case_body_ cases cases_ opt_rescue opt_rescue_ exc_list exc_var opt_ensure opt_ensure_ | |
%type <node> args call_args opt_call_args | |
%type <node> paren_args opt_paren_args | |
%type <node> command_args aref_args opt_block_arg block_arg var_ref var_lhs | |
-%type <node> mrhs superclass block_call block_command | |
+%type <node> mrhs superclass superclass_ block_call block_command | |
%type <node> f_block_optarg f_block_opt | |
-%type <node> f_arglist f_args f_arg f_arg_item f_optarg f_marg f_marg_list f_margs | |
+%type <node> f_arglist f_arglist_ f_args f_arg f_arg_item f_optarg f_marg f_marg_list f_margs | |
%type <node> assoc_list assocs assoc undef_list backref string_dvar for_var | |
%type <node> block_param opt_block_param block_param_def f_opt | |
%type <node> bv_decls opt_bv_decl bvar | |
%type <node> lambda f_larglist lambda_body | |
%type <node> brace_block cmd_brace_block do_block lhs none fitem | |
%type <node> mlhs mlhs_head mlhs_basic mlhs_item mlhs_node mlhs_post mlhs_inner | |
+%type <node> ordinary_do_block | |
%type <id> fsym variable sym symbol operation operation2 operation3 | |
%type <id> cname fname op f_rest_arg f_block_arg opt_f_block_arg f_norm_arg f_bad_arg | |
+%type | |
+ <pair> f_arglist_and_body /* workaround for ripper */ | |
/*%%%*/ | |
/*% | |
%type <val> program reswords then do dot_or_colon | |
@@ -815,7 +841,7 @@ | |
} | |
; | |
-top_compstmt : top_stmts opt_terms | |
+top_compstmt : top_stmts opt_terms_ | |
{ | |
/*%%%*/ | |
void_stmts($1); | |
@@ -843,7 +869,7 @@ | |
$$ = dispatch2(stmts_add, dispatch0(stmts_new), $1); | |
%*/ | |
} | |
- | top_stmts terms top_stmt | |
+ | top_stmts terms_ top_stmt | |
{ | |
/*%%%*/ | |
$$ = block_append($1, newline_node($3)); | |
@@ -915,9 +941,42 @@ | |
} | |
; | |
-compstmt : stmts opt_terms | |
+bodystmt_ : compstmt_ | |
+ opt_rescue_ | |
+ opt_else_ | |
+ opt_ensure_ | |
{ | |
/*%%%*/ | |
+ $$ = $1; | |
+ if ($2) { | |
+ $$ = NEW_RESCUE($1, $2, $3); | |
+ } | |
+ else if ($3) { | |
+ rb_warn0("else without rescue is useless"); | |
+ $$ = block_append($$, $3); | |
+ } | |
+ if ($4) { | |
+ if ($$) { | |
+ $$ = NEW_ENSURE($$, $4); | |
+ } | |
+ else { | |
+ $$ = block_append($4, NEW_NIL()); | |
+ } | |
+ } | |
+ fixpos($$, $1); | |
+ /*% | |
+ $$ = dispatch4(body_stmt, | |
+ escape_Qundef($1), | |
+ escape_Qundef($2), | |
+ escape_Qundef($3), | |
+ escape_Qundef($4)); | |
+ %*/ | |
+ } | |
+ ; | |
+ | |
+compstmt : stmts opt_terms_ | |
+ { | |
+ /*%%%*/ | |
void_stmts($1); | |
fixup_nodes(&deferred_nodes); | |
/*% | |
@@ -926,6 +985,17 @@ | |
} | |
; | |
+compstmt_ : tINDENT stmts_ opt_terms tDEDENT | |
+ { | |
+ /*%%%*/ | |
+ void_stmts($2); | |
+ fixup_nodes(&deferred_nodes); | |
+ /*% | |
+ %*/ | |
+ $$ = $2; | |
+ } | |
+ ; | |
+ | |
stmts : none | |
{ | |
/*%%%*/ | |
@@ -943,7 +1013,7 @@ | |
$$ = dispatch2(stmts_add, dispatch0(stmts_new), $1); | |
%*/ | |
} | |
- | stmts terms stmt | |
+ | stmts terms_ stmt | |
{ | |
/*%%%*/ | |
$$ = block_append($1, newline_node($3)); | |
@@ -957,6 +1027,48 @@ | |
} | |
; | |
+stmts_ : stmt_ | |
+ { | |
+ /*%%%*/ | |
+ $$ = newline_node($1); | |
+ /*% | |
+ $$ = dispatch2(stmts_add, dispatch0(stmts_new), $1); | |
+ %*/ | |
+ } | |
+ | stmts_ terms stmt_ | |
+ { | |
+ /*%%%*/ | |
+ $$ = block_append($1, newline_node($3)); | |
+ /*% | |
+ $$ = dispatch2(stmts_add, $1, $3); | |
+ %*/ | |
+ } | |
+ | error stmt_ | |
+ { | |
+ $$ = remove_begin($2); | |
+ } | |
+ ; | |
+ | |
+stmt_ : k_pass | |
+ { | |
+ /*%%%*/ | |
+ $$ = NEW_BEGIN(0); | |
+ /*% | |
+ $$ = dispatch2(stmts_add, dispatch0(stmts_new), | |
+ dispatch0(void_stmt)); | |
+ %*/ | |
+ lex_state = EXPR_END; | |
+ } | |
+ | stmt | |
+ { | |
+ /*%%%*/ | |
+ $$ = newline_node($1); | |
+ /*% | |
+ $$ = dispatch2(stmts_add, dispatch0(stmts_new), $1); | |
+ %*/ | |
+ } | |
+ ; | |
+ | |
stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem | |
{ | |
/*%%%*/ | |
@@ -1055,6 +1167,28 @@ | |
$$ = dispatch2(rescue_mod, $3, $1); | |
%*/ | |
} | |
+ | keyword_BEGIN ':' | |
+ { | |
+ if (in_def || in_single) { | |
+ yyerror("BEGIN in method"); | |
+ } | |
+ /*%%%*/ | |
+ /* local_push(0); */ | |
+ /*% | |
+ %*/ | |
+ } | |
+ compstmt_ | |
+ { | |
+ /*%%%*/ | |
+ ruby_eval_tree_begin = block_append(ruby_eval_tree_begin, | |
+ $4); | |
+ /* NEW_PREEXE($4)); */ | |
+ /* local_pop(); */ | |
+ $$ = NEW_BEGIN(0); | |
+ /*% | |
+ $$ = dispatch1(BEGIN, $4); | |
+ %*/ | |
+ } | |
| keyword_END '{' compstmt '}' | |
{ | |
if (in_def || in_single) { | |
@@ -1067,6 +1201,18 @@ | |
$$ = dispatch1(END, $3); | |
%*/ | |
} | |
+ | keyword_END ':' compstmt_ | |
+ { | |
+ if (in_def || in_single) { | |
+ rb_warn0("END in method; use at_exit"); | |
+ } | |
+ /*%%%*/ | |
+ $$ = NEW_POSTEXE(NEW_NODE( | |
+ NODE_SCOPE, 0 /* tbl */, $3 /* body */, 0 /* args */)); | |
+ /*% | |
+ $$ = dispatch1(END, $3); | |
+ %*/ | |
+ } | |
| lhs '=' command_call | |
{ | |
/*%%%*/ | |
@@ -1313,15 +1459,16 @@ | |
/*% | |
%*/ | |
} | |
+ discard_indent_dedent | |
opt_block_param | |
compstmt | |
'}' | |
{ | |
/*%%%*/ | |
- $$ = NEW_ITER($3,$4); | |
+ $$ = NEW_ITER($4,$5); | |
nd_set_line($$, $<num>2); | |
/*% | |
- $$ = dispatch2(brace_block, escape_Qundef($3), $4); | |
+ $$ = dispatch2(brace_block, escape_Qundef($4), $5); | |
%*/ | |
dyna_pop($<vars>1); | |
} | |
@@ -1865,7 +2012,7 @@ | |
| 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 | |
+ | keyword_while | keyword_until | keyword_pass | |
; | |
arg : lhs '=' arg | |
@@ -2608,6 +2755,30 @@ | |
$$ = dispatch1(begin, $3); | |
%*/ | |
} | |
+ | k_begin ':' | |
+ { | |
+ /*%%%*/ | |
+ $<num>$ = ruby_sourceline; | |
+ /*% | |
+ %*/ | |
+ } | |
+ bodystmt_ | |
+ { | |
+ /*%%%*/ | |
+ if ($4 == NULL) { | |
+ $$ = NEW_NIL(); | |
+ } | |
+ else { | |
+ if (nd_type($4) == NODE_RESCUE || | |
+ nd_type($4) == NODE_ENSURE) | |
+ nd_set_line($4, $<num>3); | |
+ $$ = NEW_BEGIN($4); | |
+ } | |
+ nd_set_line($$, $<num>3); | |
+ /*% | |
+ $$ = dispatch1(begin, $4); | |
+ %*/ | |
+ } | |
| tLPAREN_ARG expr {lex_state = EXPR_ENDARG;} rparen | |
{ | |
rb_warning0("(...) interpreted as grouped expression"); | |
@@ -2759,6 +2930,17 @@ | |
$$ = dispatch3(if, $2, $4, escape_Qundef($5)); | |
%*/ | |
} | |
+ | k_if expr_value ':' | |
+ compstmt_ | |
+ if_tail_ | |
+ { | |
+ /*%%%*/ | |
+ $$ = NEW_IF(cond($2), $4, $5); | |
+ fixpos($$, $2); | |
+ /*% | |
+ $$ = dispatch3(if, $2, $4, escape_Qundef($5)); | |
+ %*/ | |
+ } | |
| k_unless expr_value then | |
compstmt | |
opt_else | |
@@ -2771,29 +2953,25 @@ | |
$$ = dispatch3(unless, $2, $4, escape_Qundef($5)); | |
%*/ | |
} | |
- | k_while {COND_PUSH(1);} expr_value do {COND_POP();} | |
- compstmt | |
- k_end | |
+ | k_while {COND_PUSH(1);} expr_value {COND_POP();} ordinary_do_block | |
{ | |
/*%%%*/ | |
- $$ = NEW_WHILE(cond($3), $6, 1); | |
+ $$ = NEW_WHILE(cond($3), $5, 1); | |
fixpos($$, $3); | |
/*% | |
- $$ = dispatch2(while, $3, $6); | |
+ $$ = dispatch2(while, $3, $5); | |
%*/ | |
} | |
- | k_until {COND_PUSH(1);} expr_value do {COND_POP();} | |
- compstmt | |
- k_end | |
+ | k_until {COND_PUSH(1);} expr_value {COND_POP();} ordinary_do_block | |
{ | |
/*%%%*/ | |
- $$ = NEW_UNTIL(cond($3), $6, 1); | |
+ $$ = NEW_UNTIL(cond($3), $5, 1); | |
fixpos($$, $3); | |
/*% | |
- $$ = dispatch2(until, $3, $6); | |
+ $$ = dispatch2(until, $3, $5); | |
%*/ | |
} | |
- | k_case expr_value opt_terms | |
+ | k_case expr_value opt_terms_ | |
case_body | |
k_end | |
{ | |
@@ -2804,20 +2982,36 @@ | |
$$ = dispatch2(case, $2, $4); | |
%*/ | |
} | |
- | k_case opt_terms case_body k_end | |
+ | k_case expr_value ':' tINDENT case_body_ tDEDENT | |
{ | |
/*%%%*/ | |
+ $$ = NEW_CASE($2, $5); | |
+ fixpos($$, $2); | |
+ /*% | |
+ $$ = dispatch2(case, $2, $5); | |
+ %*/ | |
+ } | |
+ | k_case opt_terms_ case_body k_end | |
+ { | |
+ /*%%%*/ | |
$$ = NEW_CASE(0, $3); | |
/*% | |
$$ = dispatch2(case, Qnil, $3); | |
%*/ | |
} | |
+ | k_case ':' tINDENT case_body_ tDEDENT | |
+ { | |
+ /*%%%*/ | |
+ $$ = NEW_CASE(0, $4); | |
+ /*% | |
+ $$ = dispatch2(case, Qnil, $4); | |
+ %*/ | |
+ } | |
| k_for for_var keyword_in | |
{COND_PUSH(1);} | |
- expr_value do | |
+ expr_value | |
{COND_POP();} | |
- compstmt | |
- k_end | |
+ ordinary_do_block | |
{ | |
/*%%%*/ | |
/* | |
@@ -2870,12 +3064,12 @@ | |
args = new_args(m, 0, id, 0, 0); | |
} | |
} | |
- scope = NEW_NODE(NODE_SCOPE, tbl, $8, args); | |
+ scope = NEW_NODE(NODE_SCOPE, tbl, $7, args); | |
tbl[0] = 1; tbl[1] = id; | |
$$ = NEW_FOR(0, $5, scope); | |
fixpos($$, $2); | |
/*% | |
- $$ = dispatch3(for, $2, $5, $8); | |
+ $$ = dispatch3(for, $2, $5, $7); | |
%*/ | |
} | |
| k_class cpath superclass | |
@@ -2899,6 +3093,27 @@ | |
%*/ | |
local_pop(); | |
} | |
+ | k_class cpath superclass_ | |
+ { | |
+ if (in_def || in_single) | |
+ yyerror("class definition in method body"); | |
+ /*%%%*/ | |
+ local_push(0); | |
+ $<num>$ = ruby_sourceline; | |
+ /*% | |
+ %*/ | |
+ } | |
+ ':' | |
+ bodystmt_ | |
+ { | |
+ /*%%%*/ | |
+ $$ = NEW_CLASS($2, $6, $3); | |
+ nd_set_line($$, $<num>4); | |
+ local_pop(); | |
+ /*% | |
+ $$ = dispatch3(class, $2, $3, $6); | |
+ %*/ | |
+ } | |
| k_class tLSHFT expr | |
{ | |
$<num>$ = in_def; | |
@@ -2923,6 +3138,32 @@ | |
in_def = $<num>4; | |
in_single = $<num>6; | |
} | |
+ | k_class tLSHFT expr | |
+ { | |
+ $<num>$ = in_def; | |
+ in_def = 0; | |
+ } | |
+ { | |
+ $<num>$ = in_single; | |
+ in_single = 0; | |
+ /*%%%*/ | |
+ local_push(0); | |
+ /*% | |
+ %*/ | |
+ } | |
+ ':' | |
+ bodystmt_ | |
+ { | |
+ /*%%%*/ | |
+ $$ = NEW_SCLASS($3, $7); | |
+ fixpos($$, $3); | |
+ local_pop(); | |
+ /*% | |
+ $$ = dispatch2(sclass, $3, $7); | |
+ %*/ | |
+ in_def = $<num>4; | |
+ in_single = $<num>5; | |
+ } | |
| k_module cpath | |
{ | |
if (in_def || in_single) | |
@@ -2944,6 +3185,27 @@ | |
%*/ | |
local_pop(); | |
} | |
+ | k_module cpath | |
+ { | |
+ if (in_def || in_single) | |
+ yyerror("module definition in method body"); | |
+ /*%%%*/ | |
+ local_push(0); | |
+ $<num>$ = ruby_sourceline; | |
+ /*% | |
+ %*/ | |
+ } | |
+ ':' | |
+ bodystmt_ | |
+ { | |
+ /*%%%*/ | |
+ $$ = NEW_MODULE($2, $5); | |
+ nd_set_line($$, $<num>3); | |
+ local_pop(); | |
+ /*% | |
+ $$ = dispatch2(module, $2, $5); | |
+ %*/ | |
+ } | |
| k_def fname | |
{ | |
$<id>$ = cur_mid; | |
@@ -2951,17 +3213,16 @@ | |
in_def++; | |
local_push(0); | |
} | |
- f_arglist | |
- bodystmt | |
- k_end | |
+ f_arglist_and_body | |
{ | |
/*%%%*/ | |
- NODE *body = remove_begin($5); | |
+ NODE *body = remove_begin($4.second); | |
reduce_nodes(&body); | |
- $$ = NEW_DEFN($2, $4, body, NOEX_PRIVATE); | |
+ $$ = NEW_DEFN($2, $4.first, body, NOEX_PRIVATE); | |
+ fixpos($$, $4.first); | |
nd_set_line($$, $<num>1); | |
/*% | |
- $$ = dispatch3(def, $2, $4, $5); | |
+ $$ = dispatch3(def, $2, $4.first, $4.second); | |
%*/ | |
local_pop(); | |
in_def--; | |
@@ -2973,17 +3234,15 @@ | |
lex_state = EXPR_ENDFN; /* force for args */ | |
local_push(0); | |
} | |
- f_arglist | |
- bodystmt | |
- k_end | |
+ f_arglist_and_body | |
{ | |
/*%%%*/ | |
- NODE *body = remove_begin($8); | |
+ NODE *body = remove_begin($7.second); | |
reduce_nodes(&body); | |
- $$ = NEW_DEFS($2, $5, $7, body); | |
+ $$ = NEW_DEFS($2, $5, $7.first, body); | |
nd_set_line($$, $<num>1); | |
/*% | |
- $$ = dispatch5(defs, $2, $3, $5, $7, $8); | |
+ $$ = dispatch5(defs, $2, $3, $5, $7.first, $7.second); | |
%*/ | |
local_pop(); | |
in_single--; | |
@@ -3022,6 +3281,28 @@ | |
} | |
; | |
+f_arglist_and_body: f_arglist_ ':' bodystmt_ | |
+ { | |
+ /*%%%*/ | |
+ $$.first = $1; | |
+ $$.second = $3; | |
+ /*% | |
+ $$.first = $1; | |
+ $$.second = $3; | |
+ %*/ | |
+ } | |
+ | f_arglist bodystmt k_end | |
+ { | |
+ /*%%%*/ | |
+ $$.first = $1; | |
+ $$.second = $2; | |
+ /*% | |
+ $$.first = $1; | |
+ $$.second = $2; | |
+ %*/ | |
+ } | |
+ ; | |
+ | |
primary_value : primary | |
{ | |
/*%%%*/ | |
@@ -3104,6 +3385,14 @@ | |
} | |
; | |
+k_pass : keyword_pass | |
+ { | |
+#ifndef RIPPER | |
+ if (RTEST(ruby_verbose)) token_info_pop("pass"); /* POP */ | |
+#endif | |
+ } | |
+ ; | |
+ | |
then : term | |
/*%c%*/ | |
/*%c | |
@@ -3139,6 +3428,20 @@ | |
} | |
; | |
+if_tail_ : opt_else_ | |
+ | keyword_elsif expr_value ':' | |
+ compstmt_ | |
+ if_tail_ | |
+ { | |
+ /*%%%*/ | |
+ $$ = NEW_IF(cond($2), $4, $5); | |
+ fixpos($$, $2); | |
+ /*% | |
+ $$ = dispatch3(elsif, $2, $4, escape_Qundef($5)); | |
+ %*/ | |
+ } | |
+ ; | |
+ | |
opt_else : none | |
| keyword_else compstmt | |
{ | |
@@ -3150,6 +3453,17 @@ | |
} | |
; | |
+opt_else_ : none | |
+ | keyword_else ':' compstmt_ | |
+ { | |
+ /*%%%*/ | |
+ $$ = $3; | |
+ /*% | |
+ $$ = dispatch1(else, $3); | |
+ %*/ | |
+ } | |
+ ; | |
+ | |
for_var : lhs | |
| mlhs | |
; | |
@@ -3527,15 +3841,16 @@ | |
$<num>$ = ruby_sourceline; | |
/*% %*/ | |
} | |
+ discard_indent_dedent | |
opt_block_param | |
compstmt | |
keyword_end | |
{ | |
/*%%%*/ | |
- $$ = NEW_ITER($3,$4); | |
- nd_set_line($$, $<num>2); | |
+ $$ = NEW_ITER($4,$5); | |
+ nd_set_line($$, $<num>3); | |
/*% | |
- $$ = dispatch2(do_block, escape_Qundef($3), $4); | |
+ $$ = dispatch2(do_block, escape_Qundef($4), $5); | |
%*/ | |
dyna_pop($<vars>1); | |
} | |
@@ -3674,14 +3989,15 @@ | |
/*% | |
%*/ | |
} | |
+ discard_indent_dedent | |
opt_block_param | |
compstmt '}' | |
{ | |
/*%%%*/ | |
- $$ = NEW_ITER($3,$4); | |
+ $$ = NEW_ITER($4,$5); | |
nd_set_line($$, $<num>2); | |
/*% | |
- $$ = dispatch2(brace_block, escape_Qundef($3), $4); | |
+ $$ = dispatch2(brace_block, escape_Qundef($4), $5); | |
%*/ | |
dyna_pop($<vars>1); | |
} | |
@@ -3693,14 +4009,15 @@ | |
/*% | |
%*/ | |
} | |
+ discard_indent_dedent | |
opt_block_param | |
compstmt keyword_end | |
{ | |
/*%%%*/ | |
- $$ = NEW_ITER($3,$4); | |
+ $$ = NEW_ITER($4,$5); | |
nd_set_line($$, $<num>2); | |
/*% | |
- $$ = dispatch2(do_block, escape_Qundef($3), $4); | |
+ $$ = dispatch2(do_block, escape_Qundef($4), $5); | |
%*/ | |
dyna_pop($<vars>1); | |
} | |
@@ -3722,6 +4039,23 @@ | |
| case_body | |
; | |
+case_body_ : keyword_when args ':' | |
+ compstmt_ | |
+ opt_terms | |
+ cases_ | |
+ { | |
+ /*%%%*/ | |
+ $$ = NEW_WHEN($2, $4, $6); | |
+ /*% | |
+ $$ = dispatch3(when, $2, $4, escape_Qundef($6)); | |
+ %*/ | |
+ } | |
+ ; | |
+ | |
+cases_ : opt_else_ | |
+ | case_body_ | |
+ ; | |
+ | |
opt_rescue : keyword_rescue exc_list exc_var then | |
compstmt | |
opt_rescue | |
@@ -3744,6 +4078,28 @@ | |
| none | |
; | |
+opt_rescue_ : keyword_rescue exc_list exc_var ':' | |
+ compstmt_ | |
+ opt_rescue_ | |
+ { | |
+ /*%%%*/ | |
+ if ($3) { | |
+ $3 = node_assign($3, NEW_ERRINFO()); | |
+ $5 = block_append($3, $5); | |
+ } | |
+ $$ = NEW_RESBODY($2, $5, $6); | |
+ fixpos($$, $2?$2:$5); | |
+ /*% | |
+ $$ = dispatch4(rescue, | |
+ escape_Qundef($2), | |
+ escape_Qundef($3), | |
+ escape_Qundef($5), | |
+ escape_Qundef($6)); | |
+ %*/ | |
+ } | |
+ | none | |
+ ; | |
+ | |
exc_list : arg_value | |
{ | |
/*%%%*/ | |
@@ -3781,6 +4137,17 @@ | |
| none | |
; | |
+opt_ensure_ : keyword_ensure ':' compstmt_ | |
+ { | |
+ /*%%%*/ | |
+ $$ = $3; | |
+ /*% | |
+ $$ = dispatch1(ensure, $3); | |
+ %*/ | |
+ } | |
+ | none | |
+ ; | |
+ | |
literal : numeric | |
| symbol | |
{ | |
@@ -4253,35 +4620,55 @@ | |
| tBACK_REF | |
; | |
-superclass : term | |
+superclass : superclass_ term | |
+ | error term | |
{ | |
/*%%%*/ | |
+ yyerrok; | |
$$ = 0; | |
/*% | |
+ yyerrok; | |
$$ = Qnil; | |
%*/ | |
} | |
+ ; | |
+ | |
+superclass_ : | |
+ { | |
+ /*%%%*/ | |
+ $$ = 0; | |
+ /*% | |
+ $$ = Qnil; | |
+ %*/ | |
+ } | |
| '<' | |
{ | |
lex_state = EXPR_BEG; | |
} | |
- expr_value term | |
+ expr_value | |
{ | |
$$ = $3; | |
} | |
- | error term | |
+ ; | |
+ | |
+ | |
+f_arglist : '(' f_args rparen | |
{ | |
/*%%%*/ | |
- yyerrok; | |
- $$ = 0; | |
+ $$ = $2; | |
/*% | |
- yyerrok; | |
- $$ = Qnil; | |
+ $$ = dispatch1(paren, $2); | |
%*/ | |
+ lex_state = EXPR_BEG; | |
+ command_start = TRUE; | |
} | |
+ | f_args term | |
+ { | |
+ $$ = $1; | |
+ } | |
; | |
-f_arglist : '(' f_args rparen | |
+f_arglist_ : '(' f_args rparen | |
{ | |
/*%%%*/ | |
$$ = $2; | |
@@ -4291,7 +4678,7 @@ | |
lex_state = EXPR_BEG; | |
command_start = TRUE; | |
} | |
- | f_args term | |
+ | f_args | |
{ | |
$$ = $1; | |
} | |
@@ -4765,6 +5152,10 @@ | |
| terms | |
; | |
+opt_terms_ : /* none */ | |
+ | terms_ | |
+ ; | |
+ | |
opt_nl : /* none */ | |
| '\n' | |
; | |
@@ -4788,6 +5179,16 @@ | |
| terms ';' {yyerrok;} | |
; | |
+term_ : ';' {yyerrok;} | |
+ | indents | |
+ | dedents | |
+ | '\n' | |
+ ; | |
+ | |
+terms_ : term_ | |
+ | terms_ term_ {yyerrok;} | |
+ ; | |
+ | |
none : /* none */ | |
{ | |
/*%%%*/ | |
@@ -4797,6 +5198,38 @@ | |
%*/ | |
} | |
; | |
+ | |
+indents : tINDENT | |
+ | indents tINDENT | |
+ ; | |
+ | |
+dedents : tDEDENT | |
+ | dedents tDEDENT | |
+ ; | |
+ | |
+discard_indent_dedent: /* none */ | |
+ | indents | |
+ | dedents '\n' | |
+ ; | |
+ | |
+ordinary_do_block: do compstmt k_end | |
+ { | |
+ /*%%%*/ | |
+ $$ = $2; | |
+ /*% | |
+ $$ = $2; | |
+ %*/ | |
+ } | |
+ | ':' compstmt_ | |
+ { | |
+ /*%%%*/ | |
+ $$ = $2; | |
+ /*% | |
+ $$ = $2; | |
+ %*/ | |
+ } | |
+ ; | |
+ | |
%% | |
# undef parser | |
# undef yylex | |
@@ -4810,6 +5243,7 @@ | |
static int parser_here_document(struct parser_params*,NODE*); | |
+// # define nextc() parser_nextc(parser) | |
# define nextc() parser_nextc(parser) | |
# define pushback(c) parser_pushback(parser, c) | |
# define newtok() parser_newtok(parser) | |
@@ -5927,6 +6361,7 @@ | |
pushback(c); | |
return tSTRING_DVAR; | |
case '{': | |
+ brace_nest++; | |
return tSTRING_DBEG; | |
} | |
tokadd('#'); | |
@@ -6490,6 +6925,7 @@ | |
enum lex_state_e last_state; | |
rb_encoding *enc; | |
int mb; | |
+ int blankline = 0; | |
#ifdef RIPPER | |
int fallthru = FALSE; | |
#endif | |
@@ -6516,7 +6952,103 @@ | |
cmd_state = command_start; | |
command_start = FALSE; | |
retry: | |
- last_state = lex_state; | |
+ blankline = 0; | |
+ if (parser->atbol) { | |
+ register int col = 0; | |
+ register int altcol = 0; | |
+ parser->atbol = 0; | |
+ for (;;) { | |
+ c = nextc(); | |
+ if (c == ' ') | |
+ col++, altcol++; | |
+ else if (c == '\t') { | |
+ col = (col/parser->tabsize + 1) * parser->tabsize; | |
+ altcol = (altcol/parser->alttabsize + 1) | |
+ * parser->alttabsize; | |
+ } | |
+ else if (c == '\014') /* Control-L (formfeed) */ | |
+ col = altcol = 0; /* For Emacs users */ | |
+ else | |
+ break; | |
+ } | |
+ pushback(c); | |
+ if (c == '#' || c == '\n') { | |
+ /* Lines with only whitespace and/or comments | |
+ shouldn't affect the indentation and are | |
+ not passed to the parser as NEWLINE tokens, | |
+ except *totally* empty lines in interactive | |
+ mode, which signal the end of a command group. */ | |
+ if (col == 0 && c == '\n' && 0/* && parser->interactive */) | |
+ blankline = 0; /* Let it through */ | |
+ else | |
+ blankline = 1; /* Ignore completely */ | |
+ /* We can't jump back right here since we still | |
+ may need to skip to the end of a comment */ | |
+ } | |
+ if (!blankline && (paren_nest + brace_nest) == 0) { | |
+ if (col == parser->indstack[parser->indent]) { | |
+ /* No change */ | |
+ if (altcol != parser->altindstack[parser->indent]) { | |
+ rb_compile_warning(ruby_sourcefile, ruby_sourceline, | |
+ "%s: inconsistent use of tabs and spaces " | |
+ "in indentation", parser->parser_ruby_sourcefile); | |
+ } | |
+ } | |
+ else if (col > parser->indstack[parser->indent]) { | |
+ /* Indent -- always one */ | |
+ if (parser->indent+1 >= MAXINDENT) { | |
+ compile_error(PARSER_ARG "too many levels of indentation"); | |
+ } | |
+ if (altcol <= parser->altindstack[parser->indent]) { | |
+ rb_compile_warning(ruby_sourcefile, ruby_sourceline, | |
+ "%s: inconsistent use of tabs and spaces " | |
+ "in indentation", parser->parser_ruby_sourcefile); | |
+ } | |
+ parser->pendin++; | |
+ parser->indstack[++parser->indent] = col; | |
+ parser->altindstack[parser->indent] = altcol; | |
+ } | |
+ else /* col < parser->indstack[parser->indent] */ { | |
+ /* Dedent -- any number, must be consistent */ | |
+ while (parser->indent > 0 && | |
+ col < parser->indstack[parser->indent]) { | |
+ parser->pendin--; | |
+ parser->indent--; | |
+ } | |
+ parser->emit_dummy_lf = TRUE; | |
+ if (col != parser->indstack[parser->indent]) { | |
+ rb_compile_warning(ruby_sourcefile, ruby_sourceline, | |
+ "unindent does not match any outer indentation level"); | |
+ } | |
+ if (altcol != parser->altindstack[parser->indent]) { | |
+ rb_compile_warning(ruby_sourcefile, ruby_sourceline, | |
+ "%s: inconsistent use of tabs and spaces " | |
+ "in indentation", parser->parser_ruby_sourcefile); | |
+ } | |
+ } | |
+ } | |
+ } | |
+ | |
+ /* Return pending indents/dedents */ | |
+ if (parser->pendin != 0) { | |
+ command_start = cmd_state; | |
+ if (parser->pendin < 0) { | |
+ parser->pendin++; | |
+ return tDEDENT; | |
+ } | |
+ else { | |
+ parser->pendin--; | |
+ return tINDENT; | |
+ } | |
+ } | |
+ else { | |
+ if (parser->emit_dummy_lf) { | |
+ parser->emit_dummy_lf = FALSE; | |
+ return '\n'; | |
+ } | |
+ } | |
+ | |
+ last_state = lex_state; /* XXX */ | |
switch (c = nextc()) { | |
case '\0': /* NUL */ | |
case '\004': /* ^D */ | |
@@ -6558,6 +7090,7 @@ | |
#endif | |
/* fall through */ | |
case '\n': | |
+ parser->atbol = 1; | |
switch (lex_state) { | |
case EXPR_BEG: | |
case EXPR_FNAME: | |
@@ -6574,6 +7107,7 @@ | |
default: | |
break; | |
} | |
+#if 0 | |
while ((c = nextc())) { | |
switch (c) { | |
case ' ': case '\t': case '\f': case '\r': | |
@@ -6600,6 +7134,7 @@ | |
goto normal_newline; | |
} | |
} | |
+#endif | |
normal_newline: | |
command_start = TRUE; | |
lex_state = EXPR_BEG; | |
@@ -7240,7 +7775,16 @@ | |
case ')': | |
case ']': | |
paren_nest--; | |
+ COND_LEXPOP(); | |
+ CMDARG_LEXPOP(); | |
+ if (c == ')') | |
+ lex_state = EXPR_ENDFN; | |
+ else | |
+ lex_state = EXPR_ENDARG; | |
+ return c; | |
+ | |
case '}': | |
+ brace_nest--; | |
COND_LEXPOP(); | |
CMDARG_LEXPOP(); | |
if (c == ')') | |
@@ -7268,15 +7812,21 @@ | |
switch (c) { | |
case '\'': | |
lex_strterm = NEW_STRTERM(str_ssym, c, 0); | |
+ lex_state = EXPR_FNAME; | |
break; | |
case '"': | |
lex_strterm = NEW_STRTERM(str_dsym, c, 0); | |
+ lex_state = EXPR_FNAME; | |
break; | |
+ case '\n': | |
+ case ' ': case '\t': case '\f': case '\r': case '\13': | |
+ pushback(c); | |
+ return ':'; | |
default: | |
+ lex_state = EXPR_FNAME; | |
pushback(c); | |
break; | |
} | |
- lex_state = EXPR_FNAME; | |
return tSYMBEG; | |
case '/': | |
@@ -7379,6 +7929,7 @@ | |
return c; | |
case '{': | |
+ brace_nest++; | |
if (lpar_beg && lpar_beg == paren_nest) { | |
lex_state = EXPR_BEG; | |
lpar_beg = 0; | |
@@ -7717,11 +8268,13 @@ | |
} | |
if (kw->id[0] == keyword_do) { | |
command_start = TRUE; | |
+/* | |
if (lpar_beg && lpar_beg == paren_nest) { | |
lpar_beg = 0; | |
--paren_nest; | |
return keyword_do_LAMBDA; | |
} | |
+*/ | |
if (COND_P()) return keyword_do_cond; | |
if (CMDARG_P() && state != EXPR_CMDARG) | |
return keyword_do_block; | |
@@ -9916,6 +10469,7 @@ | |
parser->parser_cmdarg_stack = 0; | |
parser->parser_class_nest = 0; | |
parser->parser_paren_nest = 0; | |
+ parser->parser_brace_nest = 0; | |
parser->parser_lpar_beg = 0; | |
parser->parser_in_single = 0; | |
parser->parser_in_def = 0; | |
@@ -9951,6 +10505,16 @@ | |
parser->heap = NULL; | |
#endif | |
parser->enc = rb_usascii_encoding(); | |
+ | |
+ parser->tabsize = TABSIZE; | |
+ parser->indent = 0; | |
+ parser->indstack[0] = 0; | |
+ parser->atbol = 1; | |
+ parser->pendin = 0; | |
+ parser->alttabsize = 1; | |
+ parser->altindstack[0] = 0; | |
+ parser->emit_dummy_lf = FALSE; | |
+ // parser->parser_yydebug = 1; | |
} | |
#ifdef RIPPER | |
@@ -10333,6 +10897,7 @@ | |
{keyword__LINE__, "__LINE__"}, | |
{keyword__FILE__, "__FILE__"}, | |
{keyword__ENCODING__, "__ENCODING__"}, | |
+ {keyword_pass, "pass"}, | |
{0, NULL} | |
}; | |
@@ -10678,3 +11243,6 @@ | |
rb_intern("&&"); | |
} | |
#endif /* RIPPER */ | |
+/* | |
+ * vim: sts=4 sw=4 ts=8 noet | |
+ */ | |
Index: ext/digest/md5/extconf.rb | |
=================================================================== | |
--- ext/digest/md5/extconf.rb (revision 28816) | |
+++ ext/digest/md5/extconf.rb (working copy) | |
@@ -10,8 +10,8 @@ | |
dir_config("openssl") | |
-if !with_config("bundled-md5") && | |
- have_library("crypto") && have_header("openssl/md5.h") | |
+if (!with_config("bundled-md5") && | |
+ have_library("crypto") && have_header("openssl/md5.h")) | |
$objs << "md5ossl.#{$OBJEXT}" | |
else | |
Index: ext/digest/rmd160/extconf.rb | |
=================================================================== | |
--- ext/digest/rmd160/extconf.rb (revision 28816) | |
+++ ext/digest/rmd160/extconf.rb (working copy) | |
@@ -10,8 +10,8 @@ | |
dir_config("openssl") | |
-if !with_config("bundled-rmd160") && | |
- have_library("crypto") && have_header("openssl/ripemd.h") | |
+if (!with_config("bundled-rmd160") && | |
+ have_library("crypto") && have_header("openssl/ripemd.h")) | |
$objs << "rmd160ossl.#{$OBJEXT}" | |
else | |
$objs << "rmd160.#{$OBJEXT}" | |
Index: ext/digest/sha1/extconf.rb | |
=================================================================== | |
--- ext/digest/sha1/extconf.rb (revision 28816) | |
+++ ext/digest/sha1/extconf.rb (working copy) | |
@@ -10,8 +10,8 @@ | |
dir_config("openssl") | |
-if !with_config("bundled-sha1") && | |
- have_library("crypto") && have_header("openssl/sha.h") | |
+if (!with_config("bundled-sha1") && | |
+ have_library("crypto") && have_header("openssl/sha.h")) | |
$objs << "sha1ossl.#{$OBJEXT}" | |
else | |
$objs << "sha1.#{$OBJEXT}" | |
Index: ext/digest/sha2/extconf.rb | |
=================================================================== | |
--- ext/digest/sha2/extconf.rb (revision 28816) | |
+++ ext/digest/sha2/extconf.rb (working copy) | |
@@ -10,10 +10,10 @@ | |
dir_config("openssl") | |
-if !with_config("bundled-sha2") && | |
+if (!with_config("bundled-sha2") && | |
have_library("crypto") && | |
%w[SHA256 SHA512].all? {|d| have_func("#{d}_Transform", "openssl/sha.h")} && | |
- %w[SHA256 SHA512].all? {|d| have_type("#{d}_CTX", "openssl/sha.h")} | |
+ %w[SHA256 SHA512].all? {|d| have_type("#{d}_CTX", "openssl/sha.h")}) | |
$objs << "sha2ossl.#{$OBJEXT}" | |
$defs << "-DSHA2_USE_OPENSSL" | |
else | |
Index: ext/syslog/extconf.rb | |
=================================================================== | |
--- ext/syslog/extconf.rb (revision 28816) | |
+++ ext/syslog/extconf.rb (working copy) | |
@@ -3,8 +3,5 @@ | |
require 'mkmf' | |
-have_header("syslog.h") && | |
- have_func("openlog") && | |
- have_func("setlogmask") && | |
- create_makefile("syslog") | |
+have_header("syslog.h") && have_func("openlog") && have_func("setlogmask") && create_makefile("syslog") | |
Index: ext/zlib/extconf.rb | |
=================================================================== | |
--- ext/zlib/extconf.rb (revision 28816) | |
+++ ext/zlib/extconf.rb (working copy) | |
@@ -10,14 +10,13 @@ | |
dir_config 'zlib' | |
-if %w'z libz zlib1 zlib zdll'.find {|z| have_library(z, 'deflateReset')} and | |
- have_header('zlib.h') then | |
+if (%w'z libz zlib1 zlib zdll'.find {|z| have_library(z, 'deflateReset')} and | |
+ have_header('zlib.h')) then | |
defines = [] | |
message 'checking for kind of operating system... ' | |
- os_code = with_config('os-code') || | |
- case RUBY_PLATFORM.split('-',2)[1] | |
+ os_code = with_config('os-code') || case RUBY_PLATFORM.split('-',2)[1] | |
when 'amigaos' then | |
os_code = 'AMIGA' | |
when /\Aos2[\-_]emx\z/ then | |
Index: ext/win32ole/extconf.rb | |
=================================================================== | |
--- ext/win32ole/extconf.rb (revision 28816) | |
+++ ext/win32ole/extconf.rb (working copy) | |
@@ -17,13 +17,13 @@ | |
end | |
def create_win32ole_makefile | |
- if have_library("ole32") and | |
+ if (have_library("ole32") and | |
have_library("oleaut32") and | |
have_library("uuid") and | |
have_library("user32") and | |
have_library("kernel32") and | |
have_library("advapi32") and | |
- have_header("windows.h") | |
+ have_header("windows.h")) | |
unless have_type("IMultiLanguage2", "mlang.h") | |
have_type("IMultiLanguage", "mlang.h") | |
end | |
Index: ext/pty/extconf.rb | |
=================================================================== | |
--- ext/pty/extconf.rb (revision 28816) | |
+++ ext/pty/extconf.rb (working copy) | |
@@ -7,11 +7,11 @@ | |
have_header("util.h") # OpenBSD openpty | |
have_header("pty.h") | |
have_library("util", "openpty") | |
- if have_func("posix_openpt") or | |
+ if (have_func("posix_openpt") or | |
have_func("openpty") or | |
have_func("_getpty") or | |
have_func("ptsname") or | |
- have_func("ioctl") | |
+ have_func("ioctl")) | |
create_makefile('pty') | |
end | |
end | |
Index: ext/tk/extconf.rb | |
=================================================================== | |
--- ext/tk/extconf.rb (revision 28816) | |
+++ ext/tk/extconf.rb (working copy) | |
@@ -5,10 +5,11 @@ | |
require 'mkmf' | |
TkLib_Config = {} | |
-TkLib_Config['search_versions'] = | |
+TkLib_Config['search_versions'] =( | |
# %w[8.9 8.8 8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0 7.6 4.2] | |
# %w[8.7 8.6 8.5 8.4 8.3 8.2 8.1 8.0] | |
%w[8.7 8.6 8.5 8.4 8.0] # to shorten search steps | |
+ ) | |
############################################################## | |
@@ -26,8 +27,8 @@ | |
$cleanfiles << 'config_list' | |
config_list_file = 'config_list' | |
config_list_file_source = File.join(File.dirname(__FILE__),'config_list.in') | |
-if !File.exist?(config_list_file) || | |
- File.ctime(config_list_file_source) > File.ctime(config_list_file) | |
+if (!File.exist?(config_list_file) || | |
+ File.ctime(config_list_file_source) > File.ctime(config_list_file)) | |
old_config_list_file = config_list_file_source | |
else | |
old_config_list_file = config_list_file | |
@@ -92,8 +93,8 @@ | |
else | |
makefile = 'Makefile' | |
- if File.exist?(makefile) && | |
- File.ctime(config_list_file) > File.ctime(makefile) | |
+ if (File.exist?(makefile) && | |
+ File.ctime(config_list_file) > File.ctime(makefile)) | |
# no need to update Makefile | |
exit | |
end | |
@@ -268,8 +269,8 @@ | |
end | |
# framework is disabled? | |
- if with_config("tcltk-framework") == false || | |
- enable_config("tcltk-framework") == false | |
+ if (with_config("tcltk-framework") == false || | |
+ enable_config("tcltk-framework") == false) | |
return false | |
end | |
@@ -280,8 +281,8 @@ | |
File.join(TkLib_Config["tcltk-framework"], 'Tk.framework')] | |
end | |
- unless enable_config("tcltk-framework", use_framework) || | |
- enable_config("mac-tcltk-framework", use_framework) | |
+ unless (enable_config("tcltk-framework", use_framework) || | |
+ enable_config("mac-tcltk-framework", use_framework)) | |
TkLib_Config["tcltk-framework"] = false | |
return false | |
end | |
@@ -702,8 +703,8 @@ | |
end | |
def get_tclConfig(tclConfig_file, tkConfig_file, tclConfig_dir, tkConfig_dir) | |
- use_tclConfig = (tclConfig_file != false) && (tkConfig_file != false) && | |
- (tclConfig_dir != false) && (tkConfig_dir != false) | |
+ use_tclConfig = ((tclConfig_file != false) && (tkConfig_file != false) && | |
+ (tclConfig_dir != false) && (tkConfig_dir != false)) | |
unless use_tclConfig | |
puts("Don't use [tclConfig.sh, tkConfig.sh]") | |
@@ -739,9 +740,9 @@ | |
print("Search tclConfig.sh", (tclConfig_dir)? " (in #{tclConfig_dir})": "", | |
" and tkConfig.sh", (tkConfig_dir)? " (in #{tkConfig_dir})": "", ".") | |
if tclConfig_dir | |
- tclConfig, tkConfig = | |
+ tclConfig, tkConfig = ( | |
search_tclConfig([ ((tclConfig_file)? tclConfig_file: tclConfig_dir), | |
- ((tkConfig_file)? tkConfig_file: tkConfig_dir) ]) | |
+ ((tkConfig_file)? tkConfig_file: tkConfig_dir) ])) | |
else | |
tclConfig, tkConfig = search_tclConfig() | |
end | |
@@ -896,8 +897,8 @@ | |
$LIBPATH |= [$2] unless $2.empty? | |
if stubs | |
- if TclConfig_Info['TCL_SUPPORTS_STUBS'] == '0' || | |
- TclConfig_Info['TCL_STUB_LIB_SPEC'].strip.empty? | |
+ if (TclConfig_Info['TCL_SUPPORTS_STUBS'] == '0' || | |
+ TclConfig_Info['TCL_STUB_LIB_SPEC'].strip.empty?) | |
print(".\n") # progress | |
puts "#{TclConfig_Info['config_file_path']} tells us that your Tcl/Tk library doesn't support stub." | |
return false | |
@@ -1094,8 +1095,8 @@ | |
base_dir.delete_if{|path| path =~ / /} | |
end | |
- if TclConfig_Info['TCL_INCLUDE_SPEC'] && | |
- have_tcl_h = try_cpp('#include <tcl.h>', TclConfig_Info['TCL_INCLUDE_SPEC']) | |
+ if (TclConfig_Info['TCL_INCLUDE_SPEC'] && | |
+ have_tcl_h = try_cpp('#include <tcl.h>', TclConfig_Info['TCL_INCLUDE_SPEC'])) | |
$INCFLAGS << " " << TclConfig_Info['TCL_INCLUDE_SPEC'] | |
elsif have_tcl_h = have_header('tcl.h') | |
# find | |
@@ -1114,8 +1115,8 @@ | |
have_tcl_h = find_header('tcl.h', *paths) | |
end | |
- if TkConfig_Info['TK_INCLUDE_SPEC'] && | |
- have_tk_h = try_cpp('#include <tk.h>', TkConfig_Info['TK_INCLUDE_SPEC']) | |
+ if (TkConfig_Info['TK_INCLUDE_SPEC'] && | |
+ have_tk_h = try_cpp('#include <tk.h>', TkConfig_Info['TK_INCLUDE_SPEC'])) | |
$INCFLAGS << " " << TkConfig_Info['TK_INCLUDE_SPEC'] | |
elsif have_tk_h = have_header('tk.h') | |
# find | |
@@ -1144,15 +1145,13 @@ | |
end | |
if TkLib_Config["tcl-framework-header"] | |
- TclConfig_Info['TCL_INCLUDE_SPEC'] << | |
- "-I#{TkLib_Config["tcl-framework-header"].quote} " | |
+ TclConfig_Info['TCL_INCLUDE_SPEC'] << "-I#{TkLib_Config["tcl-framework-header"].quote} " | |
else | |
TclConfig_Info['TCL_INCLUDE_SPEC'] = "" | |
tcl_base = File.join(TkLib_Config["tcltk-framework"], 'Tcl.framework') | |
if tclver | |
- TclConfig_Info['TCL_INCLUDE_SPEC'] << | |
- "-I#{File.join(tcl_base, 'Versions', tclver, 'Headers').quote} " | |
+ TclConfig_Info['TCL_INCLUDE_SPEC'] << "-I#{File.join(tcl_base, 'Versions', tclver, 'Headers').quote} " | |
end | |
TclConfig_Info['TCL_INCLUDE_SPEC'] << File.join(tcl_base, 'Headers') | |
@@ -1165,15 +1164,13 @@ | |
end | |
if TkLib_Config["tk-framework-header"] | |
- TkConfig_Info['TK_INCLUDE_SPEC'] = | |
- "-I#{TkLib_Config["tk-framework-header"].quote} " | |
+ TkConfig_Info['TK_INCLUDE_SPEC'] = "-I#{TkLib_Config["tk-framework-header"].quote} " | |
else | |
TkConfig_Info['TK_INCLUDE_SPEC'] = "" | |
tk_base = File.join(TkLib_Config["tcltk-framework"], 'Tk.framework') | |
if tkver | |
- TkConfig_Info['TK_INCLUDE_SPEC'] << | |
- "-I#{File.join(tk_base, 'Versions', tkver, 'Headers').quote} " | |
+ TkConfig_Info['TK_INCLUDE_SPEC'] << "-I#{File.join(tk_base, 'Versions', tkver, 'Headers').quote} " | |
end | |
TkConfig_Info['TK_INCLUDE_SPEC'] << File.join(tk_base, 'Headers') | |
@@ -1187,8 +1184,7 @@ | |
end | |
def find_X11(*opt_paths) | |
- defaults = | |
- [ "/usr/X11*/lib", "/usr/lib/X11*", "/usr/local/X11*", "/usr/openwin/lib" ] | |
+ defaults = [ "/usr/X11*/lib", "/usr/lib/X11*", "/usr/local/X11*", "/usr/openwin/lib" ] | |
paths = [] | |
opt_paths.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNM_CASEFOLD))} | |
defaults.compact.each{|path| paths.concat(Dir.glob(path.strip.chomp('/'), File::FNM_CASEFOLD))} | |
@@ -1202,9 +1198,9 @@ | |
def search_X_libraries | |
if TkConfig_Info['config_file_path'] | |
# use definitions on tkConfig.sh | |
- if TkConfig_Info['TK_XINCLUDES'] && TkConfig_Info['TK_XLIBSW'] && | |
+ if (TkConfig_Info['TK_XINCLUDES'] && TkConfig_Info['TK_XLIBSW'] && | |
!TkConfig_Info['TK_XINCLUDES'].strip.empty? && | |
- !TkConfig_Info['TK_XLIBSW'].strip.empty? | |
+ !TkConfig_Info['TK_XLIBSW'].strip.empty?) | |
#use_X = true && with_config("X11", ! is_win32?) | |
use_X = with_config("X11", true) | |
else | |
@@ -1226,8 +1222,8 @@ | |
end | |
end | |
- if TkConfig_Info['TK_XINCLUDES'] && | |
- !TkConfig_Info['TK_XINCLUDES'].strip.empty? | |
+ if (TkConfig_Info['TK_XINCLUDES'] && | |
+ !TkConfig_Info['TK_XINCLUDES'].strip.empty?) | |
$INCFLAGS << " " << TkConfig_Info['TK_XINCLUDES'].strip | |
end | |
@@ -1434,15 +1430,13 @@ | |
$CPPFLAGS += ' -D_WIN32' if /cygwin/ =~ RUBY_PLATFORM | |
# Does ruby have nativethread ? | |
-TkLib_Config["ruby_with_thread"] = | |
- macro_defined?('HAVE_NATIVETHREAD', '#include "ruby.h"') | |
+TkLib_Config["ruby_with_thread"] = macro_defined?('HAVE_NATIVETHREAD', '#include "ruby.h"') | |
#--------------------------------------------------- | |
# check requirement of Tcl/tk version | |
tcltk_version = with_config("tcltkversion") | |
-tclver, tkver = | |
- TkLib_Config["tcltkversion"] = check_tcltk_version(tcltk_version) | |
+tclver, tkver = TkLib_Config["tcltkversion"] = check_tcltk_version(tcltk_version) | |
puts("Specified Tcl/Tk version is #{[tclver, tkver].inspect}") if tclver&&tkver | |
# use ActiveTcl ? | |
@@ -1464,8 +1458,7 @@ | |
TkLib_Config["ActiveTcl"] = activeTcl | |
# allow space chars on a libpath | |
-TkLib_Config["space-on-tk-libpath"] = | |
- enable_config("space-on-tk-libpath", ! is_win32?) | |
+TkLib_Config["space-on-tk-libpath"] = enable_config("space-on-tk-libpath", ! is_win32?) | |
# enable Tcl/Tk stubs? | |
=begin | |
@@ -1560,11 +1553,11 @@ | |
#--------------------------------------------------- | |
-if (TkLib_Config["tcltk-framework"] || | |
+if ((TkLib_Config["tcltk-framework"] || | |
( find_tcltk_header(tclver, tkver) && | |
find_tcltk_library(tcllib, tklib, stubs, tclver, tkver, | |
tcl_ldir_list, tk_ldir_list) ) ) && | |
- (stubs || pthread_check()) | |
+ (stubs || pthread_check())) | |
# create Makefile | |
# for SUPPORT_STATUS | |
Index: ext/readline/extconf.rb | |
=================================================================== | |
--- ext/readline/extconf.rb (revision 28816) | |
+++ ext/readline/extconf.rb (working copy) | |
@@ -31,23 +31,21 @@ | |
EOS | |
have_library("user32", nil) if /cygwin/ === RUBY_PLATFORM | |
-have_library("ncurses", "tgetnum") || | |
- have_library("termcap", "tgetnum") || | |
- have_library("curses", "tgetnum") | |
+have_library("ncurses", "tgetnum") || have_library("termcap", "tgetnum") || have_library("curses", "tgetnum") | |
if enable_libedit | |
- unless (have_readline_header("editline/readline.h") || | |
+ unless ((have_readline_header("editline/readline.h") || | |
have_readline_header("readline/readline.h")) && | |
- have_library("edit", "readline") | |
+ have_library("edit", "readline")) | |
exit | |
end | |
else | |
- unless ((have_readline_header("readline/readline.h") && | |
+ unless (((have_readline_header("readline/readline.h") && | |
have_readline_header("readline/history.h")) && | |
(have_library("readline", "readline") || | |
have_library("edit", "readline"))) || | |
(have_readline_header("editline/readline.h") && | |
- have_library("edit", "readline")) | |
+ have_library("edit", "readline"))) | |
exit | |
end | |
end | |
Index: ext/socket/extconf.rb | |
=================================================================== | |
--- ext/socket/extconf.rb (revision 28816) | |
+++ ext/socket/extconf.rb (working copy) | |
@@ -78,8 +78,7 @@ | |
--with-ipv6-lib and --with-ipv6-libdir option will be obsolete, use | |
--with-inet6lib and --with-inet6-{include,lib} options instead. | |
EOS | |
- find_library(ipv6lib, nil, with_config("ipv6-libdir", ldirs)) and | |
- ipv6lib | |
+ find_library(ipv6lib, nil, with_config("ipv6-libdir", ldirs)) and ipv6lib | |
elsif have_library("inet6") | |
"inet6" | |
end | |
Index: ext/dbm/extconf.rb | |
=================================================================== | |
--- ext/dbm/extconf.rb (revision 28816) | |
+++ ext/dbm/extconf.rb (working copy) | |
@@ -38,9 +38,7 @@ | |
end | |
db_prefix ||= "" | |
- if (have_library(db, db_prefix+"dbm_open") || have_func(db_prefix+"dbm_open")) and | |
- hdr = self.fetch(db, ["ndbm.h"]).find {|h| have_type("DBM", h, hsearch)} or | |
- hdr = self.fetch(db, ["ndbm.h"]).find {|h| have_type("DBM", ["db.h", h], hsearch)} | |
+ if (have_library(db, db_prefix+"dbm_open") || have_func(db_prefix+"dbm_open")) and hdr = self.fetch(db, ["ndbm.h"]).find {|h| have_type("DBM", h, hsearch)} or hdr = self.fetch(db, ["ndbm.h"]).find {|h| have_type("DBM", ["db.h", h], hsearch)} | |
have_func(db_prefix+"dbm_clearerr") unless have_gdbm | |
$defs << hsearch if hsearch | |
$defs << '-DDBM_HDR="<'+hdr+'>"' | |
Index: ext/io/nonblock/extconf.rb | |
=================================================================== | |
--- ext/io/nonblock/extconf.rb (revision 28816) | |
+++ ext/io/nonblock/extconf.rb (working copy) | |
@@ -2,7 +2,6 @@ | |
target = "io/nonblock" | |
hdr = %w"fcntl.h" | |
-if have_macro("O_NONBLOCK", hdr) and | |
- (have_macro("F_GETFL", hdr) or have_macro("F_SETFL", hdr)) | |
+if have_macro("O_NONBLOCK", hdr) and (have_macro("F_GETFL", hdr) or have_macro("F_SETFL", hdr)) | |
create_makefile(target) | |
end | |
Index: ext/gdbm/extconf.rb | |
=================================================================== | |
--- ext/gdbm/extconf.rb (revision 28816) | |
+++ ext/gdbm/extconf.rb (working copy) | |
@@ -1,7 +1,6 @@ | |
require 'mkmf' | |
dir_config("gdbm") | |
-if have_library("gdbm", "gdbm_open") and | |
- have_header("gdbm.h") | |
+if have_library("gdbm", "gdbm_open") and have_header("gdbm.h") | |
create_makefile("gdbm") | |
end | |
Index: ext/iconv/extconf.rb | |
=================================================================== | |
--- ext/iconv/extconf.rb (revision 28816) | |
+++ ext/iconv/extconf.rb (working copy) | |
@@ -5,8 +5,7 @@ | |
conf = File.exist?(File.join($srcdir, "config.charset")) | |
conf = with_config("config-charset", enable_config("config-charset", conf)) | |
-if have_func("iconv", "iconv.h") or | |
- have_library("iconv", "iconv", "iconv.h") | |
+if have_func("iconv", "iconv.h") or have_library("iconv", "iconv", "iconv.h") | |
check_signedness("size_t") | |
if checking_for("const of iconv() 2nd argument") do | |
create_tmpsrc(cpp_include("iconv.h") + "---> iconv(cd,0,0,0,0) <---") | |
Index: tool/mkconfig.rb | |
=================================================================== | |
--- tool/mkconfig.rb (revision 28816) | |
+++ tool/mkconfig.rb (working copy) | |
@@ -29,8 +29,7 @@ | |
# changes made to this file will be lost the next time ruby is built. | |
module RbConfig | |
- RUBY_VERSION == "#{version}" or | |
- raise "ruby lib version (#{version}) doesn't match executable version (\#{RUBY_VERSION})" | |
+ RUBY_VERSION == "#{version}" or raise "ruby lib version (#{version}) doesn't match executable version (\#{RUBY_VERSION})" | |
] | |
Index: template/encdb.h.tmpl | |
=================================================================== | |
--- template/encdb.h.tmpl (revision 28816) | |
+++ template/encdb.h.tmpl (working copy) | |
@@ -12,8 +12,7 @@ | |
def check_duplication(defs, name, fn, line) | |
if defs[name] | |
- raise ArgumentError, "%s:%d: encoding %s is already registered(%s:%d)" % | |
- [fn, line, name, *defs[name]] | |
+ raise ArgumentError, "%s:%d: encoding %s is already registered(%s:%d)" % [fn, line, name, *defs[name]] | |
else | |
defs[name.upcase] = [fn,line] | |
end | |
@@ -54,13 +53,11 @@ | |
line = nil | |
when /^ENC_REPLICATE\(\s*"([^"]+)"\s*,\s*"([^"]+)"/ | |
raise ArgumentError, | |
- '%s:%d: ENC_REPLICATE: %s is not defined yet. (replica %s)' % | |
- [fn, $., $2, $1] unless defs[$2.upcase] | |
+ '%s:%d: ENC_REPLICATE: %s is not defined yet. (replica %s)' % [fn, $., $2, $1] unless defs[$2.upcase] | |
count += 1 | |
when /^ENC_ALIAS\(\s*"([^"]+)"\s*,\s*"([^"]+)"/ | |
raise ArgumentError, | |
- '%s:%d: ENC_ALIAS: %s is not defined yet. (alias %s)' % | |
- [fn, $., $2, $1] unless defs[$2.upcase] | |
+ '%s:%d: ENC_ALIAS: %s is not defined yet. (alias %s)' % [fn, $., $2, $1] unless defs[$2.upcase] | |
when /^ENC_DUMMY\(\s*"([^"]+)"/ | |
count += 1 | |
else |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment