Created
September 14, 2023 13:04
-
-
Save gfldex/10c78c784822bf4e673cb2f15326279d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| constant &auto-enum = BEGIN (Q:to /◻/).EVAL; | |
| proto sub quasi-enum($str, |opts ( :$DEFAULT, :$SOURCEPOS, :$HARDBREAKS, :$UNSAFE, :$NOBREAKS, :$NORMALIZE, :$VALIDATE_UTF8, :$SMART, :$GITHUB_PRE_LANG, :$LIBERAL_HTML_TAG, :$FOOTNOTES, :$STRIKETHROUGH_DOUBLE_TILDE, :$TABLE_PREFER_STYLE_ATTRIBUTES, :$FULL_INFO_STRING )) { | |
| constant %CMARK_OPTIONS = | |
| DEFAULT => 0, | |
| SOURCEPOS => 1 +< 1, | |
| HARDBREAKS => 1 +< 2, | |
| UNSAFE => 1 +< 17, | |
| NOBREAKS => 1 +< 4, | |
| NORMALIZE => 1 +< 8, | |
| VALIDATE_UTF8 => 1 +< 9 , | |
| SMART => 1 +< 10, | |
| GITHUB_PRE_LANG => 1 +< 11, | |
| LIBERAL_HTML_TAG => 1 +< 12, | |
| FOOTNOTES => 1 +< 13, | |
| STRIKETHROUGH_DOUBLE_TILDE => 1 +< 14, | |
| TABLE_PREFER_STYLE_ATTRIBUTES => 1 +< 15, | |
| FULL_INFO_STRING => 1 +< 16 | |
| ; | |
| my $opts = [+|] %CMARK_OPTIONS{opts.hash.keys}; | |
| nextwith($str, $opts) | |
| } | |
| ◻ | |
| multi sub auto-enum($str, int $opt) { | |
| # codes goes here | |
| } | |
| dd auto-enum('foo', :SMART); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment