pomsky icon indicating copy to clipboard operation
pomsky copied to clipboard

Inline regex

Open Aloso opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe.

Pomsky doesn't implement all regex features, and probably never will, given the vast number of regex engines.

Describe the solution you'd like

A special syntax to embed a regex in a pomsky expression, which is emitted unchanged. This looks like this:

regex "Hello [world]"
regex '\bHello\B'

Describe alternatives you've considered

Instead of a keyword, backticks could be used like in melody. I'm not a fan of this, because this feature should be available, but not encouraged. There should be "syntactic salt" to make it less convenient.

Another, perhaps more fitting name for the keyword would be "raw", since the string is not escaped. However, the meaning of "raw" strings in PL is usually inverted: It refers to escaping in the input, not the compiled output. The keyword regex better describes what use cases this syntax enables.

Roadmap

  • [x] Reserve keyword for 0.7
  • [ ] Implement syntax for 0.8

Aloso avatar Aug 24 '22 22:08 Aloso