diff --git a/META6.json b/META6.json index e370616..702d193 100644 --- a/META6.json +++ b/META6.json @@ -8,8 +8,7 @@ ], "provides": { "IUtils": "lib/IUtils.rakumod", - "IUtils::IDEMode": "lib/IUtils/IDEMode.rakumod", - "IUtils::Comments": "lib/IUtils/Comments.rakumod" + "IUtils::IDEMode": "lib/IUtils/IDEMode.rakumod" }, "bin": { "iutils": "bin/iutils" diff --git a/bin/iutils b/bin/iutils index 85452e8..6c8797a 100755 --- a/bin/iutils +++ b/bin/iutils @@ -1,14 +1,19 @@ #!/usr/bin/env raku use v6.d; 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:"; -say $contents ~~ &flagged-expression; -when $contents ~~ &flagged-expression { - say $; - say $; - say $; -} +my @res = $ide.version; +say @res[0][1][1][1][0]; + +@res = $ide.load-file: '.tmp/test.nope'; +say @res.raku; + +@res = $ide.interpret: ':exec works >>= print'; +say @res.raku; + +@res = $ide.interpret: ':exec fails'; +say @res.raku; diff --git a/lib/IUtils.rakumod b/lib/IUtils.rakumod index 2064e2d..7a74f0d 100644 --- a/lib/IUtils.rakumod +++ b/lib/IUtils.rakumod @@ -2,53 +2,3 @@ unit module IUtils; 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 -} diff --git a/lib/IUtils/Comments.rakumod b/lib/IUtils/Comments.rakumod deleted file mode 100644 index 9274e64..0000000 --- a/lib/IUtils/Comments.rakumod +++ /dev/null @@ -1,14 +0,0 @@ -unit module IUtils::Comments; - -my token comment-start { \- \- } -my token type { - 'test' | 'bench' -} -my token flag { \@ \@ } -my token name { <[\w \-]>+ } - -my regex flagged-expression is export { - <&comment-start> \h* \h* \V* \v - [<&comment-start> \V* \v]* - $= \h+ \: \V* \v -}