diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-07-25 06:03:50 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-07-25 06:03:50 +0000 |
| commit | d2ba5ac4a8f3c1183118d6d897abd8d4f1611afe (patch) | |
| tree | cf00f5457030456f4faf290ce99296812c205cb1 /lib/irb/ruby-lex.rb | |
| parent | 6854da447508380d0154ef8ba81d05c36c59804e (diff) | |
| download | ruby-d2ba5ac4a8f3c1183118d6d897abd8d4f1611afe.tar.gz ruby-d2ba5ac4a8f3c1183118d6d897abd8d4f1611afe.tar.xz ruby-d2ba5ac4a8f3c1183118d6d897abd8d4f1611afe.zip | |
matz - irb (PR#46)
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb/ruby-lex.rb')
| -rw-r--r-- | lib/irb/ruby-lex.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index a788b779b..4c7a3b100 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 |
