PageRenderTime 47ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/security/nss/cmd/modutil/installparse.y

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