Skip to content

Instantly share code, notes, and snippets.

@jaffa4
Created July 19, 2015 14:12
Show Gist options
  • Save jaffa4/5728e29b867807c3cd41 to your computer and use it in GitHub Desktop.
Save jaffa4/5728e29b867807c3cd41 to your computer and use it in GitHub Desktop.
mp@mp-VirtualBox:~$ perl6 --ll-exception /media/sf_m/p6/perl6tracer2/bin/trace.p6 -sl -c <a.p6
Cannot find method 'AT-KEY': no method cache and no .^find_method
at /media/sf_m/p6/perl6tracer2/bin/trace.p6:51 (<ephemeral file>:<unit>:151)
from /media/sf_m/p6/perl6tracer2/bin/trace.p6:1 (<ephemeral file>:<unit-outer>:10)
from gen/moar/stage2/NQPHLL.nqp:1289 (/home/mp/rakudo/install/share/nqp/lib/NQPHLL.moarvm:eval:190)
from gen/moar/stage2/NQPHLL.nqp:1487 (/home/mp/rakudo/install/share/nqp/lib/NQPHLL.moarvm:evalfiles:91)
from gen/moar/stage2/NQPHLL.nqp:1386 (/home/mp/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_eval:214)
from src/Perl6/Compiler.nqp:59 (/home/mp/rakudo/install/share/nqp/lib/Perl6/Compiler.moarvm:command_eval:93)
from gen/moar/stage2/NQPHLL.nqp:1360 (/home/mp/rakudo/install/share/nqp/lib/NQPHLL.moarvm:command_line:116)
from src/gen/m-main.nqp:39 (/home/mp/rakudo/install/share/perl6/runtime/perl6.moarvm:MAIN:18)
from src/gen/m-main.nqp:35 (/home/mp/rakudo/install/share/perl6/runtime/perl6.moarvm:<mainline>:197)
from <unknown>:1 (/home/mp/rakudo/install/share/perl6/runtime/perl6.moarvm:<main>:8)
from <unknown>:1 (/home/mp/rakudo/install/share/perl6/runtime/perl6.moarvm:<entry>:9)
mp@mp-VirtualBox:~$
use Perl6::Tracer;
sub getnextargument($index, $explanation)
{
if ($index+1>=@*ARGS.elems)
{
note "$explanation is missing after "~@*ARGS[$index];
exit 1;
}
return @*ARGS[$index+1];
}
my $i = 0;
my %options;
%options<showline> = False;
%options<compiletime> = False;
while ($i < @*ARGS)
{
given (@*ARGS[$i]) {
when "-h"
{
note
"Perl6 tracer
-h help
-sl show whole line when tracing
=c trace compilation
standard input input file
standard output output file
";
exit 1;
}
when "-sl"
{
%options<showline> = True;
}
when "-c"
{
%options<compiletime> = True;
}
default
{
note "unknown argument "~ @*ARGS[$i];
exit 1;
}
}
$i++;
}
my $f = Perl6::Tracer.new(); # this is the line number
my $content = $*IN.slurp-rest;
print $f.trace(%options,$content);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment