This file is indexed.

/usr/share/doc/happy/examples/PgnParser.ly is in happy 1.19.8-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
> {
> module PgnParser (pgnMoveParser,pgnParser) where

> import GenUtils
> import OrdFM
> import Board
> import PgnTypes
> }

> %name pgnMoveParser
> %tokentype { Token }
> %token 
>	str		{ StringToken $$ }
>	result		{ ResultToken $$ }
>	nag		{ NAGToken $$ }
>	tag		{ TagToken $$ }
>	comment		{ CommentToken $$ }
>	']'		{ RightSBToken }
>	'('		{ LeftRBToken }
>	')'		{ RightRBToken }
>	'<'		{ LeftABToken }
>	'>'		{ RightABToken }
>	num		{ IntToken $$ }
>	'.'		{ PeriodToken }
> 	move		{ PlyToken $$ }
> %newline            	{ NewlineToken }

> %%

You either parse a set of PGN games,
or just a set of moves.

> moves :: { AbsMove }
> moves : opt_mv_num line_no move nags opt_comment analmoves opt_comment 
>	  more_moves
>			{ AbsMove $1 $2 $3 $4 ($5++$7) $6 Nothing $8 }
>       | opt_mv_num line_no move nags opt_comment more_moves
>			{ AbsMove $1 $2 $3 $4 $5 [] Nothing $6 }
>       | opt_mv_num line_no move '<' raw_moves '>' more_moves
>			{ AbsMove $1 $2 $3 [] [] [] (Just $5) $7 }

> more_moves :: { AbsMove }
> more_moves 
>	: moves			{ $1 }
>	| result		{ AbsResult $1 }
>	| 			{ AbsEnd }

> nags :: { [Int] }
> nags	: nag nags		{ $1 : $2 }
>	|			{ [] }

> opt_mv_num :: { Maybe MoveNumber }
> opt_mv_num 
>	: num '.' '.' '.'	{ Just (MoveNumber $1 Black) }
>	| num '.'		{ Just (MoveNumber $1 White) }
>	|			{ Nothing }

> mv_num :: { MoveNumber }
> mv_num 
>	: num '.' '.' '.'	{ (MoveNumber $1 Black) }
>	| num '.'		{ (MoveNumber $1 White) }

> opt_comment :: { [String] }
> opt_comment 
>	: comment		{ $1 }
>	|			{ [] } 

> analmoves :: { [AbsMove] }
> analmoves
>	: '(' moves ')'	analmoves	{ $2 : $4 }
>	| '(' moves ')'			{ [$2] }

> line_no :: { LineNo }
> line_no 
>	: 				{ $# }

> raw_moves :: { [AbsPly] }
> raw_moves 
>	: move raw_moves		{ $1 : $2 }
>	| 				{ [] }


			

> {

> pgnParser = pgnGameMap pgnMoveParser

> happyError :: Int -> [Token] -> a
> happyError i xs = 
> 	error ("Parse error in line " ++ show i ++ "\n"
>		++ show (take 10 xs))

> }