Cello icon indicating copy to clipboard operation
Cello copied to clipboard

Feature request : regexp

Open solisoft opened this issue 11 years ago • 6 comments

Do you plan to implement regexp ?

solisoft avatar Sep 25 '13 20:09 solisoft

Yes I think this is an important feature. But it is also quite a large project so I might not find the time to do it alone.

Currently there are a couple main options.

The first option is to wrap an existing C regex library in a Cello like interface. The advantage of this is that it guarantees a stable and well behaved regex implementation. The downside is that it needs to be somehow packaged with Cello and must be portable.

Another option is to roll our own from scratch.

A third option is that I am currently working on a parser combinator library for vanilla C which I could port to Cello. And this library could be used to construct a regex engine as well as provide a general parsing tool which could also be used for JSON or whatever else.

The third option is my current preference although it may take several months or more for everything to fall in place.

For now my recommendation to anyone who wants regex like functionality is to look toward the scan functions. Believe it or not these are actually far more powerful than people think and often cover 90% of use cases.

orangeduck avatar Sep 25 '13 21:09 orangeduck

Thank you for your answer ! Do you have any documentation about this scan method ?

solisoft avatar Sep 25 '13 21:09 solisoft

There are a few details here.

The semantics of the function match closely that of scanf, except it is designed to work with Cello objects rather than raw C types.

orangeduck avatar Sep 25 '13 21:09 orangeduck

+1 for the parser

2013/9/25 Daniel Holden [email protected]

There are a few details here http://libcello.org/reference/show.

The semantics of the function match closely that of scanfhttp://www.cplusplus.com/reference/cstdio/scanf/, except it is designed to work with Cello objects rather than raw C types.

— Reply to this email directly or view it on GitHubhttps://github.com/orangeduck/libCello/issues/58#issuecomment-25126906 .

Mi twitter: http://twitter.com/garito

Temet nosce

Garito avatar Sep 26 '13 06:09 Garito

You'd better take a look at http://marcomaggi.github.io/docs/cre2.html

tucnak avatar Jul 13 '15 13:07 tucnak

Well, gcc has regex.h on gnu standards which could be wrapped, but the user would need to compile with gnuXX options. Don't know what could be done for windows.

masterl avatar Sep 22 '15 05:09 masterl