author | Michael Krelin <hacker@klever.net> | 2005-04-25 16:36:32 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2005-04-25 16:36:32 (UTC) |
commit | 981b219f5297ad2ccc1fc1d0e24e41ec009c35a3 (patch) (unidiff) | |
tree | 9fa81d7fe70883ad26d946c902ba06edcebd4516 /lib/sitecing_parser.ll | |
parent | 54e344b7e3623e807b893b7febad3adfc6c1648f (diff) | |
download | sitecing-981b219f5297ad2ccc1fc1d0e24e41ec009c35a3.zip sitecing-981b219f5297ad2ccc1fc1d0e24e41ec009c35a3.tar.gz sitecing-981b219f5297ad2ccc1fc1d0e24e41ec009c35a3.tar.bz2 |
moved a few utility functions to konforka and bumped konforka version requirement accordingly
-rw-r--r-- | lib/sitecing_parser.ll | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/sitecing_parser.ll b/lib/sitecing_parser.ll index 4fd6709..8dd8d5f 100644 --- a/lib/sitecing_parser.ll +++ b/lib/sitecing_parser.ll | |||
@@ -1,21 +1,22 @@ | |||
1 | %{ | 1 | %{ |
2 | /* | 2 | /* |
3 | * XXX: I have a strong feeling that this parser should be completely rewritten. | 3 | * XXX: I have a strong feeling that this parser should be completely rewritten. |
4 | */ | 4 | */ |
5 | #include <iostream> | 5 | #include <iostream> |
6 | #include <fstream> | 6 | #include <fstream> |
7 | #include <cassert> | 7 | #include <cassert> |
8 | #include <stdexcept> | 8 | #include <stdexcept> |
9 | using namespace std; | 9 | using namespace std; |
10 | #include <konforka/util.h> | ||
10 | #include "sitecing/sitecing_util.h" | 11 | #include "sitecing/sitecing_util.h" |
11 | #include "sitecing/sitecing_exception.h" | 12 | #include "sitecing/sitecing_exception.h" |
12 | using namespace sitecing; | 13 | using namespace sitecing; |
13 | #define sitecing_parser_flexlexer_once | 14 | #define sitecing_parser_flexlexer_once |
14 | #include "sitecing/sitecing_parser.h" | 15 | #include "sitecing/sitecing_parser.h" |
15 | #include "sitecing/sitecing_enflesher.h" | 16 | #include "sitecing/sitecing_enflesher.h" |
16 | #undef yyFlexLexer | 17 | #undef yyFlexLexer |
17 | #define yyFlexLexer sitecing_parserFlexLexer | 18 | #define yyFlexLexer sitecing_parserFlexLexer |
18 | %} | 19 | %} |
19 | %x SLASHSTAR_COMMENT SLASHSLASH_COMMENT STRING | 20 | %x SLASHSTAR_COMMENT SLASHSLASH_COMMENT STRING |
20 | %x CODELINE CLASSLINE DECLLINE IMPLLINE DECLBLOCK IMPLBLOCK VARLINE VARINIT | 21 | %x CODELINE CLASSLINE DECLLINE IMPLLINE DECLBLOCK IMPLBLOCK VARLINE VARINIT |
21 | %x IMPORTLINE IMPORTCOMPONENT | 22 | %x IMPORTLINE IMPORTCOMPONENT |
@@ -288,26 +289,26 @@ NOIDCHAR [^A-Za-z0-9_] | |||
288 | \n{ | 289 | \n{ |
289 | modus_operandi& m = M(); | 290 | modus_operandi& m = M(); |
290 | string::size_type t = m.output.find_first_not_of(" \t"); | 291 | string::size_type t = m.output.find_first_not_of(" \t"); |
291 | if(t!=string::npos) | 292 | if(t!=string::npos) |
292 | m.output.erase(0,t); | 293 | m.output.erase(0,t); |
293 | t = m.output.find_last_not_of(" \t;"); | 294 | t = m.output.find_last_not_of(" \t;"); |
294 | if(t!=string::npos) | 295 | if(t!=string::npos) |
295 | m.output.erase(t+1); | 296 | m.output.erase(t+1); |
296 | if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') { | 297 | if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') { |
297 | m.output.erase(0,1); | 298 | m.output.erase(0,1); |
298 | m.output.erase(m.output.length()-1); | 299 | m.output.erase(m.output.length()-1); |
299 | } | 300 | } |
300 | string c = combine_path(component_basename,m.output); | 301 | string c = konforka::combine_path(component_basename,m.output); |
301 | member_variables.push_back(member_variable(m._type,m._name,normalize_path(c,strip_leading_slash),true)); | 302 | member_variables.push_back(member_variable(m._type,m._name,konforka::normalize_path(c,konforka::strip_leading_slash),true)); |
302 | modi.pop_front(); | 303 | modi.pop_front(); |
303 | BEGIN(INITIAL); | 304 | BEGIN(INITIAL); |
304 | } | 305 | } |
305 | } | 306 | } |
306 | 307 | ||
307 | <IMPORTTYPELINE>{ | 308 | <IMPORTTYPELINE>{ |
308 | {WHITESPACE}+{ } | 309 | {WHITESPACE}+{ } |
309 | {ID}{ | 310 | {ID}{ |
310 | modus_operandi& m = M(); | 311 | modus_operandi& m = M(); |
311 | if(!m._name.empty()) | 312 | if(!m._name.empty()) |
312 | throw preprocessor_error(CODEPOINT,"syntax error",lineno()); | 313 | throw preprocessor_error(CODEPOINT,"syntax error",lineno()); |
313 | m._name = yytext; | 314 | m._name = yytext; |
@@ -322,26 +323,26 @@ NOIDCHAR [^A-Za-z0-9_] | |||
322 | \n{ | 323 | \n{ |
323 | modus_operandi& m = M(); | 324 | modus_operandi& m = M(); |
324 | string::size_type t = m.output.find_first_not_of(" \t"); | 325 | string::size_type t = m.output.find_first_not_of(" \t"); |
325 | if(t!=string::npos) | 326 | if(t!=string::npos) |
326 | m.output.erase(0,t); | 327 | m.output.erase(0,t); |
327 | t = m.output.find_last_not_of(" \t;"); | 328 | t = m.output.find_last_not_of(" \t;"); |
328 | if(t!=string::npos) | 329 | if(t!=string::npos) |
329 | m.output.erase(t+1); | 330 | m.output.erase(t+1); |
330 | if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') { | 331 | if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') { |
331 | m.output.erase(0,1); | 332 | m.output.erase(0,1); |
332 | m.output.erase(m.output.length()-1); | 333 | m.output.erase(m.output.length()-1); |
333 | } | 334 | } |
334 | string c = combine_path(component_basename,m.output); | 335 | string c = konforka::combine_path(component_basename,m.output); |
335 | member_variables.push_back(member_variable(m._type,m._name,normalize_path(c,strip_leading_slash),true,true)); | 336 | member_variables.push_back(member_variable(m._type,m._name,konforka::normalize_path(c,konforka::strip_leading_slash),true,true)); |
336 | modi.pop_front(); | 337 | modi.pop_front(); |
337 | BEGIN(INITIAL); | 338 | BEGIN(INITIAL); |
338 | } | 339 | } |
339 | } | 340 | } |
340 | 341 | ||
341 | <DERIVELINE>{ | 342 | <DERIVELINE>{ |
342 | {WHITESPACE}+{ } | 343 | {WHITESPACE}+{ } |
343 | {ID}{ | 344 | {ID}{ |
344 | modus_operandi& m = M(); | 345 | modus_operandi& m = M(); |
345 | if(!m._name.empty()) | 346 | if(!m._name.empty()) |
346 | throw preprocessor_error(CODEPOINT,"syntax_error",lineno()); | 347 | throw preprocessor_error(CODEPOINT,"syntax_error",lineno()); |
347 | m._name = yytext; | 348 | m._name = yytext; |
@@ -356,26 +357,26 @@ NOIDCHAR [^A-Za-z0-9_] | |||
356 | \n { | 357 | \n { |
357 | modus_operandi& m = M(); | 358 | modus_operandi& m = M(); |
358 | string::size_type t = m.output.find_first_not_of(" \t"); | 359 | string::size_type t = m.output.find_first_not_of(" \t"); |
359 | if(t!=string::npos) | 360 | if(t!=string::npos) |
360 | m.output.erase(0,t); | 361 | m.output.erase(0,t); |
361 | t = m.output.find_last_not_of(" \t;"); | 362 | t = m.output.find_last_not_of(" \t;"); |
362 | if(t!=string::npos) | 363 | if(t!=string::npos) |
363 | m.output.erase(t+1); | 364 | m.output.erase(t+1); |
364 | if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') { | 365 | if(m.output[0]=='"' && m.output[m.output.length()-1]=='"') { |
365 | m.output.erase(0,1); | 366 | m.output.erase(0,1); |
366 | m.output.erase(m.output.length()-1); | 367 | m.output.erase(m.output.length()-1); |
367 | } | 368 | } |
368 | string c = combine_path(component_basename,m.output); | 369 | string c = konforka::combine_path(component_basename,m.output); |
369 | ancestor_classes.push_back(ancestor_class(m._name,normalize_path(c,strip_leading_slash))); | 370 | ancestor_classes.push_back(ancestor_class(m._name,konforka::normalize_path(c,konforka::strip_leading_slash))); |
370 | modi.pop_front(); | 371 | modi.pop_front(); |
371 | BEGIN(INITIAL); | 372 | BEGIN(INITIAL); |
372 | } | 373 | } |
373 | } | 374 | } |
374 | 375 | ||
375 | <VARLINE>{ | 376 | <VARLINE>{ |
376 | {WHITESPACE}+{ | 377 | {WHITESPACE}+{ |
377 | modus_operandi& m = M(); | 378 | modus_operandi& m = M(); |
378 | if(!m.output.empty()) { | 379 | if(!m.output.empty()) { |
379 | if(!m._lastid.empty()) { | 380 | if(!m._lastid.empty()) { |
380 | if(!m._type.empty()) m._type += ' '; | 381 | if(!m._type.empty()) m._type += ' '; |
381 | m._type += m._lastid; | 382 | m._type += m._lastid; |