nss: import at 3.0.1 beta 1
[mozilla-nss.git] / security / nss / cmd / modutil / installparse.y
blob003f046288337b3386e051dfe79015d4efcd9c87
1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
14 * The Original Code is the Netscape security libraries.
16 * The Initial Developer of the Original Code is
17 * Netscape Communications Corporation.
18 * Portions created by the Initial Developer are Copyright (C) 1994-2000
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
23 * Alternatively, the contents of this file may be used under the terms of
24 * either the GNU General Public License Version 2 or later (the "GPL"), or
25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26 * in which case the provisions of the GPL or the LGPL are applicable instead
27 * of those above. If you wish to allow use of your version of this file only
28 * under the terms of either the GPL or the LGPL, and not to allow others to
29 * use your version of this file under the terms of the MPL, indicate your
30 * decision by deleting the provisions above and replace them with the notice
31 * and other provisions required by the GPL or the LGPL. If you do not delete
32 * the provisions above, a recipient may use your version of this file under
33 * the terms of any one of the MPL, the GPL or the LGPL.
35 * ***** END LICENSE BLOCK ***** */
37 /* yacc file for parsing PKCS #11 module installation instructions */
38 /*------------------------ Definition Section ---------------------------*/
40 %{
41 #define yyparse Pk11Install_yyparse
42 #define yylex Pk11Install_yylex
43 #define yyerror Pk11Install_yyerror
44 #define yychar Pk11Install_yychar
45 #define yyval Pk11Install_yyval
46 #define yylval Pk11Install_yylval
47 #define yydebug Pk11Install_yydebug
48 #define yynerrs Pk11Install_yynerrs
49 #define yyerrflag Pk11Install_yyerrflag
50 #define yyss Pk11Install_yyss
51 #define yyssp Pk11Install_yyssp
52 #define yyvs Pk11Install_yyvs
53 #define yyvsp Pk11Install_yyvsp
54 #define yylhs Pk11Install_yylhs
55 #define yylen Pk11Install_yylen
56 #define yydefred Pk11Install_yydefred
57 #define yydgoto Pk11Install_yydgoto
58 #define yysindex Pk11Install_yysindex
59 #define yyrindex Pk11Install_yyrindex
60 #define yygindex Pk11Install_yygindex
61 #define yytable Pk11Install_yytable
62 #define yycheck Pk11Install_yycheck
63 #define yyname Pk11Install_yyname
64 #define yyrule Pk11Install_yyrule
66 /* C Stuff */
67 #include "install-ds.h"
68 #include <prprf.h>
70 #define YYSTYPE Pk11Install_Pointer
71 extern char *Pk11Install_yytext;
72 char *Pk11Install_yyerrstr=NULL;
76 /* Tokens */
77 %token OPENBRACE
78 %token CLOSEBRACE
79 %token STRING
80 %start toplist
84 /*--------------------------- Productions -------------------------------*/
86 toplist : valuelist
88 Pk11Install_valueList = $1.list;
91 valuelist : value valuelist
93 Pk11Install_ValueList_AddItem($2.list,$1.value);
94 $$.list = $2.list;
98 $$.list = Pk11Install_ValueList_new();
101 value : key_value_pair
103 $$.value= Pk11Install_Value_new(PAIR_VALUE,$1);
105 | STRING
107 $$.value= Pk11Install_Value_new(STRING_VALUE, $1);
110 key_value_pair : key OPENBRACE valuelist CLOSEBRACE
112 $$.pair = Pk11Install_Pair_new($1.string,$3.list);
115 key : STRING
117 $$.string = $1.string;
121 /*----------------------- Program Section --------------------------------*/
123 /*************************************************************************/
124 void
125 Pk11Install_yyerror(char *message)
127 char *tmp;
128 if(Pk11Install_yyerrstr) {
129 tmp=PR_smprintf("%sline %d: %s\n", Pk11Install_yyerrstr,
130 Pk11Install_yylinenum, message);
131 PR_smprintf_free(Pk11Install_yyerrstr);
132 } else {
133 tmp = PR_smprintf("line %d: %s\n", Pk11Install_yylinenum, message);
135 Pk11Install_yyerrstr=tmp;