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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1615 - (hide 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 aramv 889 %{
2    
3 aramv 526 #include <stdio.h>
4     #include <stdlib.h>
5     #include <string.h>
6     #include <syslog.h>
7     #include "pdl.h"
8 aramv 810 #include "eef_log.h"
9 aramv 526
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 aramv 1615 config: /* empty */ { EEF_log(LOG_WARNING, "Config file is empty."); }
28 aramv 1076 | var_list policy_list
29     | policy_list
30 aramv 1615 | var_list { EEF_log(LOG_ERR, "Config file contains no policy rules."); }
31 aramv 526 ;
32    
33 aramv 1076
34     var_list: var
35     | var_list var
36 aramv 526 ;
37    
38 aramv 1076 var: TERM '=' string { add_variable($1, $3); }
39     | TERM '=' TERM { add_variable($1, $3); }
40 aramv 1142 | PVAR '=' path '\n' { set_pdl_path($3); }
41 aramv 1615 | PVAR '=' { EEF_log(LOG_NOTICE, "No value assigned to path. Using %s as path instead.", get_pdl_path()); }
42 aramv 1076 /*
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 aramv 526 ;
47    
48 aramv 1076 string: STRING { $$ = $1; }
49     | string STRING { $$ = concat_strings_with_space($1, $2); }
50 aramv 526 ;
51    
52 aramv 1076 path: PATH { $$ = $1; }
53     | path PATH { $$ = concat_strings($1, $2); }
54 aramv 526 ;
55    
56 aramv 1076 policy_list: LABEL policy { add_policy($1, $2); }
57     | policy_list LABEL policy { add_policy($2, $3); }
58 aramv 1615 | 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 aramv 526 remove_policy($2);
61     }
62 aramv 1615 | 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 aramv 526 remove_policy($1);
65 aramv 1076 }
66 aramv 526 ;
67    
68 aramv 1076 policy: rule { $$ = $1; }
69     | policy rule { $$ = $1; }
70 aramv 526 ;
71    
72 aramv 1575 rule: TERM { $$ = add_rule($1, NULL, NULL); }
73     | TERM TRANS TERM { $$ = add_rule($1, $3, NULL); }
74 aramv 1076 | TERM TRANS TERM '|' TERM { $$ = add_rule($1, $3, $5); }
75     | '~' TERM TRANS TERM { $$ = add_rule($2, NULL, $4); }
76 aramv 526 ;
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