author | Michael Krelin <hacker@klever.net> | 2005-03-31 13:27:36 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2005-03-31 13:27:36 (UTC) |
commit | ef14961fe10614eb15c71dd5b0b83f292bd7a5b0 (patch) (unidiff) | |
tree | 2be43fc5d441070db94c6e9881948d6ba2a87b04 | |
parent | 9c755a29c43bcf4a3a1bbd55ae7e590fc6ff2e21 (diff) | |
download | sitecing-ef14961fe10614eb15c71dd5b0b83f292bd7a5b0.zip sitecing-ef14961fe10614eb15c71dd5b0b83f292bd7a5b0.tar.gz sitecing-ef14961fe10614eb15c71dd5b0b83f292bd7a5b0.tar.bz2 |
minor improvements to code aesthetics
-rw-r--r-- | lib/sitecing_parser.ll | 159 |
1 files changed, 81 insertions, 78 deletions
diff --git a/lib/sitecing_parser.ll b/lib/sitecing_parser.ll index 8ba8673..9514ce4 100644 --- a/lib/sitecing_parser.ll +++ b/lib/sitecing_parser.ll | |||
@@ -149,24 +149,24 @@ NOIDCHAR [^A-Za-z0-9_] | |||
149 | {WHITESPACE}+{ | 149 | {WHITESPACE}+{ |
150 | modus_operandi& m = modi.front(); | 150 | modus_operandi& m = M(); |
151 | if(!m.output.empty()) { | 151 | if(!m.output.empty()) { |
152 | if(!m._lastid.empty()) { | 152 | if(!m._lastid.empty()) { |
153 | if(!m._type.empty()) m._type += ' '; | 153 | if(!m._type.empty()) m._type += ' '; |
154 | m._type += m._lastid; | 154 | m._type += m._lastid; |
155 | } | 155 | } |
156 | m._lastid = m.output; | 156 | m._lastid = m.output; |
157 | m.output.clear(); | 157 | m.output.clear(); |
158 | } | 158 | } |
159 | } | 159 | } |
160 | \*{ | 160 | \*{ |
161 | modus_operandi& m = modi.front(); | 161 | modus_operandi& m = M(); |
162 | ECHO; | 162 | ECHO; |
163 | if(!m._lastid.empty()) { | 163 | if(!m._lastid.empty()) { |
164 | if(!m._type.empty()) m._type += ' '; | 164 | if(!m._type.empty()) m._type += ' '; |
165 | m._type += m._lastid; | 165 | m._type += m._lastid; |
166 | } | 166 | } |
167 | m._lastid = m.output; | 167 | m._lastid = m.output; |
168 | m.output.clear(); | 168 | m.output.clear(); |
169 | } | 169 | } |
170 | \({ | 170 | \({ |
171 | modus_operandi& m = modi.front(); | 171 | modus_operandi& m = M(); |
172 | if(m.output.empty()) { | 172 | if(m.output.empty()) { |
@@ -187,3 +187,3 @@ NOIDCHAR [^A-Za-z0-9_] | |||
187 | \%\>{ | 187 | \%\>{ |
188 | modus_operandi& m = modi.front(); | 188 | modus_operandi& m = M(); |
189 | m._args = m.output; | 189 | m._args = m.output; |
@@ -225,24 +225,24 @@ NOIDCHAR [^A-Za-z0-9_] | |||
225 | {WHITESPACE}+{ | 225 | {WHITESPACE}+{ |
226 | modus_operandi& m = modi.front(); | 226 | modus_operandi& m = M(); |
227 | if(!m.output.empty()) { | 227 | if(!m.output.empty()) { |
228 | if(!m._lastid.empty()) { | 228 | if(!m._lastid.empty()) { |
229 | if(!m._type.empty()) m._type += ' '; | 229 | if(!m._type.empty()) m._type += ' '; |
230 | m._type += m._lastid; | 230 | m._type += m._lastid; |
231 | } | 231 | } |
232 | m._lastid = m.output; | 232 | m._lastid = m.output; |
233 | m.output.clear(); | 233 | m.output.clear(); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | \*{ | 236 | \*{ |
237 | modus_operandi& m = modi.front(); | 237 | modus_operandi& m = M(); |
238 | ECHO; | 238 | ECHO; |
239 | if(!m._lastid.empty()) { | 239 | if(!m._lastid.empty()) { |
240 | if(!m._type.empty()) m._type += ' '; | 240 | if(!m._type.empty()) m._type += ' '; |
241 | m._type += m._lastid; | 241 | m._type += m._lastid; |
242 | } | 242 | } |
243 | m._lastid = m.output; | 243 | m._lastid = m.output; |
244 | m.output.clear(); | 244 | m.output.clear(); |
245 | } | 245 | } |
246 | \({ | 246 | \({ |
247 | modus_operandi& m = modi.front(); | 247 | modus_operandi& m = M(); |
248 | if(m.output.empty()) { | 248 | if(m.output.empty()) { |
@@ -263,3 +263,3 @@ NOIDCHAR [^A-Za-z0-9_] | |||
263 | \%\>{ | 263 | \%\>{ |
264 | modus_operandi& m = modi.front(); | 264 | modus_operandi& m = M(); |
265 | m._args = m.output; | 265 | m._args = m.output; |
@@ -275,8 +275,9 @@ NOIDCHAR [^A-Za-z0-9_] | |||
275 | {ID}{ | 275 | {ID}{ |
276 | if(!modi.front()._name.empty()) | 276 | modus_operandi& m = M(); |
277 | throw preprocessor_error(CODEPOINT,"syntax error",lineno()); | 277 | if(!m._name.empty()) |
278 | modi.front()._name = yytext; | 278 | throw preprocessor_error(CODEPOINT,"syntax error",lineno()); |
279 | } | 279 | m._name = yytext; |
280 | } | ||
280 | \= { | 281 | \= { |
281 | modi.front().output.clear(); | 282 | M().output.clear(); |
282 | BEGIN(IMPORTCOMPONENT); | 283 | BEGIN(IMPORTCOMPONENT); |
@@ -308,8 +309,9 @@ NOIDCHAR [^A-Za-z0-9_] | |||
308 | {ID}{ | 309 | {ID}{ |
309 | if(!modi.front()._name.empty()) | 310 | modus_operandi& m = M(); |
310 | throw preprocessor_error(CODEPOINT,"syntax error",lineno()); | 311 | if(!m._name.empty()) |
311 | modi.front()._name = yytext; | 312 | throw preprocessor_error(CODEPOINT,"syntax error",lineno()); |
312 | } | 313 | m._name = yytext; |
314 | } | ||
313 | \= { | 315 | \= { |
314 | modi.front().output.clear(); | 316 | M().output.clear(); |
315 | BEGIN(IMPORTTYPECOMPONENT); | 317 | BEGIN(IMPORTTYPECOMPONENT); |
@@ -341,8 +343,9 @@ NOIDCHAR [^A-Za-z0-9_] | |||
341 | {ID}{ | 343 | {ID}{ |
342 | if(!modi.front()._name.empty()) | 344 | modus_operandi& m = M(); |
343 | throw preprocessor_error(CODEPOINT,"syntax_error",lineno()); | 345 | if(!m._name.empty()) |
344 | modi.front()._name = yytext; | 346 | throw preprocessor_error(CODEPOINT,"syntax_error",lineno()); |
345 | } | 347 | m._name = yytext; |
348 | } | ||
346 | \= { | 349 | \= { |
347 | modi.front().output.clear(); | 350 | M().output.clear(); |
348 | BEGIN(DERIVECOMPONENT); | 351 | BEGIN(DERIVECOMPONENT); |
@@ -373,3 +376,3 @@ NOIDCHAR [^A-Za-z0-9_] | |||
373 | {WHITESPACE}+{ | 376 | {WHITESPACE}+{ |
374 | modus_operandi& m = modi.front(); | 377 | modus_operandi& m = M(); |
375 | if(!m.output.empty()) { | 378 | if(!m.output.empty()) { |
@@ -384,13 +387,13 @@ NOIDCHAR [^A-Za-z0-9_] | |||
384 | \*{ | 387 | \*{ |
385 | modus_operandi& m = modi.front(); | 388 | modus_operandi& m = M(); |
386 | ECHO; | 389 | ECHO; |
387 | if(!m._lastid.empty()) { | 390 | if(!m._lastid.empty()) { |
388 | if(!m._type.empty()) m._type += ' '; | 391 | if(!m._type.empty()) m._type += ' '; |
389 | m._type += m._lastid; | 392 | m._type += m._lastid; |
390 | } | 393 | } |
391 | m._lastid = m.output; | 394 | m._lastid = m.output; |
392 | m.output.clear(); | 395 | m.output.clear(); |
393 | } | 396 | } |
394 | \;|\n|\={ | 397 | \;|\n|\={ |
395 | modus_operandi& m = modi.front(); | 398 | modus_operandi& m = M(); |
396 | if(m.output.empty()) { | 399 | if(m.output.empty()) { |
@@ -412,3 +415,3 @@ NOIDCHAR [^A-Za-z0-9_] | |||
412 | \n{ | 415 | \n{ |
413 | modus_operandi& m = modi.front(); | 416 | modus_operandi& m = M(); |
414 | string::size_type t = m.output.find_first_not_of(" \t"); | 417 | string::size_type t = m.output.find_first_not_of(" \t"); |
@@ -428,3 +431,3 @@ NOIDCHAR [^A-Za-z0-9_] | |||
428 | ECHO; | 431 | ECHO; |
429 | decl += modi.front().output; | 432 | decl += M().output; |
430 | modi.pop_front(); | 433 | modi.pop_front(); |
@@ -434,3 +437,3 @@ NOIDCHAR [^A-Za-z0-9_] | |||
434 | ECHO; | 437 | ECHO; |
435 | impl += modi.front().output; | 438 | impl += M().output; |
436 | modi.pop_front(); | 439 | modi.pop_front(); |
@@ -439,3 +442,3 @@ NOIDCHAR [^A-Za-z0-9_] | |||
439 | <CLASSLINE>\n{ | 442 | <CLASSLINE>\n{ |
440 | class_name = modi.front().output; | 443 | class_name = M().output; |
441 | modi.pop_front(); | 444 | modi.pop_front(); |
@@ -479,3 +482,3 @@ NOIDCHAR [^A-Za-z0-9_] | |||
479 | if(YY_START!=DECLBLOCK) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno()); | 482 | if(YY_START!=DECLBLOCK) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno()); |
480 | decl += modi.front().output; | 483 | decl += M().output; |
481 | modi.pop_front(); | 484 | modi.pop_front(); |
@@ -485,3 +488,3 @@ NOIDCHAR [^A-Za-z0-9_] | |||
485 | if(YY_START!=IMPLBLOCK) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno()); | 488 | if(YY_START!=IMPLBLOCK) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno()); |
486 | impl += modi.front().output; | 489 | impl += M().output; |
487 | modi.pop_front(); | 490 | modi.pop_front(); |
@@ -491,3 +494,3 @@ NOIDCHAR [^A-Za-z0-9_] | |||
491 | if(YY_START!=CONSTRUCTOR) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno()); | 494 | if(YY_START!=CONSTRUCTOR) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno()); |
492 | member_functions.push_back(member_function("","","",modi.front().output)); | 495 | member_functions.push_back(member_function("","","",M().output)); |
493 | have_constructor = true; | 496 | have_constructor = true; |
@@ -498,3 +501,3 @@ NOIDCHAR [^A-Za-z0-9_] | |||
498 | if(YY_START!=DESTRUCTOR) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno()); | 501 | if(YY_START!=DESTRUCTOR) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno()); |
499 | member_functions.push_back(member_function("","~","",modi.front().output)); | 502 | member_functions.push_back(member_function("","~","",M().output)); |
500 | modi.pop_front(); | 503 | modi.pop_front(); |
@@ -504,3 +507,3 @@ NOIDCHAR [^A-Za-z0-9_] | |||
504 | if(YY_START!=CODEMETHODBLOCK) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno()); | 507 | if(YY_START!=CODEMETHODBLOCK) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno()); |
505 | modus_operandi& m = modi.front(); | 508 | modus_operandi& m = M(); |
506 | member_functions.push_back(member_function(m._type,m._name,m._args,m.output)); | 509 | member_functions.push_back(member_function(m._type,m._name,m._args,m.output)); |
@@ -511,3 +514,3 @@ NOIDCHAR [^A-Za-z0-9_] | |||
511 | if(YY_START!=METHODBLOCK) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno()); | 514 | if(YY_START!=METHODBLOCK) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno()); |
512 | modus_operandi& m = modi.front(); | 515 | modus_operandi& m = M(); |
513 | m.modify(modus_operandi::modus_code); | 516 | m.modify(modus_operandi::modus_code); |