import { compiler } from "https://dotland.deno.dev/x/melody@v0.18.1/melody_wasm.js";
Compiles Melody source code to a regular expression
Errors
Throws an error if a compilation error is encountered
Example
const source = `
<start>;
option of "v";
capture major {
some of <digit>;
}
".";
capture minor {
some of <digit>;
}
".";
capture patch {
some of <digit>;
}
<end>;
`;
try {
const output = compiler(source);
new RegExp(output).test("v1.1.1"); // true
} catch (error) {
// handle compilation error
}