Early functioning comment detection
This commit is contained in:
parent
ef58bb4810
commit
197dd79b34
|
@ -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"
|
||||
|
|
11
bin/iutils
11
bin/iutils
|
@ -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>;
|
||||
}
|
||||
|
|
14
lib/IUtils/Comments.rakumod
Normal file
14
lib/IUtils/Comments.rakumod
Normal 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
|
||||
}
|
Loading…
Reference in a new issue