Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[lib/Druid] converted all modules block-decl -> file-decl
Less indentation needed that way. It looks better with the Pod comments.
  • Loading branch information
Carl Masak committed Jun 7, 2009
1 parent 8bc9c1e commit 4eddde6
Show file tree
Hide file tree
Showing 9 changed files with 436 additions and 444 deletions.
34 changes: 16 additions & 18 deletions lib/Druid/Base.pm
@@ -1,30 +1,28 @@
use v6;
class Druid::Base;

=begin SUMMARY
C<Druid::Base> is the base class of most other Druid classes, collecting
regexes, attributes and methods which most of these other classes need.
=end SUMMARY

class Druid::Base {
# RAKUDO: Cannot use dashes here. [perl #64464]
regex col_letter { <[a..z]> }
regex row_number { \d+ }
regex coords { <col_letter><row_number> }
# RAKUDO: Cannot use dashes here. [perl #64464]
regex col_letter { <[a..z]> }
regex row_number { \d+ }
regex coords { <col_letter><row_number> }

our $.sarsen-move = /^ <coords> $/;
our $.lintel-move = /^ <coords> '-' <coords> $/;
our $.pass = /^ ['pass' | 'p'] $/;
our $.swap = /^ ['swap' | 's'] $/;
our $.resign = /^ ['resign' | 'r'] $/;
our $.sarsen-move = /^ <coords> $/;
our $.lintel-move = /^ <coords> '-' <coords> $/;
our $.pass = /^ ['pass' | 'p'] $/;
our $.swap = /^ ['swap' | 's'] $/;
our $.resign = /^ ['resign' | 'r'] $/;

method extract-coords(Match $m) {
# RAKUDO: Hoping these explicit int(...) conversions won't be
# necessary in the long run.
my Int $row = int($m<row_number> - 1);
my Int $column = int(ord($m<col_letter>) - ord('a'));
method extract-coords(Match $m) {
# RAKUDO: Hoping these explicit int(...) conversions won't be
# necessary in the long run.
my Int $row = int($m<row_number> - 1);
my Int $column = int(ord($m<col_letter>) - ord('a'));

return ($row, $column);
}
return ($row, $column);
}

# vim: filetype=perl6

0 comments on commit 4eddde6

Please sign in to comment.