summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-07-25 06:03:50 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-07-25 06:03:50 +0000
commit2f7ff9d1b8a75f2f791eb2cea4883d0d1da93df4 (patch)
treecf00f5457030456f4faf290ce99296812c205cb1
parentb9373b7aeaf51441cd36334635022bd4f9523a4b (diff)
matz - irb (PR#46)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/irb/ruby-lex.rb13
-rw-r--r--string.c2
3 files changed, 15 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index f8f7c163ce..1c27c07fb3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,11 @@ Mon Jul 24 18:52:55 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* ruby.c (rubylib_mangle): support "/hoge;/foo"
+Mon Jul 24 10:28:55 2000 GOTO Kentaro <gotoken@math.sci.hokudai.ac.jp>
+
+ * string.c (rb_str_count): raise exception if no argument is
+ given.
+
Sun Jul 23 12:55:04 2000 Dave Thomas <Dave@Thomases.com>
* string.c (rb_str_rindex): Support negative end position.
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index a788b779b4..4c7a3b1002 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -368,8 +368,8 @@ class RubyLex
if @lex_state != EXPR_END && @lex_state != EXPR_CLASS &&
(@lex_state != EXPR_ARG || @space_seen)
c = peek(0)
- if /\S/ =~ c && (/["'`]/ =~ c || /[\w_]/ =~ c)
- tk = identify_here_document;
+ if /\S/ =~ c && (/["'`]/ =~ c || /[\w_]/ =~ c || c == "-")
+ tk = identify_here_document
end
else
tk = Token(op)
@@ -752,7 +752,12 @@ class RubyLex
def identify_here_document
ch = getc
- if lt = PERCENT_LTYPE[ch]
+ if ch == "-"
+ ch = getc
+ indent = true
+ end
+ if /['"`]/ =~ ch
+ lt = ch
quoted = ""
while (c = getc) && c != lt
quoted.concat c
@@ -778,7 +783,7 @@ class RubyLex
end
@here_header = false
- while (l = gets.chomp) && l != quoted
+ while (l = gets.chomp) && (indent ? l.strip : l) != quoted
end
@here_header = true
diff --git a/string.c b/string.c
index 678b1b8802..71f0c0681e 100644
--- a/string.c
+++ b/string.c
@@ -2081,7 +2081,7 @@ rb_str_count(argc, argv, str)
int init = 1;
int i;
- if (argc < 0) {
+ if (argc < 1) {
rb_raise(rb_eArgError, "wrong # of arguments");
}
for (i=0; i<argc; i++) {