Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Melody – a language that compiles to regular expressions. Parent comment
>If it could be done inline even better
I've been thinking of using a tagged template based mechanism (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...) so no special editor support is needed and then transpile to a normal regex (similar to how htm handles it's syntax with no runtime, https://www.npmjs.com/package/babel-plugin-htm) but I'm not working on that part of the process yet so it may change.
If Melody does end up using the tagged template mechanism it may end up looking something like this:
import melody from "melody"; const batmanRegex = melody` 16 of "na"; 2 of match { <space>; "batman"; } `;
const batmanRegex = /(?:na){16}(?:\sbatman){2}/;
There are no comments on this comment yet.
>If it could be done inline even better
I've been thinking of using a tagged template based mechanism (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...) so no special editor support is needed and then transpile to a normal regex (similar to how htm handles it's syntax with no runtime, https://www.npmjs.com/package/babel-plugin-htm) but I'm not working on that part of the process yet so it may change.
If Melody does end up using the tagged template mechanism it may end up looking something like this:
That would transpile to: Backticks would need escaping but otherwise it'd be normal Melody syntax