/[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 1070 - (show annotations) (download)
Tue Nov 10 09:34:50 2009 UTC (12 years, 2 months ago) by aramv
File size: 2782 byte(s)
Added logic to clean up old versions of flex, added some comments to the evaluation manager callbacks
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 var_list: var
34 | var_list var
35 ;
36
37 var: TERM '=' string { add_variable($1, $3); }
38 | TERM '=' TERM { add_variable($1, $3); }
39 | PVAR '=' path '\n' { set_modules_path($3); }
40 | PVAR '=' { eef_log(LOG_NOTICE, "No value assigned to path. Using %s as path instead.", get_pdl_path()); printf("Geen path gevonden!\n"); }
41 /*
42 | TERM '=' { eef_log(LOG_ERR, "No value assigned to %s.", $1->string); }
43 | TERM { eef_log(LOG_ERR, "Found a non classified term: %s.", $1->string); }
44 */
45 ;
46
47 string: STRING { $$ = $1; }
48 | string STRING { $$ = concat_strings_with_space($1, $2); }
49 ;
50
51 path: PATH { $$ = $1; }
52 | path PATH { $$ = concat_strings($1, $2); }
53 ;
54
55 policy_list: LABEL policy { add_policy($1, $2); }
56 | policy_list LABEL policy { add_policy($2, $3); }
57 | policy_list LABEL { eef_log(LOG_WARNING, "expecting rule definitions.");
58 eef_log(LOG_WARNING, "no rules specified for policy: '%s' at line %d.", $2->string, $2->lineno);
59 remove_policy($2);
60 }
61 | LABEL { eef_log(LOG_WARNING, "expecting rule definitions.");
62 eef_log(LOG_WARNING, "no rules specified for policy: '%s' at line %d.", $1->string, $1->lineno);
63 remove_policy($1);
64 }
65 ;
66
67 policy: rule { $$ = $1; }
68 | policy rule { $$ = $1; }
69 ;
70
71 rule: TERM TRANS TERM { $$ = add_rule($1, $3, NULL); }
72 | TERM TRANS TERM '|' TERM { $$ = add_rule($1, $3, $5); }
73 | '~' TERM TRANS TERM { $$ = add_rule($2, NULL, $4); }
74 ;
75
76 %%
77
78 void set_yylval(record_t* r) {
79 yylval.record = r;
80 }

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