Early functioning comment detection

This commit is contained in:
Nathan McCarty 2024-12-31 02:32:25 +00:00
parent ef58bb4810
commit 197dd79b34
3 changed files with 26 additions and 2 deletions

View file

@ -8,7 +8,8 @@
],
"provides": {
"IUtils": "lib/IUtils.rakumod",
"IUtils::IDEMode": "lib/IUtils/IDEMode.rakumod"
"IUtils::IDEMode": "lib/IUtils/IDEMode.rakumod",
"IUtils::Comments": "lib/IUtils/Comments.rakumod"
},
"bin": {
"iutils": "bin/iutils"

View file

@ -1,5 +1,14 @@
#!/usr/bin/env raku
use v6.d;
use IUtils;
use IUtils::Comments;
pack-run 'help';
my $contents = "/home/nathan/Projects/Idris/structures/test/src/Main.idr".IO.slurp;
say "\nTesting full flagged-expression:";
say $contents ~~ &flagged-expression;
when $contents ~~ &flagged-expression {
say $<test-name>;
say $<expression-name>;
say $<flag><type>;
}

View file

@ -0,0 +1,14 @@
unit module IUtils::Comments;
my token comment-start { \- \- }
my token type {
'test' | 'bench'
}
my token flag { \@ \@ <type> }
my token name { <[\w \-]>+ }
my regex flagged-expression is export {
<&comment-start> \h* <flag> \h* <test-name=&name> \V* \v
[<&comment-start> \V* \v]*
$<expression-name>=<expression-name=&name> \h+ \: \V* \v
}