[前][次][番号順一覧][スレッド一覧]

ruby-changes:41102

From: hsbt <ko1@a...>
Date: Fri, 18 Dec 2015 10:25:40 +0900 (JST)
Subject: [ruby-changes:41102] hsbt:r53177 (trunk): * lib/irb/ruby-lex.rb: fixed parse error for striped heredocument syntax.

hsbt	2015-12-18 10:25:08 +0900 (Fri, 18 Dec 2015)

  New Revision: 53177

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53177

  Log:
    * lib/irb/ruby-lex.rb: fixed parse error for striped heredocument syntax.
      [fix GH-1127] Patch by @koic

  Modified files:
    trunk/ChangeLog
    trunk/lib/irb/ruby-lex.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53176)
+++ ChangeLog	(revision 53177)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Dec 18 10:24:44 2015  SHIBATA Hiroshi  <hsbt@r...>
+
+	* lib/irb/ruby-lex.rb: fixed parse error for striped heredocument syntax.
+	  [fix GH-1127] Patch by @koic
+
 Fri Dec 18 09:44:47 2015  SHIBATA Hiroshi  <hsbt@r...>
 
 	* ext/pty/pty.c: fix double words typo.
Index: lib/irb/ruby-lex.rb
===================================================================
--- lib/irb/ruby-lex.rb	(revision 53176)
+++ lib/irb/ruby-lex.rb	(revision 53177)
@@ -406,7 +406,7 @@ class RubyLex https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L406
       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 == "-")
+        if /\S/ =~ c && (/["'`]/ =~ c || /\w/ =~ c || c == "-" || c == "~")
           tk = identify_here_document
         end
       end
@@ -855,7 +855,7 @@ class RubyLex https://github.com/ruby/ruby/blob/trunk/lib/irb/ruby-lex.rb#L855
 
   def identify_here_document
     ch = getc
-    if ch == "-"
+    if ch == "-" || ch == "~"
       ch = getc
       indent = true
     end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]