-rw-r--r-- | scripts/kconfig/zconf.l | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 1471630..55517b2 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l | |||
@@ -91,30 +91,37 @@ n [A-Za-z0-9_] | |||
91 | "mainmenu" BEGIN(PARAM); return T_MAINMENU; | 91 | "mainmenu" BEGIN(PARAM); return T_MAINMENU; |
92 | "menu" BEGIN(PARAM); return T_MENU; | 92 | "menu" BEGIN(PARAM); return T_MENU; |
93 | "endmenu" BEGIN(PARAM); return T_ENDMENU; | 93 | "endmenu" BEGIN(PARAM); return T_ENDMENU; |
94 | "source" BEGIN(PARAM); return T_SOURCE; | 94 | "source" BEGIN(PARAM); return T_SOURCE; |
95 | "choice" BEGIN(PARAM); return T_CHOICE; | 95 | "choice" BEGIN(PARAM); return T_CHOICE; |
96 | "endchoice" BEGIN(PARAM); return T_ENDCHOICE; | 96 | "endchoice" BEGIN(PARAM); return T_ENDCHOICE; |
97 | "comment" BEGIN(PARAM); return T_COMMENT; | 97 | "comment" BEGIN(PARAM); return T_COMMENT; |
98 | "config" BEGIN(PARAM); return T_CONFIG; | 98 | "config" BEGIN(PARAM); return T_CONFIG; |
99 | "menuconfig" BEGIN(PARAM); return T_MENUCONFIG; | ||
99 | "help" BEGIN(PARAM); return T_HELP; | 100 | "help" BEGIN(PARAM); return T_HELP; |
100 | "if" BEGIN(PARAM); return T_IF; | 101 | "if" BEGIN(PARAM); return T_IF; |
101 | "endif" BEGIN(PARAM); return T_ENDIF; | 102 | "endif" BEGIN(PARAM); return T_ENDIF; |
102 | "depends" BEGIN(PARAM); return T_DEPENDS; | 103 | "depends" BEGIN(PARAM); return T_DEPENDS; |
103 | "requires" BEGIN(PARAM); return T_REQUIRES; | 104 | "requires" BEGIN(PARAM); return T_REQUIRES; |
104 | "optional" BEGIN(PARAM); return T_OPTIONAL; | 105 | "optional" BEGIN(PARAM); return T_OPTIONAL; |
105 | "default" BEGIN(PARAM); return T_DEFAULT; | 106 | "default" BEGIN(PARAM); return T_DEFAULT; |
106 | "prompt" BEGIN(PARAM); return T_PROMPT; | 107 | "prompt" BEGIN(PARAM); return T_PROMPT; |
107 | "tristate" BEGIN(PARAM); return T_TRISTATE; | 108 | "tristate" BEGIN(PARAM); return T_TRISTATE; |
109 | "def_tristate" BEGIN(PARAM); return T_DEF_TRISTATE; | ||
108 | "bool" BEGIN(PARAM); return T_BOOLEAN; | 110 | "bool" BEGIN(PARAM); return T_BOOLEAN; |
109 | "boolean" BEGIN(PARAM); return T_BOOLEAN; | 111 | "boolean" BEGIN(PARAM); return T_BOOLEAN; |
112 | "def_bool" BEGIN(PARAM); return T_DEF_BOOLEAN; | ||
113 | "def_boolean" BEGIN(PARAM); return T_DEF_BOOLEAN; | ||
110 | "int" BEGIN(PARAM); return T_INT; | 114 | "int" BEGIN(PARAM); return T_INT; |
111 | "hex" BEGIN(PARAM); return T_HEX; | 115 | "hex" BEGIN(PARAM); return T_HEX; |
112 | "string" BEGIN(PARAM); return T_STRING; | 116 | "string" BEGIN(PARAM); return T_STRING; |
117 | "select" BEGIN(PARAM); return T_SELECT; | ||
118 | "enable" BEGIN(PARAM); return T_SELECT; | ||
119 | "range" BEGIN(PARAM); return T_RANGE; | ||
113 | {n}+{ | 120 | {n}+{ |
114 | alloc_string(yytext, yyleng); | 121 | alloc_string(yytext, yyleng); |
115 | zconflval.string = text; | 122 | zconflval.string = text; |
116 | return T_WORD; | 123 | return T_WORD; |
117 | } | 124 | } |
118 | . | 125 | . |
119 | \ncurrent_file->lineno++; BEGIN(INITIAL); | 126 | \ncurrent_file->lineno++; BEGIN(INITIAL); |
120 | } | 127 | } |
@@ -136,45 +143,46 @@ n [A-Za-z0-9_] | |||
136 | } | 143 | } |
137 | \nBEGIN(INITIAL); current_file->lineno++; return T_EOL; | 144 | \nBEGIN(INITIAL); current_file->lineno++; return T_EOL; |
138 | ---/* ignore */ | 145 | ---/* ignore */ |
139 | ({n}|[-/.])+{ | 146 | ({n}|[-/.])+{ |
140 | alloc_string(yytext, yyleng); | 147 | alloc_string(yytext, yyleng); |
141 | zconflval.string = text; | 148 | zconflval.string = text; |
142 | return T_WORD; | 149 | return T_WORD; |
143 | } | 150 | } |
151 | #.*/* comment */ | ||
144 | \\\ncurrent_file->lineno++; | 152 | \\\ncurrent_file->lineno++; |
145 | . | 153 | . |
146 | <<EOF>> { | 154 | <<EOF>> { |
147 | BEGIN(INITIAL); | 155 | BEGIN(INITIAL); |
148 | } | 156 | } |
149 | } | 157 | } |
150 | 158 | ||
151 | <STRING>{ | 159 | <STRING>{ |
152 | [^'"\\\n]+/\n{ | 160 | [^'"\\\n]+/\n{ |
153 | append_string(yytext, yyleng); | 161 | append_string(yytext, yyleng); |
154 | zconflval.string = text; | 162 | zconflval.string = text; |
155 | return T_STRING; | 163 | return T_WORD_QUOTE; |
156 | } | 164 | } |
157 | [^'"\\\n]+{ | 165 | [^'"\\\n]+{ |
158 | append_string(yytext, yyleng); | 166 | append_string(yytext, yyleng); |
159 | } | 167 | } |
160 | \\.?/\n{ | 168 | \\.?/\n{ |
161 | append_string(yytext + 1, yyleng - 1); | 169 | append_string(yytext + 1, yyleng - 1); |
162 | zconflval.string = text; | 170 | zconflval.string = text; |
163 | return T_STRING; | 171 | return T_WORD_QUOTE; |
164 | } | 172 | } |
165 | \\.?{ | 173 | \\.?{ |
166 | append_string(yytext + 1, yyleng - 1); | 174 | append_string(yytext + 1, yyleng - 1); |
167 | } | 175 | } |
168 | \'|\"{ | 176 | \'|\"{ |
169 | if (str == yytext[0]) { | 177 | if (str == yytext[0]) { |
170 | BEGIN(PARAM); | 178 | BEGIN(PARAM); |
171 | zconflval.string = text; | 179 | zconflval.string = text; |
172 | return T_STRING; | 180 | return T_WORD_QUOTE; |
173 | } else | 181 | } else |
174 | append_string(yytext, 1); | 182 | append_string(yytext, 1); |
175 | } | 183 | } |
176 | \n{ | 184 | \n{ |
177 | printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); | 185 | printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); |
178 | current_file->lineno++; | 186 | current_file->lineno++; |
179 | BEGIN(INITIAL); | 187 | BEGIN(INITIAL); |
180 | return T_EOL; | 188 | return T_EOL; |
@@ -201,19 +209,18 @@ n [A-Za-z0-9_] | |||
201 | } | 209 | } |
202 | ts -= first_ts; | 210 | ts -= first_ts; |
203 | while (ts > 8) { | 211 | while (ts > 8) { |
204 | append_string(" ", 8); | 212 | append_string(" ", 8); |
205 | ts -= 8; | 213 | ts -= 8; |
206 | } | 214 | } |
207 | append_string(" ", ts); | 215 | append_string(" ", ts); |
208 | } | 216 | } |
209 | |||
210 | } | 217 | } |
211 | \n/[^ \t\n] { | 218 | [ \t]*\n/[^ \t\n] { |
212 | current_file->lineno++; | 219 | current_file->lineno++; |
213 | zconf_endhelp(); | 220 | zconf_endhelp(); |
214 | return T_HELPTEXT; | 221 | return T_HELPTEXT; |
215 | } | 222 | } |
216 | [ \t]*\n{ | 223 | [ \t]*\n{ |
217 | current_file->lineno++; | 224 | current_file->lineno++; |
218 | append_string("\n", 1); | 225 | append_string("\n", 1); |
219 | } | 226 | } |
@@ -243,21 +250,21 @@ void zconf_starthelp(void) | |||
243 | new_string(); | 250 | new_string(); |
244 | last_ts = first_ts = 0; | 251 | last_ts = first_ts = 0; |
245 | BEGIN(HELP); | 252 | BEGIN(HELP); |
246 | } | 253 | } |
247 | 254 | ||
248 | static void zconf_endhelp(void) | 255 | static void zconf_endhelp(void) |
249 | { | 256 | { |
250 | zconflval.string = text; | 257 | zconflval.string = text; |
251 | BEGIN(INITIAL); | 258 | BEGIN(INITIAL); |
252 | } | 259 | } |
253 | 260 | ||
254 | 261 | ||
255 | /* | 262 | /* |
256 | * Try to open specified file with following names: | 263 | * Try to open specified file with following names: |
257 | * ./name | 264 | * ./name |
258 | * $(srctree)/name | 265 | * $(srctree)/name |
259 | * The latter is used when srctree is separate from objtree | 266 | * The latter is used when srctree is separate from objtree |
260 | * when compiling the kernel. | 267 | * when compiling the kernel. |
261 | * Return NULL if file is not found. | 268 | * Return NULL if file is not found. |
262 | */ | 269 | */ |
263 | FILE *zconf_fopen(const char *name) | 270 | FILE *zconf_fopen(const char *name) |
@@ -340,17 +347,17 @@ static struct buffer *zconf_endfile(void) | |||
340 | current_buf = parent; | 347 | current_buf = parent; |
341 | 348 | ||
342 | return parent; | 349 | return parent; |
343 | } | 350 | } |
344 | 351 | ||
345 | int zconf_lineno(void) | 352 | int zconf_lineno(void) |
346 | { | 353 | { |
347 | if (current_buf) | 354 | if (current_buf) |
348 | return current_file->lineno; | 355 | return current_file->lineno - 1; |
349 | else | 356 | else |
350 | return 0; | 357 | return 0; |
351 | } | 358 | } |
352 | 359 | ||
353 | char *zconf_curname(void) | 360 | char *zconf_curname(void) |
354 | { | 361 | { |
355 | if (current_buf) | 362 | if (current_buf) |
356 | return current_file->name; | 363 | return current_file->name; |