]> cygwin.com Git - cygwin-apps/setup.git/blame - iniparse.y
2002-05-04 Robert Collins <rbtcollins@hotmail.com>
[cygwin-apps/setup.git] / iniparse.y
CommitLineData
23c9e63c
DD
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
b11b49f3 19#include <stdio.h>
23c9e63c 20#include <stdlib.h>
cb2a4b55 21#include <string.h>
23c9e63c 22
55e204f6 23#include "win32.h"
23c9e63c
DD
24#include "ini.h"
25#include "iniparse.h"
076654e7 26#include "PackageTrust.h"
0af2d779 27
6391823e 28extern int yyerror (String const &s);
341988b9 29int yylex ();
23c9e63c 30
13d27274
DD
31#include "port.h"
32
076654e7 33#include "IniDBBuilder.h"
bb849dbd 34
b11b49f3
DD
35#define YYERROR_VERBOSE 1
36/*#define YYDEBUG 1*/
37
076654e7 38IniDBBuilder *iniBuilder;
b11b49f3 39extern int yylineno;
23c9e63c 40
bb849dbd 41void add_correct_version();
23c9e63c
DD
42%}
43
44%token STRING
f6100b6f 45%token SETUP_TIMESTAMP SETUP_VERSION PACKAGEVERSION INSTALL SOURCE SDESC LDESC
38c97581 46%token CATEGORY REQUIRES
c46a33a9 47%token APATH PPATH INCLUDE_SETUP EXCLUDE_PACKAGE DOWNLOAD_URL
b11b49f3 48%token T_PREV T_CURR T_TEST T_UNKNOWN
58ee6135 49%token MD5
23c9e63c
DD
50
51%%
52
53whole_file
54 : setup_headers packages
55 ;
56
57setup_headers
58 : setup_header setup_headers
59 | /* empty */
60 ;
61
62setup_header
076654e7
RC
63 : SETUP_TIMESTAMP STRING '\n' { iniBuilder->buildTimestamp ($2); }
64 | SETUP_VERSION STRING '\n' { iniBuilder->buildVersion ($2); }
89725f30 65 | '\n'
13d27274 66 | error { yyerror ("unrecognized line in setup.ini headers (do you have the latest setup?)"); } '\n'
23c9e63c
DD
67 ;
68
69packages
70 : package packages
71 | /* empty */
72 ;
73
74package
076654e7 75 : '@' STRING '\n' { iniBuilder->buildPackage ($2);}
23c9e63c 76 lines
23c9e63c
DD
77 ;
78
79lines
80 : simple_line '\n' lines
81 | simple_line
82 ;
83
84simple_line
076654e7
RC
85 : PACKAGEVERSION STRING { iniBuilder->buildPackageVersion ($2); }
86 | SDESC STRING { iniBuilder->buildPackageSDesc($2); }
87 | LDESC STRING { iniBuilder->buildPackageLDesc($2); }
8f53e82a 88 | CATEGORY categories
38c97581 89 | REQUIRES requires
076654e7
RC
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); }
23c9e63c 98 | /* empty */
076654e7
RC
99 | error '\n' { --yylineno;
100 yyerror (String("unrecognized line ") + yylineno + " (do you have the latest setup?)");
101 ++yylineno;
b11b49f3 102 }
23c9e63c
DD
103 ;
104
38c97581 105requires
076654e7
RC
106 : STRING { iniBuilder->buildPackageRequirement($1); } requires
107 | STRING { iniBuilder->buildPackageRequirement($1); }
38c97581
CF
108 ;
109
8f53e82a 110categories
076654e7
RC
111 : STRING { iniBuilder->buildPackageCategory ($1); } categories
112 | STRING { iniBuilder->buildPackageCategory ($1); }
8f53e82a
RC
113 ;
114
23c9e63c 115%%
This page took 0.040015 seconds and 5 git commands to generate.