CMS 3D CMS Logo

cutParser.cc
Go to the documentation of this file.
5 
6 using namespace reco::parser;
7 bool reco::parser::cutParser(const edm::TypeWithDict& t, const std::string& cut, SelectorPtr& sel, bool lazy = false) {
8  bool justBlanks = true;
9  for (std::string::const_iterator c = cut.begin(); c != cut.end(); ++c) {
10  if (*c != ' ') {
11  justBlanks = false;
12  break;
13  }
14  }
15  if (justBlanks) {
17  return true;
18  } else {
19  using namespace boost::spirit::classic;
20  Grammar grammar(sel, t, lazy);
21  bool returnValue = false;
22  const char* startingFrom = cut.c_str();
23  try {
24  returnValue = parse(startingFrom, grammar.use_parser<0>() >> end_p, space_p).full;
25  } catch (BaseException& e) {
27  << "Cut parser error:" << baseExceptionWhat(e) << " (char " << e.where - startingFrom << ")\n"
28  << "Cut string was " << cut;
29  }
30  return returnValue;
31  }
32 }
vector< string > parse(string line, const string &delimiter)
bool cutParser(const edm::TypeWithDict &t, const std::string &cut, SelectorPtr &sel, bool lazy)
Definition: cutParser.cc:7
boost::spirit::classic::parser_error< reco::parser::SyntaxErrors > BaseException
Definition: Exception.h:33
const char * baseExceptionWhat(const BaseException &e)
returns the appropriate &#39;what&#39; message for the exception
Definition: Exception.h:36
std::shared_ptr< SelectorBase > SelectorPtr
Definition: SelectorPtr.h:18