Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | /* yacc file for parsing PKCS #11 module installation instructions */ |
michael@0 | 6 | /*------------------------ Definition Section ---------------------------*/ |
michael@0 | 7 | |
michael@0 | 8 | %{ |
michael@0 | 9 | #define yyparse Pk11Install_yyparse |
michael@0 | 10 | #define yylex Pk11Install_yylex |
michael@0 | 11 | #define yyerror Pk11Install_yyerror |
michael@0 | 12 | #define yychar Pk11Install_yychar |
michael@0 | 13 | #define yyval Pk11Install_yyval |
michael@0 | 14 | #define yylval Pk11Install_yylval |
michael@0 | 15 | #define yydebug Pk11Install_yydebug |
michael@0 | 16 | #define yynerrs Pk11Install_yynerrs |
michael@0 | 17 | #define yyerrflag Pk11Install_yyerrflag |
michael@0 | 18 | #define yyss Pk11Install_yyss |
michael@0 | 19 | #define yyssp Pk11Install_yyssp |
michael@0 | 20 | #define yyvs Pk11Install_yyvs |
michael@0 | 21 | #define yyvsp Pk11Install_yyvsp |
michael@0 | 22 | #define yylhs Pk11Install_yylhs |
michael@0 | 23 | #define yylen Pk11Install_yylen |
michael@0 | 24 | #define yydefred Pk11Install_yydefred |
michael@0 | 25 | #define yydgoto Pk11Install_yydgoto |
michael@0 | 26 | #define yysindex Pk11Install_yysindex |
michael@0 | 27 | #define yyrindex Pk11Install_yyrindex |
michael@0 | 28 | #define yygindex Pk11Install_yygindex |
michael@0 | 29 | #define yytable Pk11Install_yytable |
michael@0 | 30 | #define yycheck Pk11Install_yycheck |
michael@0 | 31 | #define yyname Pk11Install_yyname |
michael@0 | 32 | #define yyrule Pk11Install_yyrule |
michael@0 | 33 | |
michael@0 | 34 | /* C Stuff */ |
michael@0 | 35 | #include "install-ds.h" |
michael@0 | 36 | #include <prprf.h> |
michael@0 | 37 | |
michael@0 | 38 | #define YYSTYPE Pk11Install_Pointer |
michael@0 | 39 | extern char *Pk11Install_yytext; |
michael@0 | 40 | char *Pk11Install_yyerrstr=NULL; |
michael@0 | 41 | |
michael@0 | 42 | %} |
michael@0 | 43 | |
michael@0 | 44 | /* Tokens */ |
michael@0 | 45 | %token OPENBRACE |
michael@0 | 46 | %token CLOSEBRACE |
michael@0 | 47 | %token STRING |
michael@0 | 48 | %start toplist |
michael@0 | 49 | |
michael@0 | 50 | %% |
michael@0 | 51 | |
michael@0 | 52 | /*--------------------------- Productions -------------------------------*/ |
michael@0 | 53 | |
michael@0 | 54 | toplist : valuelist |
michael@0 | 55 | { |
michael@0 | 56 | Pk11Install_valueList = $1.list; |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | valuelist : value valuelist |
michael@0 | 60 | { |
michael@0 | 61 | Pk11Install_ValueList_AddItem($2.list,$1.value); |
michael@0 | 62 | $$.list = $2.list; |
michael@0 | 63 | } |
michael@0 | 64 | | |
michael@0 | 65 | { |
michael@0 | 66 | $$.list = Pk11Install_ValueList_new(); |
michael@0 | 67 | }; |
michael@0 | 68 | |
michael@0 | 69 | value : key_value_pair |
michael@0 | 70 | { |
michael@0 | 71 | $$.value= Pk11Install_Value_new(PAIR_VALUE,$1); |
michael@0 | 72 | } |
michael@0 | 73 | | STRING |
michael@0 | 74 | { |
michael@0 | 75 | $$.value= Pk11Install_Value_new(STRING_VALUE, $1); |
michael@0 | 76 | }; |
michael@0 | 77 | |
michael@0 | 78 | key_value_pair : key OPENBRACE valuelist CLOSEBRACE |
michael@0 | 79 | { |
michael@0 | 80 | $$.pair = Pk11Install_Pair_new($1.string,$3.list); |
michael@0 | 81 | }; |
michael@0 | 82 | |
michael@0 | 83 | key : STRING |
michael@0 | 84 | { |
michael@0 | 85 | $$.string = $1.string; |
michael@0 | 86 | }; |
michael@0 | 87 | |
michael@0 | 88 | %% |
michael@0 | 89 | /*----------------------- Program Section --------------------------------*/ |
michael@0 | 90 | |
michael@0 | 91 | /*************************************************************************/ |
michael@0 | 92 | void |
michael@0 | 93 | Pk11Install_yyerror(char *message) |
michael@0 | 94 | { |
michael@0 | 95 | char *tmp; |
michael@0 | 96 | if(Pk11Install_yyerrstr) { |
michael@0 | 97 | tmp=PR_smprintf("%sline %d: %s\n", Pk11Install_yyerrstr, |
michael@0 | 98 | Pk11Install_yylinenum, message); |
michael@0 | 99 | PR_smprintf_free(Pk11Install_yyerrstr); |
michael@0 | 100 | } else { |
michael@0 | 101 | tmp = PR_smprintf("line %d: %s\n", Pk11Install_yylinenum, message); |
michael@0 | 102 | } |
michael@0 | 103 | Pk11Install_yyerrstr=tmp; |
michael@0 | 104 | } |