| 1 | 1 | ▶ | use strict; use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | package Pegex::Chess::Grammar; | ||
| 3 | |||
| 4 | 1 | ▶ | use Pegex::Base; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | extends 'Pegex::Grammar'; | |
| 6 | |||
| 7 | 1 | ▶ | use constant file => 'ext/chess-pgx/chess.pgx'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | # To update this grammar, make changes to share/chess.pgx, then run this | ||
| 10 | # command: | ||
| 11 | # | ||
| 12 | # perl -Ilib -MPegex::Chess::Grammar=compile | ||
| 13 | # | ||
| 14 | |||
| 15 | 1 | ▶ | sub make_tree { |
|
Subroutine
make_tree: called CC=1 SCAR=0.0
Pod
documented
| |||
| 16 | { | ||
| 17 | 1 | '+grammar' => 'chess', | |
| 18 | '+toprule' => 'chess_board', | ||
| 19 | 'EOL' => { | ||
| 20 | '.rgx' => qr/\G\r?\n/ | ||
| 21 | }, | ||
| 22 | 'chess_board' => { | ||
| 23 | '+max' => 8, | ||
| 24 | '+min' => 8, | ||
| 25 | '.ref' => 'row' | ||
| 26 | }, | ||
| 27 | 'position' => { | ||
| 28 | '.rgx' => qr/\G([rRhHbBqQkKpP\ ])/ | ||
| 29 | }, | ||
| 30 | 'row' => { | ||
| 31 | '.all' => [ | ||
| 32 | { | ||
| 33 | '+max' => 8, | ||
| 34 | '+min' => 8, | ||
| 35 | '-flat' => 1, | ||
| 36 | '.ref' => 'position' | ||
| 37 | }, | ||
| 38 | { | ||
| 39 | '.ref' => 'EOL' | ||
| 40 | } | ||
| 41 | ] | ||
| 42 | } | ||
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | 1 | 1; | |