h3rald / min

A small but practical concatenative programming language and shell
https://min-lang.org
MIT License
310 stars 23 forks source link

Recursion in Regex #124

Closed ghost closed 3 years ago

ghost commented 3 years ago

"{{min}}}" "/\{([^\{\}]|(?R))*\}/" regex tried in repl.

Result are:

(!) <repl>(1,40) [regex]: Invalid regular expression: "\{([^\{\}]|(?R))*\}"
    <repl>(1,40) in symbol: regex
h3rald commented 3 years ago

Noooooooo not gonna happen!! 😳

I am using sgregex for regular expressions, and already it supports a subset of regular expressions. The idea was to keep things minimal...

It is usable for fairly normal stuff (I used it to process the help for all min symbols and sigils, it did the job well enough).

I am not sure on whether I want to include something bigger -- the obvious alternative would be nim-regex, but afaik it doesn't support recursion either! In fact, I don't believe I've ever used it myself 🤣

Find me a small c library with one header and one .c file that supports all that and we can talk about it 😉

ghost commented 3 years ago

it doesn't support recursion either! In fact, I don't believe I've ever used it myself 🤣

Recursive regex would be very useful in min. There are rare areas where existence of recursive regex usement happens.

c library with one header and one .c file that supports all that and we can talk about it 😉

Hmphm... Can you integrate if i found it? 👎

h3rald commented 3 years ago

it doesn't support recursion either! In fact, I don't believe I've ever used it myself 🤣

Recursive regex would be very useful in min. There are rare areas where existence of recursive regex usement happens.

c library with one header and one .c file that supports all that and we can talk about it 😉

Hmphm... Can you integrate if i found it? 👎

Yeah... if it exposes a relatively simple high level API I can make a Nim wrapper for it 😊

ghost commented 3 years ago

it doesn't support recursion either! In fact, I don't believe I've ever used it myself 🤣

Recursive regex would be very useful in min. There are rare areas where existence of recursive regex usement happens.

c library with one header and one .c file that supports all that and we can talk about it 😉

Hmphm... Can you integrate if i found it? 👎

Yeah... if it exposes a relatively simple high level API I can make a Nim wrapper for it 😊

Looks interesting: http://hte.sourceforge.net/doxygenized-0.8.0pre1/regex_8c-source.html -> But i didn't tested or used it yet. What do you think about it?

h3rald commented 3 years ago

Wow that was fast! Where did it come from? What project I mean?

Actually there are also a couple of other requirements:

ghost commented 3 years ago

Actually there are also a couple of other requirements:

  • permissive open source license (not GPL or similar)
  • cross-platform (Windows/macOS/Linux)

Yes you're right.

ghost commented 3 years ago

Did you look at the site?

I looked however i found nothing about licenses or platfrom dependentation. You may found where.

ghost commented 3 years ago

Or see (A Regex Passage of GNU C Library) https://kirste.userpage.fu-berlin.de/chemnet/use/info/libc/libc_16.html#SEC280

h3rald commented 3 years ago

Did you look at the site?

I looked however i found nothing about licenses or platfrom dependentation. You may found where.

Looks like GPL 😞 http://hte.sourceforge.net/doc.html

I had a look around for a while and only found sgregex that seemed to have a permissive license, was complete enough, was cross platform and self-contained. But there could be others!