]> cygwin.com Git - cygwin-apps/setup.git/blob - iniparse.y
2002-05-10 Robert Collins <rbtcollins@hotmail.com>
[cygwin-apps/setup.git] / iniparse.y
1 %{
2 /*
3 * Copyright (c) 2000, Red Hat, Inc.
4 *
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
8 * (at your option) any later version.
9 *
10 * A copy of the GNU General Public License can be found at
11 * http://www.gnu.org/
12 *
13 * Written by DJ Delorie <dj@cygnus.com>
14 *
15 */
16
17 /* Parse the setup.ini files. inilex.l provides the tokens for this. */
18
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <string.h>
22
23 #include "win32.h"
24 #include "ini.h"
25 #include "iniparse.h"
26 #include "PackageTrust.h"
27
28 extern int yyerror (String const &s);
29 int yylex ();
30
31 #include "port.h"
32
33 #include "IniDBBuilder.h"
34
35 #define YYERROR_VERBOSE 1
36 /*#define YYDEBUG 1*/
37
38 IniDBBuilder *iniBuilder;
39 extern int yylineno;
40
41 void add_correct_version();
42 %}
43
44 %token STRING
45 %token SETUP_TIMESTAMP SETUP_VERSION PACKAGEVERSION INSTALL SOURCE SDESC LDESC
46 %token CATEGORY REQUIRES
47 %token APATH PPATH INCLUDE_SETUP EXCLUDE_PACKAGE DOWNLOAD_URL
48 %token T_PREV T_CURR T_TEST T_UNKNOWN
49 %token MD5
50
51 %%
52
53 whole_file
54 : setup_headers packages
55 ;
56
57 setup_headers
58 : setup_header setup_headers
59 | /* empty */
60 ;
61
62 setup_header
63 : SETUP_TIMESTAMP STRING '\n' { iniBuilder->buildTimestamp ($2); }
64 | SETUP_VERSION STRING '\n' { iniBuilder->buildVersion ($2); }
65 | '\n'
66 | error { yyerror ("unrecognized line in setup.ini headers (do you have the latest setup?)"); } '\n'
67 ;
68
69 packages
70 : package packages
71 | /* empty */
72 ;
73
74 package
75 : '@' STRING '\n' { iniBuilder->buildPackage ($2);}
76 lines
77 ;
78
79 lines
80 : lines '\n' simple_line
81 | simple_line
82 ;
83
84 simple_line
85 : PACKAGEVERSION STRING { iniBuilder->buildPackageVersion ($2); }
86 | SDESC STRING { iniBuilder->buildPackageSDesc($2); }
87 | LDESC STRING { iniBuilder->buildPackageLDesc($2); }
88 | CATEGORY categories
89 | REQUIRES requires
90 | INSTALL STRING STRING MD5 { iniBuilder->buildPackageInstall ($2, $3, $4); }
91 | INSTALL STRING STRING { iniBuilder->buildPackageInstall ($2, $3); }
92 | SOURCE STRING STRING MD5 { iniBuilder->buildPackageSource ($2, $3, $4); }
93 | SOURCE STRING STRING { iniBuilder->buildPackageSource ($2, $3); }
94 | T_PREV { iniBuilder->buildPackageTrust (TRUST_PREV); }
95 | T_CURR { iniBuilder->buildPackageTrust (TRUST_CURR); }
96 | T_TEST { iniBuilder->buildPackageTrust (TRUST_TEST); }
97 | T_UNKNOWN { iniBuilder->buildPackageTrust (TRUST_UNKNOWN); }
98 | /* empty */
99 | error '\n' { --yylineno;
100 yyerror (String("unrecognized line ") + yylineno + " (do you have the latest setup?)");
101 ++yylineno;
102 }
103 ;
104
105 requires
106 : STRING { iniBuilder->buildPackageRequirement($1); } requires
107 | STRING { iniBuilder->buildPackageRequirement($1); }
108 ;
109
110 categories
111 : STRING { iniBuilder->buildPackageCategory ($1); } categories
112 | STRING { iniBuilder->buildPackageCategory ($1); }
113 ;
114
115 %%
This page took 0.042751 seconds and 6 git commands to generate.