[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Patterns for error messages

Victor 'Zverok' Shepelev

3/1/2008 10:41:00 PM

Hello all.

It seems that the question relates to interpreter "internals", but I'm
afraid of ask silly questions in ruby-core.

The question is: why error messages of interpreter has inconsistent
addressing system of file and line?

There are at many slightly different schemes (and all of them can be present
in the same error backtrace):

path/file.rb:10: error text
path/file.rb:1:in `require': other-path/other-file.rb:31: error text
path/file.rb:7:in `method' error text
^ from path/file.rb:12

And so on. I can't invent one regexp for my output-capturing text editor
(EditPlus on Windows) for catch all cases and automatically extract file and
path for navigate me to this path.

Thanks for the answers.

v.


2 Answers

Phlip

3/2/2008 12:21:00 AM

0

Victor 'Zverok' Shepelev wrote:

> It seems that the question relates to interpreter "internals", but I'm
> afraid of ask silly questions in ruby-core.

I can't imagine why.

> The question is: why error messages of interpreter has inconsistent
> addressing system of file and line?

Because each is subject to the whims of a programmer who may or may not have
followed conventions when rescuing errors and printing them out.

(BTW I can talk! I might just do this:
rescue => e
diagnostic = [diagnostic, e.inspect,
*e.backtrace].compact.join("\n")
puts diagnostic
)

> There are at many slightly different schemes (and all of them can be
> present
> in the same error backtrace):
>
> path/file.rb:10: error text
> path/file.rb:1:in `require': other-path/other-file.rb:31: error text
> path/file.rb:7:in `method' error text
> ^ from path/file.rb:12
>
> And so on. I can't invent one regexp for my output-capturing text editor
> (EditPlus on Windows) for catch all cases and automatically extract file
> and
> path for navigate me to this path.

Why can't you use more than one regexp for them?

How about you write a Ruby project which tests some regices, then glom them
all together?

BTW EditPlus seems to have a Ruby.stx - shouldn't that provide fault
navigation?

--
Phlip


Stefano Crocco

3/2/2008 7:37:00 AM

0

Alle Saturday 01 March 2008, Victor 'Zverok' Shepelev ha scritto:
> Hello all.
>
> It seems that the question relates to interpreter "internals", but I'm
> afraid of ask silly questions in ruby-core.
>
> The question is: why error messages of interpreter has inconsistent
> addressing system of file and line?
>
> There are at many slightly different schemes (and all of them can be
> present in the same error backtrace):
>
> path/file.rb:10: error text
> path/file.rb:1:in `require': other-path/other-file.rb:31: error text
> path/file.rb:7:in `method' error text
> ^ from path/file.rb:12
>
> And so on. I can't invent one regexp for my output-capturing text editor
> (EditPlus on Windows) for catch all cases and automatically extract file
> and path for navigate me to this path.
>
> Thanks for the answers.
>
> v.

I can't find the differences. If you want a regexp which gives the name of the
file, I think you can simply use something like:

/^.*(?=:\d+:)/

Stefano