Created
September 22, 2023 00:07
-
-
Save zenware/dab8bf24ffbd3c265cd6f1ba2265b417 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Attempt to melodify the following regex: | |
<start>; | |
any of <whitespace>; | |
option of capture scope { | |
either { | |
"_G."; | |
capture { | |
"local"; | |
} | |
} | |
} | |
option of capture { | |
any of <whitespace>; | |
} | |
capture varname { | |
<alphabetic>; | |
any of <alphanumeric>; | |
} | |
// Assigning this block to a variable is a bit of a kludge to use `either` later | |
// Without "cheating" by adding a literal `|` | |
let .first_bit = { | |
any of <whitespace>; | |
// backtick allows you to inject literals | |
// melody seems to be missing a feature to match a single character of a set. | |
any of `[+-]`; | |
"="; | |
any of <whitespace>; | |
} | |
capture { | |
either { | |
.first_bit; | |
<end>; | |
} | |
} | |
let .text_in_brackets = { | |
"["; any of <char>; "]"; | |
} | |
let .text_in_braces = { | |
"{"; any of <char>; "}"; | |
} | |
let .text_in_quotes = { | |
'"'; any of <char>; '"'; | |
} | |
let .delimiters = { | |
""; | |
} | |
option of capture data { | |
either { | |
.text_in_brackets; | |
.text_in_braces; | |
.text_in_quotes; | |
any of `[^" -]`; | |
} | |
// "not" is to-be-implemented | |
} | |
option of capture { | |
any of <whitespace>; | |
"--"; | |
any of <whitespace>; | |
capture comment { | |
any of <char>; | |
<end>; | |
} | |
} | |
option of capture { | |
<end>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because I suspect Discord will complain about this URL
https://melody-playground.vercel.app?content=JTJGJTJGJTIwQXR0ZW1wdCUyMHRvJTIwbWVsb2RpZnklMjB0aGUlMjBmb2xsb3dpbmclMjByZWdleCUzQSUwQSUzQ3N0YXJ0JTNFJTNCJTBBJTBBYW55JTIwb2YlMjAlM0N3aGl0ZXNwYWNlJTNFJTNCJTBBJTBBb3B0aW9uJTIwb2YlMjBjYXB0dXJlJTIw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