Skip to content

Commit

Permalink
Removed some Perl 5-isms
Browse files Browse the repository at this point in the history
  • Loading branch information
snarkyboojum committed Mar 18, 2010
1 parent aefaa69 commit 679c82e
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions tardis
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use Tardis;
# parse cmdline opts, instantiate a Tardis Debugger and run it
# masak++ parser goodness to go here
say "# Compiling '-e'...";
say "# Running...";

# for now we just give it an AST
my Tardis::Debugger $t .= new(
Expand All @@ -18,6 +17,8 @@ my Tardis::Debugger $t .= new(
)
)
);

say "# Running...";
$t.run;

my $current_tick = 0;
Expand All @@ -29,14 +30,14 @@ say "# Finished. Ticks: 0.." ~ @ticks.end;
while (my $cmd = prompt '> ') {

given $cmd {
when 'look' { look() }
when 'step' { step() }
when 'n' { step() }
when 'look' { look }
when 'step' { step() }
when 'n' { step() }
when /^go\s+(\d+)$/ { go(+$0) }
when 'quit' { quit() }
when 'q' { quit() }
when 'quit' { quit() }
when 'q' { quit() }

default { say "I don't understand" }
default { say "I don't understand" }
}
}

Expand All @@ -46,16 +47,16 @@ sub look() {
for @ticks[$current_tick].pad.variables -> $var {
say $var.perl;
}
#say @ticks[$current_tick].pad.variables.perl
}

# this loops around back to the first step if we run off the end
sub step() {
$current_tick = 0 if (++$current_tick > @ticks.end);
$current_tick = 0 if ++$current_tick > @ticks.end;
look();
}

sub go(Num $tick) {
if (0 <= $tick <= @ticks.end) {
if 0 <= $tick <= @ticks.end {
$current_tick = $tick;
look();
}
Expand Down

0 comments on commit 679c82e

Please sign in to comment.