[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:03774] Ruby needs \n for last line in here-doc

From: Aleksi Niemel<aleksi.niemela@...>
Date: 2000-07-03 19:41:07 UTC
List: ruby-talk #3774
The file with content "puts 'foo'" (without \n as a last character) goes
through Ruby well.

The file with content "puts <<-EOS\nfoo\nEOS" (without \n as a last
character) doesn't; it reports:

\src\eol2.rb:3: unterminated string meets end of file
\src\eol2.rb:1: can't find string "EOS" anywhere before EOF

The file with "puts <<-EOS\nfoo\nEOS\n" goes fine.

Ok?

If not, maybe one could apply this patch (just coded, not tested because I
can't compile on this machine):

--- parse.y     Sun Jul 02 21:46:22 2000
+++ parse.y.here_patched        Mon Jul 03 22:02:45 2000
@@ -2617,7 +2617,8 @@
                p++;
            }
        }
-       if (strncmp(eos, p, len) == 0 && (p[len] == '\n' || p[len] == '\r'))
{
+       if (strncmp(eos, p, len) == 0 &&
+           (p[len] == '\n' || p[len] == '\r') || p[len] == 0)) {
            break;
        }


	- Aleksi

In This Thread

Prev Next