On Mon, 1 Nov 2004, Simon Strandgaard wrote:

> On Sunday 31 October 2004 22:34, John Carter wrote:
> [snip]
>> Hmm. The next highest source of bugs in Ruby programs is getting
>> Regexes wrong.
>>
>> I have one RCR in on that subject already...
>>    http://rcrchive.net/rcr/show/179
>
> Sorry.. I want to advertise for my regexp package.
> it can prettyprint a regexp, which sometimes can be helpful.

Cute.

Nice to have, almost what I want.

I would assume that deep inside you have translated the Regex into some 
sort of finite automaton.

What I would like is at the transition where the FA jams, it returns the 
index to the char in the string it jammed on, and the range of chars for 
which it would have accepted at that point.

For example
  /ab[cde]|ab(xy|yz)|ab_s/.try_match("abf")
should return something like...
"Jammed on index 2, character 'f' expected one of [cdexy_]"


John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter / tait.co.nz
New Zealand

The universe is absolutely plastered with the dashed lines exactly one
space long.