Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Parser< Iterator > Struct Template Reference
Inheritance diagram for Parser< Iterator >:
Collaboration diagram for Parser< Iterator >:

Public Member Functions

 Parser (CodeSet &code)
 

Public Attributes

boost::spirit::qi::rule< Iterator, boost::spirit::ascii::space_type > expression
 
boost::spirit::qi::rule< Iterator, boost::spirit::ascii::space_type > term
 
boost::spirit::qi::rule< Iterator, boost::spirit::ascii::space_type > factor
 
CodeSetcode_
 

Detailed Description

template<typename Iterator>
struct Parser< Iterator >

Definition at line 200 of file calc2.cpp.

Constructor & Destructor Documentation

◆ Parser()

template<typename Iterator >
Parser< Iterator >::Parser ( CodeSet & code)
inline

Definition at line 203 of file calc2.cpp.

204 : Parser::base_type(expression)
205 , code_(code)
206 {
207 namespace qi = boost::spirit::qi;
208 using namespace qi::labels;
209
210 using boost::phoenix::ref;
211 using boost::phoenix::push_back;
212
213 expression = term >> *(('+' > term[push_back(ref(code_), OpAdd)])
214 | ('-' > term[push_back(ref(code_), OpSub)]));
215
216 term = factor >> *(('*' > factor[push_back(ref(code_), OpMul)])
217 | ('/' > factor[push_back(ref(code_), OpDiv)]));
218
219 factor = qi::double_[push_back(ref(code_), _1)]
220 | qi::lit('x')[push_back(ref(code_), OpVarX)]
221 | ('(' > expression > ')')
222 | ('-' > factor[push_back(ref(code_), OpNeg)])
223 | ('+' > factor);
224 }
@ OpVarX
Definition calc2.cpp:35
@ OpMul
Definition calc2.cpp:31
@ OpNeg
Definition calc2.cpp:33
@ OpSub
Definition calc2.cpp:30
@ OpDiv
Definition calc2.cpp:32
@ OpAdd
Definition calc2.cpp:29
boost::spirit::qi::rule< Iterator, boost::spirit::ascii::space_type > term
Definition calc2.cpp:201
CodeSet & code_
Definition calc2.cpp:202
boost::spirit::qi::rule< Iterator, boost::spirit::ascii::space_type > expression
Definition calc2.cpp:201
boost::spirit::qi::rule< Iterator, boost::spirit::ascii::space_type > factor
Definition calc2.cpp:201

Member Data Documentation

◆ code_

template<typename Iterator >
CodeSet& Parser< Iterator >::code_

Definition at line 202 of file calc2.cpp.

◆ expression

template<typename Iterator >
boost::spirit::qi::rule<Iterator, boost::spirit::ascii::space_type> Parser< Iterator >::expression

Definition at line 201 of file calc2.cpp.

◆ factor

template<typename Iterator >
boost::spirit::qi::rule<Iterator, boost::spirit::ascii::space_type> Parser< Iterator >::factor

Definition at line 201 of file calc2.cpp.

◆ term

template<typename Iterator >
boost::spirit::qi::rule<Iterator, boost::spirit::ascii::space_type> Parser< Iterator >::term

Definition at line 201 of file calc2.cpp.


The documentation for this struct was generated from the following file: