3 * Copyright © 2006 Keith Packard <keithp@keithp.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 void yyerror (char *msg
);
40 %token HEAD BRANCH ACCESS SYMBOLS LOCKS COMMENT DATE
41 %token BRANCHES NEXT COMMITID EXPAND
42 %token DESC LOG TEXT STRICT AUTHOR STATE
44 %token BRAINDAMAGED_NUMBER
45 %token
<s
> HEX NAME DATA TEXT_DATA
46 %token
<number
> NUMBER
49 %type
<symbol
> symbollist symbol symbols
50 %type
<version
> revision
51 %type
<vlist
> revisions
53 %type
<branch
> branches numbers
54 %type
<s
> opt_commitid commitid
56 %type
<s
> author state
57 %type
<number
> next opt_number
59 %type
<patches
> patches
63 file
: headers revisions desc patches
67 headers
: header headers
70 header
: HEAD opt_number SEMI
71 { this_file
->head
= $2; }
73 { this_file
->branch
= $2; }
76 { this_file
->symbols
= $1; }
77 | LOCKS locks SEMI lock_type
80 { this_file
->expand
= $2; }
85 lock
: NAME COLON NUMBER
87 lock_type
: STRICT SEMI
90 symbollist
: SYMBOLS symbols SEMI
93 symbols
: symbols symbol
94 { $2->next
= $1; $$
= $2; }
95 | symbols fscked_symbol
100 symbol
: name COLON NUMBER
102 $$
= calloc
(1, sizeof
(cvs_symbol
));
107 fscked_symbol
: name COLON BRAINDAMAGED_NUMBER
109 fprintf
(stderr
, "ignoring symbol %s (FreeBSD RELENG_2_1_0 braindamage?)\n", $1);
115 char name
[CVS_MAX_REV_LEN
];
116 cvs_number_string
(&$1, name
);
120 revisions
: revisions revision
121 { *$1 = $2; $$
= &$2->next
; }
123 { $$
= &this_file
->versions
; }
125 revision
: NUMBER date author state branches next opt_commitid
127 $$
= calloc
(1, sizeof
(cvs_version
));
132 $$
->dead
= !strcmp
($4, "dead");
137 ++this_file
->nversions
;
140 date
: DATE NUMBER SEMI
145 author
: AUTHOR NAME SEMI
148 state
: STATE NAME SEMI
151 branches
: BRANCHES numbers SEMI
154 numbers
: NUMBER numbers
156 $$
= calloc
(1, sizeof
(cvs_branch
));
164 next
: NEXT opt_number SEMI
172 opt_commitid
: commitid
177 commitid
: COMMITID NAME SEMI
183 patches
: patches patch
184 { *$1 = $2; $$
= &$2->next
; }
186 { $$
= &this_file
->patches
; }
188 patch
: NUMBER log text
189 { $$
= calloc
(1, sizeof
(cvs_patch
));
199 text
: TEXT TEXT_DATA
204 void yyerror (char *msg
)
206 fprintf
(stderr
, "parse error %s at %s\n", msg
, lex_text
());