[Aeditor-talk] Regexp assertions
Simon Strandgaard
neoneye at adslhome.dk
Mon Dec 22 23:04:26 EST 2003
On Mon, 2003-12-22 at 20:38, Mark wrote:
> > BTW: Do you know if there exists testsuites that exercises this
> > user-friendly perl6 syntax ?
> There are some tests available for it that come with parrot. They're all in
> perl but I think it shouldn't be too hard to write a script that extracts the
> test cases and outputs the correct ruby code. Though at the moment the tests
> aren't very comprehensive.
Great.. I will look into this one day.
> I'm going to work on negative ranges such as <!2,4>. The best way to do this
> seems to be to add a flag to the range class to say whether it's negated or
> not, as with character classes. Does this seem reasonable to you?
Maybe its easier to interpret negative ranges.. lets for instance
consider we are interpreting <!42,666> Then I would translate it
into an alternation between the surrounding ranges, in this case
<0,41> and <667,>.
res = mk_alternation(
mk_repeat(expression, 0, min),
mk_repeat(expression, max, -1)
)
Later it can be optimized, as you mention, by having a flag for it.
I am very busy this Christmas, I guess all coding will be on standby
until next year. I will probably loose some braincells because of strong
alcohol, and thus the quality of the code will be reduced.
Anyway, I am in the process of reworking the repeat algorithm.
The current routine are incorrect and inefficient.
My changes only have effect on 'scanner.rb' so don't expect any big
changes.
wish you a happy Christmas too.
--
Simon Strandgaard
More information about the Aeditor-talk
mailing list