Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //im parserfactory
- static std::string const grammarfail=""; //added
- static unsigned int minimumlength=2; //added
- struct TVariable
- {
- std::string tvar;
- std::string ttype;
- };
- //parserfactory
- //im ecsymbolfactory header
- static std::string const IECTypeName="TYPE";
- static std::string const IECVarName="VAR";
- TVariable CheckVariable(std::string const & typeline);
- //im iecsymbolfactory cpp
- TVariable IECSymbolFactory::CheckVariable(std::string const & typeline)
- {
- unsigned int found=0;
- unsigned int colonpos=0;
- TVariable tvar;
- if(typeline.find(IECVarName) !=typeline.npos && typeline.find(';') !=typeline.npos)
- {
- found=typeline.find_first_of(' ');
- colonpos=typeline.find_first_of(':');
- tvar.ttype=typeline.substr(found+1,colonpos-2);
- tvar.tvar=typeline.substr(colonpos+2, typeline.size()-1);
- }
- else
- {
- tvar.ttype="";
- tvar.tvar="";
- }
- return tvar;
- }
- //im javafactory
- TVariable javafactory::CheckVariable(std::string const & typeline)
- {
- unsigned int found=0;
- TVariable tvar;
- if(typeline.find_first_of(' ') == typeline.find_last_of(' ') && typeline.at(typeline.size())==';')
- {
- found=typeline.find_first_of(' ');
- tvar.ttype=typeline.substr(0,found-1);
- tvar.tvar=typeline.substr(found+1, typeline.size()-1);
- }
- else
- {
- tvar.ttype="";
- tvar.tvar="";
- }
- return tvar;
- }
Advertisement
Add Comment
Please, Sign In to add comment