0001 /**
0002 * @brief Migrate tuxedo ubb config, parser
0003 *
0004 * @file ubb.y
0005 */
0006 /* -----------------------------------------------------------------------------
0007 * Enduro/X Middleware Platform for Distributed Transaction Processing
0008 * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0009 * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0010 * This software is released under one of the following licenses:
0011 * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0012 * See LICENSE file for full text.
0013 * -----------------------------------------------------------------------------
0014 * AGPL license:
0015 *
0016 * This program is free software; you can redistribute it and/or modify it under
0017 * the terms of the GNU Affero General Public License, version 3 as published
0018 * by the Free Software Foundation;
0019 *
0020 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0021 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0022 * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0023 * for more details.
0024 *
0025 * You should have received a copy of the GNU Affero General Public License along
0026 * with this program; if not, write to the Free Software Foundation, Inc.,
0027 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0028 *
0029 * -----------------------------------------------------------------------------
0030 * A commercial use license is available from Mavimax, Ltd
0031 * contact@mavimax.com
0032 * -----------------------------------------------------------------------------
0033 */
0034
0035 /* %define api.prefix {ubb}*/
0036 %name-prefix "ubb"
0037
0038 %{
0039 #include <stdio.h>
0040 #include <stdlib.h>
0041 #include <ndebug.h>
0042 #include "ubb.h"
0043
0044 extern int ubblex (void);
0045 %}
0046
0047 %union {
0048 char *val;
0049 }
0050
0051 /* declare tokens */
0052 %token EOL
0053 %token SECTION /**< section name */
0054 %token EQUAL /**< equal sign */
0055 %token COMMA /**< comma in option */
0056 %token OPTION /**< option name */
0057 %token DEFAULT /**< default symbol */
0058 %token RESOURCES /**< resources sect */
0059
0060 %start ubb_loop
0061
0062 %type <val> OPTION
0063 %type <val> SECTION
0064 %type <val> DEFAULT
0065
0066
0067 %destructor { NDRX_FREE($$); } <*>
0068
0069 %locations
0070
0071 %%
0072 res_opt_arg:
0073 OPTION {if (EXSUCCEED!=ubb_add_val($1)) {YYERROR;}}
0074 | res_opt_arg COMMA OPTION {if (EXSUCCEED!=ubb_add_val($3)) {YYERROR;} }
0075 ;
0076
0077 resource_loop:
0078 RESOURCES
0079 | resource_loop OPTION res_opt_arg {if (EXSUCCEED!=ubb_add_res_parm($2)) {YYERROR;} }
0080 ;
0081
0082 opt_add:
0083 OPTION {if (EXSUCCEED!=ubb_add_val($1)) {YYERROR;} }
0084 | opt_add COMMA OPTION {if (EXSUCCEED!=ubb_add_val($3)) {YYERROR;} }
0085 ;
0086 opt:
0087 OPTION {if (EXSUCCEED!=ubb_add_sect_parm($1)) {YYERROR;} }
0088 | DEFAULT {if (EXSUCCEED!=ubb_add_sect_parm($1)) {YYERROR;} }
0089 | OPTION EQUAL opt_add {if (EXSUCCEED!=ubb_add_sect_keyw($1)) {YYERROR;} }
0090
0091 section_loop:
0092 SECTION {if (EXSUCCEED!=ubb_add_sect($1)) {YYERROR;} }
0093 | section_loop opt
0094 ;
0095
0096 ubb_loop:
0097 resource_loop
0098 | ubb_loop section_loop
0099 | ubb_loop EOL
0100 ;
0101 ;
0102
0103 %%
0104
0105 /* vim: set ts=4 sw=4 et smartindent: */