summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2005-03-31 13:27:36 (UTC)
committer Michael Krelin <hacker@klever.net>2005-03-31 13:27:36 (UTC)
commitef14961fe10614eb15c71dd5b0b83f292bd7a5b0 (patch) (side-by-side diff)
tree2be43fc5d441070db94c6e9881948d6ba2a87b04
parent9c755a29c43bcf4a3a1bbd55ae7e590fc6ff2e21 (diff)
downloadsitecing-ef14961fe10614eb15c71dd5b0b83f292bd7a5b0.zip
sitecing-ef14961fe10614eb15c71dd5b0b83f292bd7a5b0.tar.gz
sitecing-ef14961fe10614eb15c71dd5b0b83f292bd7a5b0.tar.bz2
minor improvements to code aesthetics
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--lib/sitecing_parser.ll159
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
@@ -148,26 +148,26 @@ NOIDCHAR [^A-Za-z0-9_]
<METHODLINE>{
{WHITESPACE}+ {
- modus_operandi& m = modi.front();
- if(!m.output.empty()) {
- if(!m._lastid.empty()) {
- if(!m._type.empty()) m._type += ' ';
- m._type += m._lastid;
- }
- m._lastid = m.output;
- m.output.clear();
- }
- }
+ modus_operandi& m = M();
+ if(!m.output.empty()) {
+ if(!m._lastid.empty()) {
+ if(!m._type.empty()) m._type += ' ';
+ m._type += m._lastid;
+ }
+ m._lastid = m.output;
+ m.output.clear();
+ }
+ }
\* {
- modus_operandi& m = modi.front();
- ECHO;
- if(!m._lastid.empty()) {
- if(!m._type.empty()) m._type += ' ';
- m._type += m._lastid;
- }
- m._lastid = m.output;
- m.output.clear();
- }
+ modus_operandi& m = M();
+ ECHO;
+ if(!m._lastid.empty()) {
+ if(!m._type.empty()) m._type += ' ';
+ m._type += m._lastid;
+ }
+ m._lastid = m.output;
+ m.output.clear();
+ }
\( {
- modus_operandi& m = modi.front();
+ modus_operandi& m = M();
if(m.output.empty()) {
m._name=m._lastid;
@@ -186,5 +186,5 @@ NOIDCHAR [^A-Za-z0-9_]
<METHODARGS>{
\%\> {
- modus_operandi& m = modi.front();
+ modus_operandi& m = M();
m._args = m.output;
m.output.clear();
@@ -224,26 +224,26 @@ NOIDCHAR [^A-Za-z0-9_]
<CODEMETHODLINE>{
{WHITESPACE}+ {
- modus_operandi& m = modi.front();
- if(!m.output.empty()) {
- if(!m._lastid.empty()) {
- if(!m._type.empty()) m._type += ' ';
- m._type += m._lastid;
- }
- m._lastid = m.output;
- m.output.clear();
- }
- }
+ modus_operandi& m = M();
+ if(!m.output.empty()) {
+ if(!m._lastid.empty()) {
+ if(!m._type.empty()) m._type += ' ';
+ m._type += m._lastid;
+ }
+ m._lastid = m.output;
+ m.output.clear();
+ }
+ }
\* {
- modus_operandi& m = modi.front();
- ECHO;
- if(!m._lastid.empty()) {
- if(!m._type.empty()) m._type += ' ';
- m._type += m._lastid;
- }
- m._lastid = m.output;
- m.output.clear();
- }
+ modus_operandi& m = M();
+ ECHO;
+ if(!m._lastid.empty()) {
+ if(!m._type.empty()) m._type += ' ';
+ m._type += m._lastid;
+ }
+ m._lastid = m.output;
+ m.output.clear();
+ }
\( {
- modus_operandi& m = modi.front();
+ modus_operandi& m = M();
if(m.output.empty()) {
m._name=m._lastid;
@@ -262,5 +262,5 @@ NOIDCHAR [^A-Za-z0-9_]
<CODEMETHODARGS>{
\%\> {
- modus_operandi& m = modi.front();
+ modus_operandi& m = M();
m._args = m.output;
m.output.clear();
@@ -274,10 +274,11 @@ NOIDCHAR [^A-Za-z0-9_]
{WHITESPACE}+ { }
{ID} {
- if(!modi.front()._name.empty())
- throw preprocessor_error(CODEPOINT,"syntax error",lineno());
- modi.front()._name = yytext;
- }
+ modus_operandi& m = M();
+ if(!m._name.empty())
+ throw preprocessor_error(CODEPOINT,"syntax error",lineno());
+ m._name = yytext;
+ }
\= {
- modi.front().output.clear();
+ M().output.clear();
BEGIN(IMPORTCOMPONENT);
}
@@ -307,10 +308,11 @@ NOIDCHAR [^A-Za-z0-9_]
{WHITESPACE}+ { }
{ID} {
- if(!modi.front()._name.empty())
- throw preprocessor_error(CODEPOINT,"syntax error",lineno());
- modi.front()._name = yytext;
- }
+ modus_operandi& m = M();
+ if(!m._name.empty())
+ throw preprocessor_error(CODEPOINT,"syntax error",lineno());
+ m._name = yytext;
+ }
\= {
- modi.front().output.clear();
+ M().output.clear();
BEGIN(IMPORTTYPECOMPONENT);
}
@@ -340,10 +342,11 @@ NOIDCHAR [^A-Za-z0-9_]
{WHITESPACE}+ { }
{ID} {
- if(!modi.front()._name.empty())
- throw preprocessor_error(CODEPOINT,"syntax_error",lineno());
- modi.front()._name = yytext;
- }
+ modus_operandi& m = M();
+ if(!m._name.empty())
+ throw preprocessor_error(CODEPOINT,"syntax_error",lineno());
+ m._name = yytext;
+ }
\= {
- modi.front().output.clear();
+ M().output.clear();
BEGIN(DERIVECOMPONENT);
}
@@ -372,5 +375,5 @@ NOIDCHAR [^A-Za-z0-9_]
<VARLINE>{
{WHITESPACE}+ {
- modus_operandi& m = modi.front();
+ modus_operandi& m = M();
if(!m.output.empty()) {
if(!m._lastid.empty()) {
@@ -383,15 +386,15 @@ NOIDCHAR [^A-Za-z0-9_]
}
\* {
- modus_operandi& m = modi.front();
- ECHO;
- if(!m._lastid.empty()) {
- if(!m._type.empty()) m._type += ' ';
- m._type += m._lastid;
- }
- m._lastid = m.output;
- m.output.clear();
- }
+ modus_operandi& m = M();
+ ECHO;
+ if(!m._lastid.empty()) {
+ if(!m._type.empty()) m._type += ' ';
+ m._type += m._lastid;
+ }
+ m._lastid = m.output;
+ m.output.clear();
+ }
\;|\n|\= {
- modus_operandi& m = modi.front();
+ modus_operandi& m = M();
if(m.output.empty()) {
m._name=m._lastid;
@@ -411,5 +414,5 @@ NOIDCHAR [^A-Za-z0-9_]
<VARINIT>{
\n {
- modus_operandi& m = modi.front();
+ modus_operandi& m = M();
string::size_type t = m.output.find_first_not_of(" \t");
if(t!=string::npos)
@@ -427,5 +430,5 @@ NOIDCHAR [^A-Za-z0-9_]
<DECLLINE>\n {
ECHO;
- decl += modi.front().output;
+ decl += M().output;
modi.pop_front();
BEGIN(INITIAL);
@@ -433,10 +436,10 @@ NOIDCHAR [^A-Za-z0-9_]
<IMPLLINE>\n {
ECHO;
- impl += modi.front().output;
+ impl += M().output;
modi.pop_front();
BEGIN(INITIAL);
}
<CLASSLINE>\n {
- class_name = modi.front().output;
+ class_name = M().output;
modi.pop_front();
BEGIN(INITIAL);
@@ -478,5 +481,5 @@ NOIDCHAR [^A-Za-z0-9_]
\<\/\%decl\> {
if(YY_START!=DECLBLOCK) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno());
- decl += modi.front().output;
+ decl += M().output;
modi.pop_front();
BEGIN(INITIAL);
@@ -484,5 +487,5 @@ NOIDCHAR [^A-Za-z0-9_]
\<\/\%impl\> {
if(YY_START!=IMPLBLOCK) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno());
- impl += modi.front().output;
+ impl += M().output;
modi.pop_front();
BEGIN(INITIAL);
@@ -490,5 +493,5 @@ NOIDCHAR [^A-Za-z0-9_]
\<\/\%constructor\> {
if(YY_START!=CONSTRUCTOR) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno());
- member_functions.push_back(member_function("","","",modi.front().output));
+ member_functions.push_back(member_function("","","",M().output));
have_constructor = true;
modi.pop_front();
@@ -497,5 +500,5 @@ NOIDCHAR [^A-Za-z0-9_]
\<\/\%destructor\> {
if(YY_START!=DESTRUCTOR) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno());
- member_functions.push_back(member_function("","~","",modi.front().output));
+ member_functions.push_back(member_function("","~","",M().output));
modi.pop_front();
BEGIN(INITIAL);
@@ -503,5 +506,5 @@ NOIDCHAR [^A-Za-z0-9_]
\<\/\%codemethod\> {
if(YY_START!=CODEMETHODBLOCK) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno());
- modus_operandi& m = modi.front();
+ modus_operandi& m = M();
member_functions.push_back(member_function(m._type,m._name,m._args,m.output));
modi.pop_front();
@@ -510,5 +513,5 @@ NOIDCHAR [^A-Za-z0-9_]
\<\/%method\> {
if(YY_START!=METHODBLOCK) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno());
- modus_operandi& m = modi.front();
+ modus_operandi& m = M();
m.modify(modus_operandi::modus_code);
member_functions.push_back(member_function(m._type,m._name,m._args,m.output));