Support more keywords.
[jelmer/libpolicy.git] / parse_adm.y
1 /* 
2    Unix SMB/CIFS implementation.
3    Copyright (C) 2006 Wilco Baan Hofman <wilco@baanhofman.nl>
4    Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org>
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20    For more information on the .ADM file format:
21    http://msdn2.microsoft.com/en-us/library/aa372405.aspx 
22 */
23
24 %{
25 #include "config.h"
26 void error_message (const char *format, ...);
27 int yyparse (void);
28 void yyerror (const char *s);
29 extern int yylex (void);
30
31 %}
32
33 %union {
34         char *text;
35         int integer;
36 }
37
38 %token CATEGORY
39 %token CLASS
40 %token CLASS_USER
41 %token CLASS_MACHINE
42 %token POLICY
43 %token KEYNAME
44 %token EXPLAIN
45 %token VALUENAME
46 %token VALUEON VALUEOFF
47 %token PART
48 %token ITEMLIST
49 %token NAME
50 %token VALUE VALUEPREFIX
51 %token NUMERIC EDITTEXT TEXT DROPDOWNLIST CHECKBOX LISTBOX
52 %token MINIMUM MAXIMUM DEFAULT
53 %token END
54 %token ACTIONLIST ACTIONLISTON ACTIONLISTOFF
55 %token EXPLICITVALUE
56 %token DEL
57 %token SUPPORTED
58 %token <text> LITERAL
59 %token <integer> INTEGER
60 %token <text> LOOKUPLITERAL
61 %token CLIENTEXT
62 %token REQUIRED
63 %token NOSORT ADDITIVE
64 %token MAXLEN
65 %token SPIN
66 %token <text> EQUALS
67 %token <text> SECTION
68 %token <text> IF
69 %token ENDIF
70 %token TXTCONVERT
71 %token DEFCHECKED EXPANDABLETEXT
72
73 %start admfile
74
75 %% 
76
77 admfile: classes sections;
78
79 classes: /* empty */ | class classes;
80
81 class: CLASS classvalue categories;
82 classvalue: CLASS_USER|CLASS_MACHINE;
83
84 categories: /* empty */ | category categories;
85
86 string: LITERAL | LOOKUPLITERAL;
87
88 category: CATEGORY string categoryitems END CATEGORY;
89
90 categoryitem: explain | category | policy | keyname;
91 categoryitems: categoryitem categoryitems | /* empty */ ;
92
93 policy: POLICY string policyitems END POLICY;
94 policyitem: explain | keyname | valuename | valueon | valueoff | min | max | defaultvalue | supported | part | DEFCHECKED | actionliston | actionlistoff | EXPLICITVALUE | valueprefix | clientext | NOSORT | ADDITIVE | maxlen | EXPANDABLETEXT | TXTCONVERT;
95 policyitems: policyitem policyitems | /* empty */;
96
97 valuetype: NUMERIC | EDITTEXT | TEXT | DROPDOWNLIST | CHECKBOX | LISTBOX;
98
99 part: PART string valuetype partitems END PART;
100
101 spin: SPIN INTEGER;
102
103 partitem: keyname | valuename | valueon | valueoff | min | max | defaultvalue | itemlist | REQUIRED | spin | DEFCHECKED | actionliston | actionlistoff | EXPLICITVALUE | valueprefix | clientext | NOSORT | ADDITIVE | maxlen | EXPANDABLETEXT |TXTCONVERT;
104 partitems: partitem partitems | /* empty */;
105
106 clientext: CLIENTEXT LITERAL;
107 maxlen: MAXLEN INTEGER;
108 min: MINIMUM INTEGER;
109 max: MAXIMUM INTEGER;
110 defaultvalue: DEFAULT INTEGER | DEFAULT LOOKUPLITERAL | DEFAULT LITERAL;
111
112 explain: EXPLAIN string;
113 value: DEL | INTEGER | NUMERIC INTEGER | LITERAL | LOOKUPLITERAL;
114
115 valueon: VALUEON value;
116 valueoff: VALUEOFF value;
117 valueprefix: VALUEPREFIX LITERAL;
118
119 valuename: VALUENAME string;
120 keyname: KEYNAME string;
121
122 itemlist: ITEMLIST items END ITEMLIST;
123 itemname: NAME string;
124 itemvalue: VALUE value;
125
126 item: itemname | itemvalue | DEFAULT | actionlist;
127 items: /* empty */ | item items;
128
129 supported: SUPPORTED string;
130
131 actionlist: ACTIONLIST actions END ACTIONLIST;
132 actionliston: ACTIONLISTON actions END ACTIONLISTON; 
133 actionlistoff: ACTIONLISTOFF actions END ACTIONLISTOFF; 
134 actions: keyname actions | valuename actions | itemvalue actions | /* empty */;
135
136 variable: LITERAL EQUALS;
137 variables: variable variables | /* empty */;
138 sections: section sections | /* empty */;
139 section: SECTION variables;
140
141 %%
142
143 void
144 yyerror (const char *s)
145 {
146      error_message ("%s\n", s);
147 }
148
149
150