Hello,
I'm writing on this email for the last two days but I'm still undecided...
On 08/01/2011 07:33 PM, Derek M Jones wrote:
>> Nicolas has implemented support for the regular expressions provided by
>> PCRE, which to my understanding are more modern than those of OCaml
>> (Str).
>> Should we just drop the OCaml ones? Make a flag to choose between them?
>> Choose between them inline, as in x ~= pcre:"str"?
>
> Modern/ancient is not the issue. The question is which is most
> likely to be familiar to your users (who may not know Perl and are
> very unlikely to know OCaml) and which has the greater functionality?
>
> A quick scan of the brief man pages suggests that PCRE has greater
> functionality.
Pro PCRE:
---------
PCRE is kinda the de-facto regexp standard. Perl introduced it and a lot
of other languages adopted it. So you don't have to know Perl to have
used PCRE. The PCRE regexp are also more concise and in the coccinelle
context should be easier to read and understand.
> Make PCRE the default with a switch for OCaml (Str)?
PRO OCaml(STR):
---------------
Regexps in coccinelle have a pretty limited scope as they apply only to
identifiers so the full PCRE power isn't really needed. The OCaml(STR)
regexp seems to match the POSIX regexp standard. At least grouping and
alternation do match and they match the SmPL grouping and alternation
style. Keeping OCaml(STR) as default won't break existing scripts that
use regexp.
Conclusion:
-----------
I would vote to follow the principle of the least surprise. Which option
would provide the least surprise to most of the coccinelle users I'm the
wrong person to decide. I'm not a developer but come from a "lazy"
sysadmin background and eat regexps for breakfast, both the PCRE as well
as the POSIX brand.
Btw. there is one annoying thing about the current regexp
implementation: the regexp is implicitly anchored at the start of the
identifier so one has to use ".*" at the beginning of the regexp. But
this might be just a bug.
bye
michael
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)