line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
11
|
use strict; use warnings; |
|
1
|
|
|
1
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
2
|
|
|
|
|
|
|
package Pegex::Chess::Grammar; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use Pegex::Base; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
5
|
|
|
|
|
|
|
extends 'Pegex::Grammar'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
2251
|
use constant file => 'ext/chess-pgx/chess.pgx'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
188
|
|
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
|
|
|
|
|
|
|
sub make_tree { |
16
|
|
|
|
|
|
|
{ |
17
|
1
|
|
|
1
|
1
|
140
|
'+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; |