2 Unix SMB/CIFS implementation.
3 Copyright (C) 2006 Wilco Baan Hofman <wilco@baanhofman.nl>
4 Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org>
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 2 of the License, or
9 (at your option) any later version.
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.
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.
24 #include "lib/policy/parse_adm.h"
25 void error_message (const char *format, ...);
28 static int lineno = 1;
29 static bool utf16 = false;
31 #define YY_INPUT(buf,result,max_size) \
35 if (fread(&v, 2, 1, yyin) < 1) \
38 result = push_codepoint(buf, v); \
41 result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \
49 ACTIONLIST { return ACTIONLIST; }
50 CATEGORY { return CATEGORY; }
51 CHECKBOX { return CHECKBOX; }
52 CLASS { return CLASS; }
53 DELETE { return DEL; }
54 DEFAULT { return DEFAULT; }
55 DROPDOWNLIST { return DROPDOWNLIST; }
56 EDITTEXT { return EDITTEXT; }
58 EXPLAIN { return EXPLAIN; }
59 ITEMLIST { return ITEMLIST; }
60 KEYNAME { return KEYNAME; }
61 MACHINE { return CLASS_MACHINE; }
62 MIN { return MINIMUM; }
63 MAX { return MAXIMUM; }
65 NUMERIC { return NUMERIC; }
67 POLICY { return POLICY; }
68 REQUIRED { return REQUIRED; }
70 SUPPORTED { return SUPPORTED; }
72 USER { return CLASS_USER; }
73 VALUE { return VALUE; }
74 VALUENAME { return VALUENAME; }
75 VALUEON { return VALUEON; }
76 VALUEOFF { return VALUEOFF; }
78 \[strings\] { return STRINGSSECTION; }
82 yylval.integer = strtol((const char *)yytext, &e, 0);
84 error_message("malformed constant (%s)", yytext);
89 [A-Za-z\\{}][{}\-\\A-Za-z0-9_]* {
90 yylval.text = strdup ((const char *)yytext);
94 "!!"[A-Za-z][-A-Za-z0-9_]* {
95 yylval.text = strdup ((const char *)yytext);
100 ;[^\n]*\n { lineno++; }
101 \"([^\n]+)\n { lineno++; yylval.text = strdup((const char *)yytext); return LITERAL; }
104 #ifndef yywrap /* XXX */
114 error_message (const char *format, ...)
118 va_start (args, format);
119 fprintf (stderr, "%d:", lineno);
120 vfprintf (stderr, format, args);
124 struct adm_file *adm_read_file(const char *file)
127 yyin = fopen(file, "r");
133 if (c[0] == 0xff && c[1] == 0xfe) {
141 return NULL; /* FIXME */