Compare commits
No commits in common. "197dd79b34818ee27e4681c68b51656e83c55479" and "525b9c68cd6db671761a863f12713d4a3afe6c20" have entirely different histories.
197dd79b34
...
525b9c68cd
4 changed files with 15 additions and 75 deletions
|
@ -8,8 +8,7 @@
|
||||||
],
|
],
|
||||||
"provides": {
|
"provides": {
|
||||||
"IUtils": "lib/IUtils.rakumod",
|
"IUtils": "lib/IUtils.rakumod",
|
||||||
"IUtils::IDEMode": "lib/IUtils/IDEMode.rakumod",
|
"IUtils::IDEMode": "lib/IUtils/IDEMode.rakumod"
|
||||||
"IUtils::Comments": "lib/IUtils/Comments.rakumod"
|
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"iutils": "bin/iutils"
|
"iutils": "bin/iutils"
|
||||||
|
|
23
bin/iutils
23
bin/iutils
|
@ -1,14 +1,19 @@
|
||||||
#!/usr/bin/env raku
|
#!/usr/bin/env raku
|
||||||
use v6.d;
|
use v6.d;
|
||||||
use IUtils;
|
use IUtils;
|
||||||
use IUtils::Comments;
|
|
||||||
|
|
||||||
my $contents = "/home/nathan/Projects/Idris/structures/test/src/Main.idr".IO.slurp;
|
my $ide = IUtils::IDEMode.new();
|
||||||
|
# my @res = $ide.browse-namespace: 'Data.List';
|
||||||
|
# say @res;
|
||||||
|
|
||||||
say "\nTesting full flagged-expression:";
|
my @res = $ide.version;
|
||||||
say $contents ~~ &flagged-expression;
|
say @res[0][1][1][1][0];
|
||||||
when $contents ~~ &flagged-expression {
|
|
||||||
say $<test-name>;
|
@res = $ide.load-file: '.tmp/test.nope';
|
||||||
say $<expression-name>;
|
say @res.raku;
|
||||||
say $<flag><type>;
|
|
||||||
}
|
@res = $ide.interpret: ':exec works >>= print';
|
||||||
|
say @res.raku;
|
||||||
|
|
||||||
|
@res = $ide.interpret: ':exec fails';
|
||||||
|
say @res.raku;
|
||||||
|
|
|
@ -2,53 +2,3 @@
|
||||||
unit module IUtils;
|
unit module IUtils;
|
||||||
|
|
||||||
need IUtils::IDEMode;
|
need IUtils::IDEMode;
|
||||||
|
|
||||||
# Utility functions for pack
|
|
||||||
|
|
||||||
#| Invoke a pack command
|
|
||||||
sub pack-run(*@cmd) is export {
|
|
||||||
my $proc = run "pack", @cmd, :out, :err;
|
|
||||||
my $out = $proc.out.slurp(:close);
|
|
||||||
my $err = $proc.err.slurp(:close);
|
|
||||||
unless $proc {
|
|
||||||
die qq:to/END/;
|
|
||||||
Pack Failure!
|
|
||||||
Captured Output:
|
|
||||||
$out
|
|
||||||
|
|
||||||
Captured StdErr:
|
|
||||||
$err
|
|
||||||
END
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#| Build a package with pack
|
|
||||||
sub pack-build($pkg) is export {
|
|
||||||
pack-run 'build', $pkg;
|
|
||||||
}
|
|
||||||
|
|
||||||
#| Test a package with pack
|
|
||||||
sub pack-test($pkg) is export {
|
|
||||||
pack-run 'build', $pkg;
|
|
||||||
}
|
|
||||||
|
|
||||||
#| Clean a package with pack
|
|
||||||
sub pack-clean($pkg) is export {
|
|
||||||
pack-run 'clean', $pkg;
|
|
||||||
}
|
|
||||||
|
|
||||||
#| Invoke an idris command
|
|
||||||
sub idris-run(*@cmd) is export {
|
|
||||||
my $proc = run "idris2", @cmd, :out, :err;
|
|
||||||
my $out = $proc.out.slurp(:close);
|
|
||||||
my $err = $proc.err.slurp(:close);
|
|
||||||
unless $proc {
|
|
||||||
($out, $err)
|
|
||||||
}
|
|
||||||
return $out;
|
|
||||||
}
|
|
||||||
|
|
||||||
#| Exec the expression with the given name in the given file
|
|
||||||
sub idris-exec($expr, $file) is export {
|
|
||||||
idris-run '--find-ipkg', '--exec', $expr, $file
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
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…
Add table
Reference in a new issue