Dervall / Piglet

An easier to use parsing and lexing tool that is configurable in fluent code without a pre-build step.
binarysculpting.com
MIT License
91 stars 11 forks source link

Numbered repetition is not implemented to standards #27

Closed Dervall closed 12 years ago

Dervall commented 12 years ago

When doing a regular expression the numbered repetition does not work as you intend it to. The separator between {} should be , and not : as it stands currently.

Furthermore, I believe that the implementation is not working as standard when using only a single value. I believe it will specify only a minimum number of repetition when using a single digit - and most implementations specify that it should be a maximum limit. Investigate and correct.

If there is a difference use the implementation by Microsoft, since that is what will be expected from the users coming from a .NET background.

Dervall commented 12 years ago

This will be the golden standard now:

Exactly two: {2} Two or more: {2,} Two to four: {2,4}

Which is definitely NOT what piglet does!

Dervall commented 12 years ago

Since there might be programs that someone has actually USED : instead of , to separate numbers in numbered repetitions. this is still supported since there are no real ill effects to doing so. Consider it a bonus :)

Dervall commented 12 years ago

Fixed in 1.2.0