1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/cmd/modutil/installparse.y Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,104 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +/* yacc file for parsing PKCS #11 module installation instructions */ 1.9 +/*------------------------ Definition Section ---------------------------*/ 1.10 + 1.11 +%{ 1.12 +#define yyparse Pk11Install_yyparse 1.13 +#define yylex Pk11Install_yylex 1.14 +#define yyerror Pk11Install_yyerror 1.15 +#define yychar Pk11Install_yychar 1.16 +#define yyval Pk11Install_yyval 1.17 +#define yylval Pk11Install_yylval 1.18 +#define yydebug Pk11Install_yydebug 1.19 +#define yynerrs Pk11Install_yynerrs 1.20 +#define yyerrflag Pk11Install_yyerrflag 1.21 +#define yyss Pk11Install_yyss 1.22 +#define yyssp Pk11Install_yyssp 1.23 +#define yyvs Pk11Install_yyvs 1.24 +#define yyvsp Pk11Install_yyvsp 1.25 +#define yylhs Pk11Install_yylhs 1.26 +#define yylen Pk11Install_yylen 1.27 +#define yydefred Pk11Install_yydefred 1.28 +#define yydgoto Pk11Install_yydgoto 1.29 +#define yysindex Pk11Install_yysindex 1.30 +#define yyrindex Pk11Install_yyrindex 1.31 +#define yygindex Pk11Install_yygindex 1.32 +#define yytable Pk11Install_yytable 1.33 +#define yycheck Pk11Install_yycheck 1.34 +#define yyname Pk11Install_yyname 1.35 +#define yyrule Pk11Install_yyrule 1.36 + 1.37 +/* C Stuff */ 1.38 +#include "install-ds.h" 1.39 +#include <prprf.h> 1.40 + 1.41 +#define YYSTYPE Pk11Install_Pointer 1.42 +extern char *Pk11Install_yytext; 1.43 +char *Pk11Install_yyerrstr=NULL; 1.44 + 1.45 +%} 1.46 + 1.47 +/* Tokens */ 1.48 +%token OPENBRACE 1.49 +%token CLOSEBRACE 1.50 +%token STRING 1.51 +%start toplist 1.52 + 1.53 +%% 1.54 + 1.55 +/*--------------------------- Productions -------------------------------*/ 1.56 + 1.57 +toplist : valuelist 1.58 +{ 1.59 + Pk11Install_valueList = $1.list; 1.60 +} 1.61 + 1.62 +valuelist : value valuelist 1.63 +{ 1.64 + Pk11Install_ValueList_AddItem($2.list,$1.value); 1.65 + $$.list = $2.list; 1.66 +} 1.67 +| 1.68 +{ 1.69 + $$.list = Pk11Install_ValueList_new(); 1.70 +}; 1.71 + 1.72 +value : key_value_pair 1.73 +{ 1.74 + $$.value= Pk11Install_Value_new(PAIR_VALUE,$1); 1.75 +} 1.76 +| STRING 1.77 +{ 1.78 + $$.value= Pk11Install_Value_new(STRING_VALUE, $1); 1.79 +}; 1.80 + 1.81 +key_value_pair : key OPENBRACE valuelist CLOSEBRACE 1.82 +{ 1.83 + $$.pair = Pk11Install_Pair_new($1.string,$3.list); 1.84 +}; 1.85 + 1.86 +key : STRING 1.87 +{ 1.88 + $$.string = $1.string; 1.89 +}; 1.90 + 1.91 +%% 1.92 +/*----------------------- Program Section --------------------------------*/ 1.93 + 1.94 +/*************************************************************************/ 1.95 +void 1.96 +Pk11Install_yyerror(char *message) 1.97 +{ 1.98 + char *tmp; 1.99 + if(Pk11Install_yyerrstr) { 1.100 + tmp=PR_smprintf("%sline %d: %s\n", Pk11Install_yyerrstr, 1.101 + Pk11Install_yylinenum, message); 1.102 + PR_smprintf_free(Pk11Install_yyerrstr); 1.103 + } else { 1.104 + tmp = PR_smprintf("line %d: %s\n", Pk11Install_yylinenum, message); 1.105 + } 1.106 + Pk11Install_yyerrstr=tmp; 1.107 +}