5#ifndef SELECTION_HELPERS__SELECTION_EXPR_PARSER_H
6#define SELECTION_HELPERS__SELECTION_EXPR_PARSER_H
8#include <boost/tokenizer.hpp>
25 bool operator()(std::string::const_iterator &next,
26 const std::string::const_iterator &end,
27 std::string &tok)
const;
41 Lexer(
const std::string &s);
87 bool defaultToChar =
false);
92 StatusCode
build(std::unique_ptr<ISelectionReadAccessor> &accessor);
96 StatusCode
expression(std::unique_ptr<ISelectionReadAccessor> &root);
98 StatusCode
term(std::unique_ptr<ISelectionReadAccessor> &root);
100 StatusCode
factor(std::unique_ptr<ISelectionReadAccessor> &root);
Lexer which turns a token stream into a stream of unambigous symbols to be used by a parser.
Type
Enum over the possible symbols that can be extracted from the token stream.
Lexer(const std::string &s)
Constructor from a strig.
Symbol nextSymbol()
Generate a new symbol from the token sequence.
Tokenizer::iterator m_iterator
Lexer(Lexer &&)=default
Default move-constructor behaviour.
Lexer(const Lexer &)=delete
Disable copying of this class.
Separator to be used in a boost::tokenizer.
bool operator()(std::string::const_iterator &next, const std::string::const_iterator &end, std::string &tok) const
Extracts the subsequent token from the input string iterator.
void reset()
Optional state reset method, does nothing.
StatusCode term(std::unique_ptr< ISelectionReadAccessor > &root)
SelectionExprParser(DetailSelectionExprParser::Lexer lexer, bool defaultToChar=false)
Constructor for the parser which accepts a Lecer.
DetailSelectionExprParser::Lexer m_lexer
DetailSelectionExprParser::Lexer::Symbol m_symbol
StatusCode factor(std::unique_ptr< ISelectionReadAccessor > &root)
StatusCode expression(std::unique_ptr< ISelectionReadAccessor > &root)
StatusCode build(std::unique_ptr< ISelectionReadAccessor > &accessor)
Triggers the actual parsing of the expression.
boost::tokenizer< Separator > Tokenizer
Select isolated Photons, Electrons and Muons.
Struct grouping together the type and original string representation of a symbol.