Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-01-09 23:33:16

0001 #include "CommonTools/Utils/interface/parser/MethodChainSetter.h"
0002 #include "CommonTools/Utils/interface/parser/MethodChain.h"
0003 #include "CommonTools/Utils/interface/returnType.h"
0004 #include "CommonTools/Utils/interface/parser/Exception.h"
0005 #include <string>
0006 
0007 using namespace reco::parser;
0008 using namespace std;
0009 
0010 void MethodChainSetter::operator()(const char *begin, const char *end) const {
0011   //std::cerr << "MethodChainSetter: Pushed [" << std::string(begin,end) << "]" << std::endl;
0012   if (!methStack_.empty())
0013     push(begin, end);
0014   else if (!lazyMethStack_.empty())
0015     lazyPush(begin, end);
0016   else
0017     throw Exception(begin) << " Expression didn't parse neither hastily nor lazyly. This must not happen.\n";
0018 }
0019 
0020 void MethodChainSetter::push(const char *begin, const char *end) const {
0021   methchain_ = std::shared_ptr<MethodChainBase>(new MethodChain(methStack_));
0022   methStack_.clear();
0023   typeStack_.resize(1);
0024 }
0025 
0026 void MethodChainSetter::lazyPush(const char *begin, const char *end) const {
0027   methchain_ = std::shared_ptr<MethodChainBase>(new LazyMethodChain(lazyMethStack_));
0028   lazyMethStack_.clear();
0029   typeStack_.resize(1);
0030 }