-rw-r--r-- | lib/sitecing_parser.ll | 63 |
1 files changed, 33 insertions, 30 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 @@ -146,9 +146,9 @@ NOIDCHAR [^A-Za-z0-9_] } <METHODLINE>{ {WHITESPACE}+ { - modus_operandi& m = modi.front(); + modus_operandi& m = M(); if(!m.output.empty()) { if(!m._lastid.empty()) { if(!m._type.empty()) m._type += ' '; m._type += m._lastid; @@ -157,9 +157,9 @@ NOIDCHAR [^A-Za-z0-9_] m.output.clear(); } } \* { - modus_operandi& m = modi.front(); + modus_operandi& m = M(); ECHO; if(!m._lastid.empty()) { if(!m._type.empty()) m._type += ' '; m._type += m._lastid; @@ -167,9 +167,9 @@ NOIDCHAR [^A-Za-z0-9_] m._lastid = m.output; m.output.clear(); } \( { - modus_operandi& m = modi.front(); + modus_operandi& m = M(); if(m.output.empty()) { m._name=m._lastid; }else{ if(!m._lastid.empty()) { // XXX: lastid, I believe should never be emtpy... @@ -184,9 +184,9 @@ NOIDCHAR [^A-Za-z0-9_] } } <METHODARGS>{ \%\> { - modus_operandi& m = modi.front(); + modus_operandi& m = M(); m._args = m.output; m.output.clear(); anchor(); BEGIN(METHODBLOCK); @@ -222,9 +222,9 @@ NOIDCHAR [^A-Za-z0-9_] <CODELINE>\n yy_pop_state(); <CODEMETHODLINE>{ {WHITESPACE}+ { - modus_operandi& m = modi.front(); + modus_operandi& m = M(); if(!m.output.empty()) { if(!m._lastid.empty()) { if(!m._type.empty()) m._type += ' '; m._type += m._lastid; @@ -233,9 +233,9 @@ NOIDCHAR [^A-Za-z0-9_] m.output.clear(); } } \* { - modus_operandi& m = modi.front(); + modus_operandi& m = M(); ECHO; if(!m._lastid.empty()) { if(!m._type.empty()) m._type += ' '; m._type += m._lastid; @@ -243,9 +243,9 @@ NOIDCHAR [^A-Za-z0-9_] m._lastid = m.output; m.output.clear(); } \( { - modus_operandi& m = modi.front(); + modus_operandi& m = M(); if(m.output.empty()) { m._name=m._lastid; }else{ if(!m._lastid.empty()) { // XXX: lastid, I believe should never be emtpy... @@ -260,9 +260,9 @@ NOIDCHAR [^A-Za-z0-9_] } } <CODEMETHODARGS>{ \%\> { - modus_operandi& m = modi.front(); + modus_operandi& m = M(); m._args = m.output; m.output.clear(); m.flags=0; anchor(); @@ -272,14 +272,15 @@ NOIDCHAR [^A-Za-z0-9_] <IMPORTLINE>{ {WHITESPACE}+ { } {ID} { - if(!modi.front()._name.empty()) + modus_operandi& m = M(); + if(!m._name.empty()) throw preprocessor_error(CODEPOINT,"syntax error",lineno()); - modi.front()._name = yytext; + m._name = yytext; } \= { - modi.front().output.clear(); + M().output.clear(); BEGIN(IMPORTCOMPONENT); } } <IMPORTCOMPONENT>{ @@ -305,14 +306,15 @@ NOIDCHAR [^A-Za-z0-9_] <IMPORTTYPELINE>{ {WHITESPACE}+ { } {ID} { - if(!modi.front()._name.empty()) + modus_operandi& m = M(); + if(!m._name.empty()) throw preprocessor_error(CODEPOINT,"syntax error",lineno()); - modi.front()._name = yytext; + m._name = yytext; } \= { - modi.front().output.clear(); + M().output.clear(); BEGIN(IMPORTTYPECOMPONENT); } } <IMPORTTYPECOMPONENT>{ @@ -338,14 +340,15 @@ NOIDCHAR [^A-Za-z0-9_] <DERIVELINE>{ {WHITESPACE}+ { } {ID} { - if(!modi.front()._name.empty()) + modus_operandi& m = M(); + if(!m._name.empty()) throw preprocessor_error(CODEPOINT,"syntax_error",lineno()); - modi.front()._name = yytext; + m._name = yytext; } \= { - modi.front().output.clear(); + M().output.clear(); BEGIN(DERIVECOMPONENT); } } <DERIVECOMPONENT>{ @@ -370,9 +373,9 @@ NOIDCHAR [^A-Za-z0-9_] } <VARLINE>{ {WHITESPACE}+ { - modus_operandi& m = modi.front(); + modus_operandi& m = M(); if(!m.output.empty()) { if(!m._lastid.empty()) { if(!m._type.empty()) m._type += ' '; m._type += m._lastid; @@ -381,9 +384,9 @@ NOIDCHAR [^A-Za-z0-9_] m.output.clear(); } } \* { - modus_operandi& m = modi.front(); + modus_operandi& m = M(); ECHO; if(!m._lastid.empty()) { if(!m._type.empty()) m._type += ' '; m._type += m._lastid; @@ -391,9 +394,9 @@ NOIDCHAR [^A-Za-z0-9_] 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; }else{ if(!m._lastid.empty()) { // XXX: lastid should never be emtpy, I believe? @@ -409,9 +412,9 @@ 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) m.output.erase(0,t); t = m.output.find_last_not_of(" \t;"); @@ -425,20 +428,20 @@ NOIDCHAR [^A-Za-z0-9_] } } <DECLLINE>\n { ECHO; - decl += modi.front().output; + decl += M().output; modi.pop_front(); BEGIN(INITIAL); } <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); } <CLASSLINE,DECLLINE,IMPLLINE,VARLINE,VARINIT,IMPORTLINE,IMPORTCOMPONENT,CODEMETHODLINE,CODEMETHODARGS,INLINE,METHODLINE,METHODARGS,DECLBLOCK,IMPLBLOCK,CONSTRUCTOR,DESTRUCTOR,CODEMETHODBLOCK,CODELINE,CODEBLOCK,PRAGMALINE>{ @@ -476,41 +479,41 @@ NOIDCHAR [^A-Za-z0-9_] <DECLBLOCK,IMPLBLOCK,CONSTRUCTOR,DESTRUCTOR,CODEMETHODBLOCK,METHODBLOCK,CODEBLOCK>{ \<\/\%decl\> { if(YY_START!=DECLBLOCK) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno()); - decl += modi.front().output; + decl += M().output; modi.pop_front(); BEGIN(INITIAL); } \<\/\%impl\> { if(YY_START!=IMPLBLOCK) throw preprocessor_error(CODEPOINT,"tags mismatch",lineno()); - impl += modi.front().output; + impl += M().output; modi.pop_front(); BEGIN(INITIAL); } \<\/\%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(); BEGIN(INITIAL); } \<\/\%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); } \<\/\%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(); BEGIN(INITIAL); } \<\/%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)); modi.pop_front(); BEGIN(INITIAL); |