Skip to content

Commit

Permalink
Add missing documentation
Browse files Browse the repository at this point in the history
reported by the Author tests. Remove undocumented subroutines that
weren't used anywhere.
  • Loading branch information
choroba committed Jan 29, 2021
1 parent f7a659e commit f7bb763
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lib/Karel/Parser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ __DSL__
$dsl .= join "\n", map "$_ ~ '$terminals{$_}'", keys %terminals;


has parser => ( is => 'ro' );

has _grammar => ( is => 'lazy' );

sub _dsl { $dsl }
Expand Down
15 changes: 15 additions & 0 deletions lib/Karel/Robot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ sub load_grid {
};
}

=item my $parser = $robot->parser
An instance of L<Karel::Parser> used to parse the source code.
=cut

has parser => ( is => 'ro',
default => sub { 'Karel::Parser'->new },
);
Expand Down Expand Up @@ -209,6 +215,15 @@ sub learn {
}
}

=item $robot->knowledge
All the commands the robot knows. Returns a hash reference, the
commands are the keys, the values are array references [prog, code]
where I<prog> is the bytecode corresponding to the command and I<code>
is the source code.
=cut

has knowledge => ( is => 'rwp' );

=back
Expand Down
6 changes: 6 additions & 0 deletions lib/Karel/Robot/WithGrid.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use constant {
FINISHED_DELAYED => 2,
QUIT => -1,
};
use namespace::clean;
use Moo::Role;
requires qw{ set_grid knows };

Expand Down Expand Up @@ -196,6 +197,11 @@ sub facing {
$self->grid->at($self->facing_coords)
}

=item $robot->is_running
Returns true if the robot is running a command, false otherwise.
=cut

has _stack => ( is => 'rwp',
predicate => 'is_running',
Expand Down

0 comments on commit f7bb763

Please sign in to comment.