| 1 | #include <boost/config/warning_disable.hpp>
|
|---|
| 2 | #include <boost/spirit/include/qi.hpp>
|
|---|
| 3 | #include <boost/spirit/include/phoenix_operator.hpp>
|
|---|
| 4 |
|
|---|
| 5 | #include <string>
|
|---|
| 6 |
|
|---|
| 7 | namespace qi = boost::spirit::qi;
|
|---|
| 8 |
|
|---|
| 9 | template <typename Iterator>
|
|---|
| 10 | struct grammar_format : qi::grammar<Iterator, unsigned()>
|
|---|
| 11 | {
|
|---|
| 12 | grammar_format():
|
|---|
| 13 | grammar_format::base_type(term)
|
|---|
| 14 | {
|
|---|
| 15 | using qi::lit;
|
|---|
| 16 | using qi::_val;
|
|---|
| 17 |
|
|---|
| 18 | term = lit('M')[_val = 0];
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | qi::rule<Iterator, unsigned()> term;
|
|---|
| 22 | };
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 | int main()
|
|---|
| 26 | {
|
|---|
| 27 | grammar_format<std::string::const_iterator> grammar;
|
|---|
| 28 |
|
|---|
| 29 | return 0;
|
|---|
| 30 | }
|
|---|