/[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 526 - (show annotations) (download)
Wed Jul 15 09:15:06 2009 UTC (12 years, 10 months ago) by aramv
File size: 3956 byte(s)
Added pdl yacc/lex files
1 /*
2 * Copyright (c) Members of the EGEE Collaboration. 2004.
3 * See http://eu-egee.org/partners/ for details on the copyright holders.
4 * For license conditions see the license file or
5 * http://eu-egee.org/license.html
6 */
7
8 /*
9 * Copyright (c) 2003 EU DataGrid http://www.eu-datagrid.org/
10 *
11 * $Id: pdl_yacc.y,v 1.12 2004/10/13 16:37:58 msteenba Exp $
12 *
13 * Copyright (c) 2003 by
14 * G.M. Venekamp <venekamp@nikhef.nl>
15 * NIKHEF Amsterdam, the Netherlands
16 *
17 * This software is distributed under a BSD-style open source
18 * licence. For a complete description of the licence take a look
19 * at: http://eu-datagrid.web.cern.ch/eu-datagrid/license.html
20 *
21 */
22
23
24 %{
25 /*
26 * Copyright (c) 2002 EU DataGrid http://www.eu-datagrid.org/
27 *
28 *
29 * Author: G.M. Venekamp (venekamp@nikhef.nl)
30 *
31 *
32 * This software is distributed under a BSD-style open source
33 * licence. For a complete description of the licence take a look
34 * at: http://eu-datagrid.web.cern.ch/eu-datagrid/license.html
35 *
36 */
37
38
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <string.h>
42 #include <syslog.h>
43 #include "pdl.h"
44 #include "ng_log.h"
45
46 %}
47
48 %union {
49 record_t* record;
50 rule_t* rule;
51 };
52
53 %token<record> LABEL TERM TRANS EMPTYLINE COMMENT PVAR PATH STRING
54 %type<record> config var_list var path policy_list string
55 %type<rule> policy rule;
56
57 %token_table
58
59 %nonassoc LABEL
60
61 %%
62
63 config: /* empty */ { ng_log(LOG_WARNING, "Config file is empty."); }
64 | var_list policy_list
65 | policy_list
66 | var_list { ng_log(LOG_ERR, "Config file contains no policy rules.");
67 yyerror("Empty config file");
68 }
69 ;
70
71 var_list: var
72 | var_list var
73 ;
74
75 var: TERM '=' string { add_variable($1, $3); free($3); }
76 | TERM '=' TERM { add_variable($1, $3); free($3); }
77 | PVAR '=' path '\n' { set_path($3); free($3); }
78 | PVAR '=' { ng_log(LOG_ERR, "No value assigned to path. Using %s as path instead.", pdl_path()); }
79 /*
80 | TERM '=' { ng_log(LOG_ERR, "No value assigned to %s.", $1->string); }
81 | TERM { ng_log(LOG_ERR, "Found a non classified term: %s.", $1->string); }
82 */
83 ;
84
85 string: STRING { $$ = $1; }
86 | string STRING { $$ = concat_strings($1, $2); free($2); }
87 ;
88
89 path: PATH { $$ = $1; }
90 | path PATH { $$ = concat_strings($1, $2); free($2); }
91 ;
92
93 policy_list: LABEL policy { add_policy($1, $2); }
94 | policy_list LABEL policy { add_policy($2, $3); }
95 | policy_list LABEL { ng_log(LOG_WARNING, "expecting rule definitions.");
96 ng_log(LOG_WARNING, "no rules specified for policy: '%s' at line %d.", $2->string, $2->lineno);
97 remove_policy($2);
98 }
99 | LABEL { ng_log(LOG_WARNING, "expecting rule definitions.");
100 ng_log(LOG_WARNING, "no rules specified for policy: '%s' at line %d.", $1->string, $1->lineno);
101 remove_policy($1);
102 }
103 ;
104
105 policy: rule { $$ = $1; }
106 | policy rule { $$ = $1; }
107 ;
108
109 rule: TERM TRANS TERM { $$ = add_rule($1, $3, 0); }
110 | TERM TRANS TERM '|' TERM { $$ = add_rule($1, $3, $5); }
111 | '~' TERM TRANS TERM { $$ = add_rule($2, 0, $4); }
112 ;
113
114 %%
115
116 void set_yylval(record_t* r) {
117 yylval.record = r;
118 }

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