Public interface for the expression parsing facility.
More...
#include <SelectionExprParser.h>
Public interface for the expression parsing facility.
Definition at line 80 of file SelectionExprParser.h.
◆ SelectionExprParser()
Constructor for the parser which accepts a Lecer.
- Parameters
-
| lexer | The lexer to use for parsing |
- Note
Lexer can be auto-constructed from a string, so you can pass one directly.
- Parameters
-
| defaultToChar | Assume "as_char" as default encoding |
Definition at line 90 of file SelectionExprParser.cxx.
DetailSelectionExprParser::Lexer m_lexer
◆ build()
Triggers the actual parsing of the expression.
- Parameters
-
| [out] | accessor | Unique pointer the resulting accessor will be written to. |
- Returns
- StatusCode noting whether the operation succeeded.
Definition at line 93 of file SelectionExprParser.cxx.
94 {
95 std::unique_ptr<ISelectionReadAccessor>
root{
nullptr};
97
99 throw std::runtime_error(
100 "Not all symbols in expression were consumed. Check your expression.");
101 }
102
104 return StatusCode::SUCCESS;
105}
DetailSelectionExprParser::Lexer::Symbol m_symbol
StatusCode expression(std::unique_ptr< ISelectionReadAccessor > &root)
const AccessorWrapper< T > * accessor(xAOD::JetAttribute::AttributeID id)
Returns an attribute accessor corresponding to an AttributeID.
◆ expression()
Definition at line 107 of file SelectionExprParser.cxx.
108 {
111 std::unique_ptr<ISelectionReadAccessor> left = std::move(root);
113 std::unique_ptr<ISelectionReadAccessor> right = std::move(root);
114 root = std::make_unique<SelectionAccessorExprOr>(std::move(left),
115 std::move(right));
116 }
117 return StatusCode::SUCCESS;
118}
StatusCode term(std::unique_ptr< ISelectionReadAccessor > &root)
◆ factor()
Definition at line 139 of file SelectionExprParser.cxx.
140 {
143 root = std::make_unique<SelectionReadAccessorNull>(
true);
146 root = std::make_unique<SelectionReadAccessorNull>(
false);
150 std::unique_ptr<ISelectionReadAccessor> notEx =
151 std::make_unique<SelectionAccessorExprNot>(std::move(root));
152 root = std::move(notEx);
156 throw std::runtime_error(
157 "Missing closing bracket, check your expression.");
158 }
160
164 } else {
165 throw std::runtime_error("Malformed expression.");
166 }
167
168 return StatusCode::SUCCESS;
169}
StatusCode factor(std::unique_ptr< ISelectionReadAccessor > &root)
StatusCode makeSelectionReadAccessorVar(const std::string &name, std::unique_ptr< ISelectionReadAccessor > &accessor, bool defaultToChar)
Produces a simple ISelectionReadAccessor accessing the given decoration.
◆ term()
Definition at line 120 of file SelectionExprParser.cxx.
121 {
123 std::vector<std::unique_ptr<ISelectionReadAccessor>> factors;
124 factors.push_back(std::move(root));
125
128 factors.push_back(std::move(root));
129 }
130
131 if (factors.size() == 1) {
132 root = std::move(factors[0]);
133 } else {
134 root = std::make_unique<SelectionAccessorList>(std::move(factors));
135 }
136 return StatusCode::SUCCESS;
137}
◆ m_defaultToChar
| bool CP::SelectionExprParser::m_defaultToChar {} |
|
private |
◆ m_lexer
◆ m_symbol
The documentation for this class was generated from the following files: