| 210 | } |
| 211 | |
| 212 | void github_issue_125() |
| 213 | { |
| 214 | namespace bp = boost::parser; |
| 215 | using namespace github_issue_125_; |
| 216 | |
| 217 | unsigned short integer_found = 99; |
| 218 | auto print_repl_field = [&](auto & ctx) { |
| 219 | const std::optional<unsigned short> & val = bp::_attr(ctx); |
| 220 | if (val) |
| 221 | integer_found = *val; |
| 222 | else |
| 223 | integer_found = 77; |
| 224 | }; |
| 225 | |
| 226 | { |
| 227 | integer_found = 99; |
| 228 | auto result = bp::parse("{9", replacement_field[print_repl_field]); |
| 229 | BOOST_TEST(result); |
| 230 | BOOST_TEST(integer_found == 9); |
| 231 | } |
| 232 | { |
| 233 | integer_found = 99; |
| 234 | auto result = bp::parse("{", replacement_field[print_repl_field]); |
| 235 | BOOST_TEST(result); |
| 236 | BOOST_TEST(integer_found == 77); |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | void github_issue_209() |
| 241 | { |