/[pdpsoft]/trunk/grid-mw-security/ees/src/eval_man/pdl_yacc.y
ViewVC logotype

Contents of /trunk/grid-mw-security/ees/src/eval_man/pdl_yacc.y

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1615 - (show annotations) (download)
Thu Apr 8 12:05:24 2010 UTC (12 years, 1 month ago) by aramv
File size: 2881 byte(s)
Added logging code from external CGUL snippets library. Added svn revision as (intermediate) version string
1 %{
2
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
6 #include <syslog.h>
7 #include "pdl.h"
8 #include "eef_log.h"
9
10 %}
11
12 %union {
13 record_t* record;
14 rule_t* rule;
15 };
16
17 %token<record> LABEL TERM TRANS EMPTYLINE COMMENT PVAR PATH STRING
18 %type<record> config var_list var path policy_list string
19 %type<rule> policy rule;
20
21 %token_table
22
23 %nonassoc LABEL
24
25 %%
26
27 config: /* empty */ { EEF_log(LOG_WARNING, "Config file is empty."); }
28 | var_list policy_list
29 | policy_list
30 | var_list { EEF_log(LOG_ERR, "Config file contains no policy rules."); }
31 ;
32
33
34 var_list: var
35 | var_list var
36 ;
37
38 var: TERM '=' string { add_variable($1, $3); }
39 | TERM '=' TERM { add_variable($1, $3); }
40 | PVAR '=' path '\n' { set_pdl_path($3); }
41 | PVAR '=' { EEF_log(LOG_NOTICE, "No value assigned to path. Using %s as path instead.", get_pdl_path()); }
42 /*
43 | TERM '=' { eef_log(LOG_ERR, "No value assigned to %s.", $1->string); }
44 | TERM { eef_log(LOG_ERR, "Found a non classified term: %s.", $1->string); }
45 */
46 ;
47
48 string: STRING { $$ = $1; }
49 | string STRING { $$ = concat_strings_with_space($1, $2); }
50 ;
51
52 path: PATH { $$ = $1; }
53 | path PATH { $$ = concat_strings($1, $2); }
54 ;
55
56 policy_list: LABEL policy { add_policy($1, $2); }
57 | policy_list LABEL policy { add_policy($2, $3); }
58 | policy_list LABEL { EEF_log(LOG_WARNING, "expecting rule definitions.");
59 EEF_log(LOG_WARNING, "no rules specified for policy: '%s' at line %d.", $2->string, $2->lineno);
60 remove_policy($2);
61 }
62 | LABEL { EEF_log(LOG_WARNING, "expecting rule definitions.");
63 EEF_log(LOG_WARNING, "no rules specified for policy: '%s' at line %d.", $1->string, $1->lineno);
64 remove_policy($1);
65 }
66 ;
67
68 policy: rule { $$ = $1; }
69 | policy rule { $$ = $1; }
70 ;
71
72 rule: TERM { $$ = add_rule($1, NULL, NULL); }
73 | TERM TRANS TERM { $$ = add_rule($1, $3, NULL); }
74 | TERM TRANS TERM '|' TERM { $$ = add_rule($1, $3, $5); }
75 | '~' TERM TRANS TERM { $$ = add_rule($2, NULL, $4); }
76 ;
77
78 %%
79
80 void set_yylval(record_t* r) {
81 yylval.record = r;
82 }

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28