1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
/*
* Copyright (c) 2002-2011 Balabit
* Copyright (c) 1998-2011 Balázs Scheidler
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* As an additional exemption you are allowed to compile & link against the
* OpenSSL libraries as published by the OpenSSL project. See the file
* COPYING for details.
*
*/
%code requires {
#pragma GCC diagnostic ignored "-Wswitch-default"
#include "block-ref-parser.h"
#include <string.h>
}
%define api.prefix {block_ref_}
%lex-param {CfgLexer *lexer}
%parse-param {CfgLexer *lexer}
%parse-param {CfgArgs **result}
%parse-param {gpointer arg}
/* INCLUDE_DECLS */
%%
start
: { *result = cfg_args_new(); } block_args { YYACCEPT; }
;
block_args
: driver_like_context '(' driver_block_args ')'
| function_like_context '(' function_block_args ')'
;
driver_like_context
: LL_CONTEXT_ROOT
| LL_CONTEXT_DESTINATION
| LL_CONTEXT_SOURCE
| LL_CONTEXT_PARSER
| LL_CONTEXT_REWRITE
| LL_CONTEXT_FILTER
| LL_CONTEXT_LOG
| LL_CONTEXT_INNER_DEST
| LL_CONTEXT_INNER_SRC
| LL_CONTEXT_OPTIONS
;
function_like_context
: LL_CONTEXT_FILTERX
;
/* generator(arg1(value) arg2(value)...) */
driver_block_args
: driver_block_arg driver_block_args
|
;
driver_block_arg
: LL_IDENTIFIER _block_arg_context_push LL_BLOCK _block_arg_context_pop { cfg_args_set(*result, $1, $3); free($1); free($3); }
;
/* generator(arg1=value, arg2=value, ...) */
function_block_args
: function_block_arg ',' function_block_args
| function_block_arg
|
;
function_block_arg
: LL_IDENTIFIER KW_ASSIGN _block_func_arg_context_push LL_BLOCK _block_func_arg_context_pop
{
cfg_args_set(*result, $1, $4); free($1); free($4);
}
;
/* INCLUDE_RULES */
%%
|