Login  Register

Re: Help with petitparser

Posted by Stéphane Ducasse on Jun 01, 2010; 9:09pm
URL: https://forum.world.st/Help-with-petitparser-tp2238409p2239230.html

Cool.
Adrien did a full bibtext parser :)

Stef

On Jun 1, 2010, at 10:35 PM, Lukas Renggli wrote:

> I've added case-insensitive matching to the latest version of
> PetitParser-lr.173. I am not entirely happy with the implementation
> itself, but the API is ok and will be stable.
>
> By default all matches are case-sensitive, but you can tell character
> and string parsers to match case insensitive:
>
>    " matches 'a' and 'A' "
>    $a asParser caseInsensitive
>
>    " matches 'abc', 'AbC', 'Abc', ... "
>    'abc' asParser caseInsensitive
>
> Hope this helps.
>
> Lukas
>
> On 1 June 2010 17:29, Lukas Renggli <[hidden email]> wrote:
>>> - I don't find to way in petitparser to: parse every string except a list of
>>> strings.
>>> For example, I want to parse all string except 'string' and 'STRING'.
>>
>> The logical #not parser helps you here:
>>
>>    ('string' asParser / 'STRING' asParser) not , #letter star plus
>>
>>> - I don't find a way to parse a string without taking care of its case.
>>> For example, I want to parse 'string', 'STRING', 'String', 'stRINg', etc ...
>>
>> This is currently not supported out of the box. You could add it by
>> subclassing PRLiteralCollectionParser and compare the strings with
>> #sameAs: instead of #=. If this turns out to be generally useful we
>> should maybe add it to the core framework?
>>
>> Lukas
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users