Steven Lumos wrote:
> Neville Franks <subs / surfulater.com> writes:
> 
>>
>>    Ared = "mary"
>>    angy = "bill"
>>    angy <<Ared      # does this start a Here Doc or is it operator <<
>>    print <<Ared     # as above.
>>
>> Thanks.
> 
> Your example is incomplete.
> 
>   angy <<Ared   # is an operator
>   print <<Ared   # is a HERE doc...
>   some string
>   Ared          # ...because it has an end marker
> 
> That's how the Emacs ruby-mode seems to do it.
> 
> Steve

Steve, in that case Emacs ruby-mode is incorrect.

angy <<Ared   # is an operator
  some string
Ared

gives:

C:\ruby\bin\ruby.exe D:\Ed32\BrowserTest\RubyHereDoc3.rb
D:/Ed32/BrowserTest/RubyHereDoc3.rb:3: undefined method `angy' for 
main:Object (NoMethodError)

To get this to compile, a method angry must be defined:

def angy var
end

So the only way to determine if << is a Here Doc is to know if the 
preceeding token is a method. And an editor can't know that.

-- 
Posted via http://www.ruby-forum.com/.