Re: Domain name parser not working
Michael Powell <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <CAMEoF_EoJQuAOHThdx9pyDmky7m-Lv2BAzLbQcVfd4B07R9dig@mail.gmail.com> |
At this point I'm just scratching my head. I don't know what gives. https://wandbox.org/permlink/HewnazbGgXqixP0N It builds, but I get failure as long as the semantic action is in play. On the plus side, it is FAIL, not Failure, which means that a parse did try to happen, but the resulting attribute was clearly incorrect. But when I remove the semantic action, I get PASS. On Tue, Jan 2, 2018 at 10:02 PM, Michael Powell <[email protected]> wrote: > Then I just get this. What other options are you specifying? Compiler > definitions? > > I'm not sure why l.size()? Shouldn't Attrib in this instance be std::string? > > In file included from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/support/string_traits.hpp:16, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/support/nonterminal/expand_arg.hpp:20, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/support/context.hpp:18, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/domain.hpp:18, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/meta_compiler.hpp:15, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/action/action.hpp:14, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/action.hpp:14, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi.hpp:14, > from prog.cc:3: > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/support/container.hpp: > In instantiation of 'static bool > boost::spirit::traits::push_back_container<Container, T, > Enable>::call(Container&, const T&) [with Container = > std::__cxx11::basic_string<char>; T = std::vector<char, > std::allocator<char> >; Enable = void]': > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/support/container.hpp:354:55: > required from 'bool boost::spirit::traits::push_back(Container&, > const T&) [with Container = std::__cxx11::basic_string<char>; T = > std::vector<char, std::allocator<char> >]' > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/detail/assign_to.hpp:272:34: > required from 'static void > boost::spirit::traits::assign_to_container_from_value<Attribute, T, > Enable>::append_to_container_not_string(const T_&, Attribute&, > mpl_::false_) [with T_ = std::vector<std::vector<char, > std::allocator<char> >, std::allocator<std::vector<char, > std::allocator<char> > > >; Attribute = > std::__cxx11::basic_string<char>; T = std::vector<std::vector<char, > std::allocator<char> >, std::allocator<std::vector<char, > std::allocator<char> > > >; Enable = void; mpl_::false_ = > mpl_::bool_<false>]' > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/detail/assign_to.hpp:282:43: > required from 'static void > boost::spirit::traits::assign_to_container_from_value<Attribute, T, > Enable>::call(const T_&, Attribute&, mpl_::true_, mpl_::false_) [with > T_ = std::vector<std::vector<char, std::allocator<char> >, > std::allocator<std::vector<char, std::allocator<char> > > >; Attribute > = std::__cxx11::basic_string<char>; T = std::vector<std::vector<char, > std::allocator<char> >, std::allocator<std::vector<char, > std::allocator<char> > > >; Enable = void; mpl_::true_ = > mpl_::bool_<true>; mpl_::false_ = mpl_::bool_<false>]' > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/detail/assign_to.hpp:326:17: > required from 'static void > boost::spirit::traits::assign_to_container_from_value<Attribute, T, > Enable>::call(const T&, Attribute&) [with Attribute = > std::__cxx11::basic_string<char>; T = std::vector<std::vector<char, > std::allocator<char> >, std::allocator<std::vector<char, > std::allocator<char> > > >; Enable = void]' > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/detail/assign_to.hpp:379:63: > required from 'void boost::spirit::traits::detail::assign_to(const > T&, Attribute&, mpl_::true_) [with T = std::vector<std::vector<char, > std::allocator<char> >, std::allocator<std::vector<char, > std::allocator<char> > > >; Attribute = > std::__cxx11::basic_string<char>; mpl_::true_ = mpl_::bool_<true>]' > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/detail/assign_to.hpp:393:26: > [ skipping 8 instantiation contexts, use > -ftemplate-backtrace-limit=0 to disable ] > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/function/function_template.hpp:1061:16: > required from 'boost::function<R(T0, T1, T2, T3)>::function(Functor, > typename boost::enable_if_c<(! boost::is_integral<Functor>::value), > int>::type) [with Functor = > boost::spirit::qi::detail::parser_binder<boost::spirit::qi::action<boost::spirit::qi::repeat_parser<boost::spirit::qi::plus<boost::spirit::qi::reference<const > boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, > std::__cxx11::basic_string<char> >, char(), > boost::spirit::unused_type, boost::spirit::unused_type, > boost::spirit::unused_type> > >, > boost::spirit::qi::finite_iterator<int> >, client::label_validation>, > mpl_::bool_<true> >; R = bool; T0 = __gnu_cxx::__normal_iterator<const > char*, std::__cxx11::basic_string<char> >&; T1 = const > __gnu_cxx::__normal_iterator<const char*, > std::__cxx11::basic_string<char> >&; T2 = > boost::spirit::context<boost::fusion::cons<std::__cxx11::basic_string<char>&, > boost::fusion::nil_>, boost::fusion::vector<> >&; T3 = const > boost::spirit::unused_type&; typename boost::enable_if_c<(! > boost::is_integral<Functor>::value), int>::type = int]' > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/function/function_template.hpp:1114:5: > required from 'typename boost::enable_if_c<(! > boost::is_integral<Functor>::value), boost::function<R(T0, T1, T2, > T3)>&>::type boost::function<R(T0, T1, T2, T3)>::operator=(Functor) > [with Functor = > boost::spirit::qi::detail::parser_binder<boost::spirit::qi::action<boost::spirit::qi::repeat_parser<boost::spirit::qi::plus<boost::spirit::qi::reference<const > boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, > std::__cxx11::basic_string<char> >, char(), > boost::spirit::unused_type, boost::spirit::unused_type, > boost::spirit::unused_type> > >, > boost::spirit::qi::finite_iterator<int> >, client::label_validation>, > mpl_::bool_<true> >; R = bool; T0 = __gnu_cxx::__normal_iterator<const > char*, std::__cxx11::basic_string<char> >&; T1 = const > __gnu_cxx::__normal_iterator<const char*, > std::__cxx11::basic_string<char> >&; T2 = > boost::spirit::context<boost::fusion::cons<std::__cxx11::basic_string<char>&, > boost::fusion::nil_>, boost::fusion::vector<> >&; T3 = const > boost::spirit::unused_type&; typename boost::enable_if_c<(! > boost::is_integral<Functor>::value), boost::function<R(T0, T1, T2, > T3)>&>::type = boost::function<bool(__gnu_cxx::__normal_iterator<const > char*, std::__cxx11::basic_string<char> >&, const > __gnu_cxx::__normal_iterator<const char*, > std::__cxx11::basic_string<char> >&, > boost::spirit::context<boost::fusion::cons<std::__cxx11::basic_string<char>&, > boost::fusion::nil_>, boost::fusion::vector<> >&, const > boost::spirit::unused_type&)>&]' > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/nonterminal/rule.hpp:183:19: > required from 'static void boost::spirit::qi::rule<Iterator, T1, T2, > T3, T4>::define(boost::spirit::qi::rule<Iterator, T1, T2, T3, T4>&, > const Expr&, mpl_::true_) [with Auto = mpl_::bool_<true>; Expr = > boost::proto::exprns_::expr<boost::proto::tagns_::tag::subscript, > boost::proto::argsns_::list2<const > boost::proto::exprns_::expr<boost::proto::tagns_::tag::subscript, > boost::proto::argsns_::list2<boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal, > boost::proto::argsns_::term<boost::spirit::terminal_ex<boost::spirit::tag::repeat, > boost::fusion::vector<int, int> > >, 0>&, const > boost::proto::exprns_::expr<boost::proto::tagns_::tag::unary_plus, > boost::proto::argsns_::list1<boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const > char*, std::__cxx11::basic_string<char> >, char(), > boost::spirit::unused_type, boost::spirit::unused_type, > boost::spirit::unused_type>&>, 1>&>, 2>&, > boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal, > boost::proto::argsns_::term<const client::label_validation&>, 0> >, > 2>; Iterator = __gnu_cxx::__normal_iterator<const char*, > std::__cxx11::basic_string<char> >; T1 = > std::__cxx11::basic_string<char>(); T2 = boost::spirit::unused_type; > T3 = boost::spirit::unused_type; T4 = boost::spirit::unused_type; > mpl_::true_ = mpl_::bool_<true>]' > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/nonterminal/rule.hpp:247:31: > required from 'boost::spirit::qi::rule<Iterator, T1, T2, T3, T4>& > boost::spirit::qi::operator%=(boost::spirit::qi::rule<Iterator, T1, > T2, T3, T4>&, Expr&&) [with Expr = const > boost::proto::exprns_::expr<boost::proto::tagns_::tag::subscript, > boost::proto::argsns_::list2<const > boost::proto::exprns_::expr<boost::proto::tagns_::tag::subscript, > boost::proto::argsns_::list2<boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal, > boost::proto::argsns_::term<boost::spirit::terminal_ex<boost::spirit::tag::repeat, > boost::fusion::vector<int, int> > >, 0>&, const > boost::proto::exprns_::expr<boost::proto::tagns_::tag::unary_plus, > boost::proto::argsns_::list1<boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const > char*, std::__cxx11::basic_string<char> >, char(), > boost::spirit::unused_type, boost::spirit::unused_type, > boost::spirit::unused_type>&>, 1>&>, 2>&, > boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal, > boost::proto::argsns_::term<const client::label_validation&>, 0> >, > 2>; Iterator = __gnu_cxx::__normal_iterator<const char*, > std::__cxx11::basic_string<char> >; T1 = > std::__cxx11::basic_string<char>(); T2 = boost::spirit::unused_type; > T3 = boost::spirit::unused_type; T4 = boost::spirit::unused_type]' > prog.cc:78:20: required from > 'client::my_grammar<Iterator>::my_grammar() [with Iterator = > __gnu_cxx::__normal_iterator<const char*, > std::__cxx11::basic_string<char> >]' > prog.cc:128:20: required from here > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/support/container.hpp:292:13: > error: no matching function for call to > 'std::__cxx11::basic_string<char>::insert(std::__cxx11::basic_string<char>::iterator, > const std::vector<char, std::allocator<char> >&)' > c.insert(c.end(), val); > ^ > In file included from /opt/wandbox/gcc-head/include/c++/8.0.0/string:52, > from /opt/wandbox/gcc-head/include/c++/8.0.0/stdexcept:39, > from /opt/wandbox/gcc-head/include/c++/8.0.0/array:39, > from /opt/wandbox/gcc-head/include/c++/8.0.0/tuple:39, > from /opt/wandbox/gcc-head/include/c++/8.0.0/functional:54, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/support/detail/as_fusion_element.hpp:15, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/algorithm/transformation/push_back.hpp:11, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp:21, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/view/iterator_range/detail/segments_impl.hpp:14, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/view/iterator_range/iterator_range.hpp:22, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/view/iterator_range.hpp:11, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp:13, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/sequence/intrinsic/begin.hpp:18, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/adapted/boost_tuple/detail/convert_impl.hpp:12, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/adapted/boost_tuple.hpp:20, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/adapted.hpp:15, > from prog.cc:2: > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1514:7: > note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::insert(std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::const_iterator, std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::size_type, _CharT) [with _CharT = char; _Traits = > std::char_traits<char>; _Alloc = std::allocator<char>; > std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator = > __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >>; typename __gnu_cxx::__alloc_traits<typename > __gnu_cxx::__alloc_traits<_Alloc>::rebind<_CharT>::other>::pointer = > char*; std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::const_iterator = __gnu_cxx::__normal_iterator<const char*, > std::__cxx11::basic_string<char> >; typename > __gnu_cxx::__alloc_traits<typename > __gnu_cxx::__alloc_traits<_Alloc>::rebind<_CharT>::other>::const_pointer > = const char*; std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::size_type = long unsigned int]' > insert(const_iterator __p, size_type __n, _CharT __c) > ^~~~~~ > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1514:7: > note: candidate expects 3 arguments, 2 provided > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1558:9: > note: candidate: 'template<class _InputIterator, class> > std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator > std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::insert(std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::const_iterator, _InputIterator, _InputIterator) [with > _InputIterator = _InputIterator; <template-parameter-2-2> = > <template-parameter-1-2>; _CharT = char; _Traits = > std::char_traits<char>; _Alloc = std::allocator<char>]' > insert(const_iterator __p, _InputIterator __beg, _InputIterator __end) > ^~~~~~ > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1558:9: > note: template argument deduction/substitution failed: > In file included from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/support/string_traits.hpp:16, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/support/nonterminal/expand_arg.hpp:20, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/support/context.hpp:18, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/domain.hpp:18, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/meta_compiler.hpp:15, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/action/action.hpp:14, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/action.hpp:14, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi.hpp:14, > from prog.cc:3: > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/support/container.hpp:292:13: > note: candidate expects 3 arguments, 2 provided > c.insert(c.end(), val); > ^ > In file included from /opt/wandbox/gcc-head/include/c++/8.0.0/string:52, > from /opt/wandbox/gcc-head/include/c++/8.0.0/stdexcept:39, > from /opt/wandbox/gcc-head/include/c++/8.0.0/array:39, > from /opt/wandbox/gcc-head/include/c++/8.0.0/tuple:39, > from /opt/wandbox/gcc-head/include/c++/8.0.0/functional:54, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/support/detail/as_fusion_element.hpp:15, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/algorithm/transformation/push_back.hpp:11, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp:21, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/view/iterator_range/detail/segments_impl.hpp:14, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/view/iterator_range/iterator_range.hpp:22, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/view/iterator_range.hpp:11, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/sequence/intrinsic/detail/segmented_begin.hpp:13, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/sequence/intrinsic/begin.hpp:18, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/adapted/boost_tuple/detail/convert_impl.hpp:12, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/adapted/boost_tuple.hpp:20, > from > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/fusion/adapted.hpp:15, > from prog.cc:2: > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1592:7: > note: candidate: 'void std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::insert(std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::iterator, std::initializer_list<_Tp>) [with _CharT = char; > _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; > std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator = > __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >>; typename __gnu_cxx::__alloc_traits<typename > __gnu_cxx::__alloc_traits<_Alloc>::rebind<_CharT>::other>::pointer = > char*]' > insert(iterator __p, initializer_list<_CharT> __l) > ^~~~~~ > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1592:7: > note: no known conversion for argument 2 from 'const > std::vector<char, std::allocator<char> >' to > 'std::initializer_list<char>' > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1612:7: > note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& > std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::insert(std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::size_type, const std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; > _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, > _Traits, _Alloc>::size_type = long unsigned int]' > insert(size_type __pos1, const basic_string& __str) > ^~~~~~ > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1612:7: > note: no known conversion for argument 1 from > 'std::__cxx11::basic_string<char>::iterator' {aka > '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >>'} to 'std::__cxx11::basic_string<char>::size_type' {aka 'long > unsigned int'} > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1635:7: > note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& > std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::insert(std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::size_type, const std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::size_type) [with _CharT = char; _Traits = > std::char_traits<char>; _Alloc = std::allocator<char>; > std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long > unsigned int]' > insert(size_type __pos1, const basic_string& __str, > ^~~~~~ > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1635:7: > note: candidate expects 4 arguments, 2 provided > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1658:7: > note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& > std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::insert(std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::size_type, const _CharT*, std::__cxx11::basic_string<_CharT, > _Traits, _Alloc>::size_type) [with _CharT = char; _Traits = > std::char_traits<char>; _Alloc = std::allocator<char>; > std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long > unsigned int]' > insert(size_type __pos, const _CharT* __s, size_type __n) > ^~~~~~ > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1658:7: > note: candidate expects 3 arguments, 2 provided > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1677:7: > note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& > std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::insert(std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::size_type, const _CharT*) [with _CharT = char; _Traits = > std::char_traits<char>; _Alloc = std::allocator<char>; > std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long > unsigned int]' > insert(size_type __pos, const _CharT* __s) > ^~~~~~ > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1677:7: > note: no known conversion for argument 1 from > 'std::__cxx11::basic_string<char>::iterator' {aka > '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >>'} to 'std::__cxx11::basic_string<char>::size_type' {aka 'long > unsigned int'} > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1701:7: > note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& > std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::insert(std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::size_type, _CharT) [with _CharT = char; _Traits = > std::char_traits<char>; _Alloc = std::allocator<char>; > std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long > unsigned int]' > insert(size_type __pos, size_type __n, _CharT __c) > ^~~~~~ > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1701:7: > note: candidate expects 3 arguments, 2 provided > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1719:7: > note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::insert(std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::__const_iterator, _CharT) [with _CharT = char; _Traits = > std::char_traits<char>; _Alloc = std::allocator<char>; > std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator = > __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >>; typename __gnu_cxx::__alloc_traits<typename > __gnu_cxx::__alloc_traits<_Alloc>::rebind<_CharT>::other>::pointer = > char*; std::__cxx11::basic_string<_CharT, _Traits, > _Alloc>::__const_iterator = __gnu_cxx::__normal_iterator<const char*, > std::__cxx11::basic_string<char> >; typename > __gnu_cxx::__alloc_traits<typename > __gnu_cxx::__alloc_traits<_Alloc>::rebind<_CharT>::other>::const_pointer > = const char*]' > insert(__const_iterator __p, _CharT __c) > ^~~~~~ > /opt/wandbox/gcc-head/include/c++/8.0.0/bits/basic_string.h:1719:7: > note: no known conversion for argument 2 from 'const > std::vector<char, std::allocator<char> >' to 'char' > > > On Tue, Jan 2, 2018 at 9:55 PM, JF <[email protected]> wrote: >> In your https://wandbox.org/permlink/nDoBOQGXzUhZ07Al: >> >> 1. Comment line 58. >> 2. Change line 59 to "pass = l.size() < 63;" >> 3. Change line 76 to "_label %= repeat(1, >> 63)[_let_dig_hyp][label_validation()];" >> >> Result: >> >> Start >> >> Running with Boost version: '106501' >> Parsing 'E-PHUMZ8G8j1KEZG26C' -> E-PHUMZ8G8j1KEZG26C (PASS) >> >> 0 >> >> Finish >> >> 2018-01-03 3:28 GMT+01:00 Michael Powell <[email protected]>: >>> >>> On Tue, Jan 2, 2018 at 9:10 PM, Michael Powell <[email protected]> >>> wrote: >>> > On Tue, Jan 2, 2018 at 7:15 PM, JF <[email protected]> wrote: >>> >> Hi Michael, >>> >> If I understand RFC correctly, is this what you want? >>> > >>> > Have you tried to compile this? I have tried this and received the >>> > following errors: >>> >>> With oversimplified grammar, without the semantic action, the parser >>> passes. With the semantic action, the parser fails. >>> >>> https://wandbox.org/permlink/hCcMbPzJnRYWLEnU >>> >>> Incidentally, I can leverage repeat(1, 63)[_let_dig_hyp] in this >>> instance to vet the length aspects of a valid label. However, again, >>> as soon as I inject the semantic action, boom, failure to parse. >>> >>> https://wandbox.org/permlink/nDoBOQGXzUhZ07Al >>> >>> I've followed the docs, as well as the proposed approach, to no avail. >>> >>> > https://wandbox.org/permlink/ATvd59XXSLbqB07s >>> > >>> > prog.cc: In instantiation of 'void >>> > client::label_validation::operator()(Attrib&, Context&, bool&) const >>> > [with Attrib = boost::iterator_range<__gnu_cxx::__normal_iterator<const >>> > char*, std::__cxx11::basic_string<char> > >; Context = >>> > >>> > boost::spirit::context<boost::fusion::cons<std::__cxx11::basic_string<char>&, >>> > boost::fusion::nil_>, boost::fusion::vector<> >]': >>> > >>> > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/support/action_dispatch.hpp:95:25: >>> > required from 'decltype (f(a, b, c)) >>> > >>> > boost::spirit::traits::action_dispatch<Component>::fwd_attrib_context_pass::operator()(F&&, >>> > A&&, B&&, C&&, Rest&& ...) [with F = const client::label_validation&; >>> > A = boost::iterator_range<__gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> > >&; B = >>> > >>> > boost::spirit::context<boost::fusion::cons<std::__cxx11::basic_string<char>&, >>> > boost::fusion::nil_>, boost::fusion::vector<> >&; C = bool&; Rest = >>> > {}; Component = >>> > >>> > boost::spirit::qi::raw_directive<boost::spirit::qi::plus<boost::spirit::qi::reference<const >>> > boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >, char(), >>> > boost::spirit::unused_type, boost::spirit::unused_type, >>> > boost::spirit::unused_type> > > >; decltype (f(a, b, c)) = void]' >>> > >>> > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/support/action_dispatch.hpp:143:17: >>> > required from 'static void >>> > boost::spirit::traits::action_dispatch<Component>::caller(F&&, A&& >>> > ...) [with F = const client::label_validation&; A = >>> > {boost::iterator_range<__gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char, std::char_traits<char>, >>> > std::allocator<char> > > >&, >>> > >>> > boost::spirit::context<boost::fusion::cons<std::__cxx11::basic_string<char, >>> > std::char_traits<char>, std::allocator<char> >&, boost::fusion::nil_>, >>> > boost::fusion::vector<> >&, bool&}; Component = >>> > >>> > boost::spirit::qi::raw_directive<boost::spirit::qi::plus<boost::spirit::qi::reference<const >>> > boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >, char(), >>> > boost::spirit::unused_type, boost::spirit::unused_type, >>> > boost::spirit::unused_type> > > >]' >>> > >>> > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/support/action_dispatch.hpp:153:19: >>> > required from 'bool >>> > boost::spirit::traits::action_dispatch<Component>::operator()(const >>> > F&, Attribute&, Context&) [with F = client::label_validation; >>> > Attribute = boost::iterator_range<__gnu_cxx::__normal_iterator<const >>> > char*, std::__cxx11::basic_string<char> > >; Context = >>> > >>> > boost::spirit::context<boost::fusion::cons<std::__cxx11::basic_string<char>&, >>> > boost::fusion::nil_>, boost::fusion::vector<> >; Component = >>> > >>> > boost::spirit::qi::raw_directive<boost::spirit::qi::plus<boost::spirit::qi::reference<const >>> > boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >, char(), >>> > boost::spirit::unused_type, boost::spirit::unused_type, >>> > boost::spirit::unused_type> > > >]' >>> > >>> > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/action/action.hpp:69:55: >>> > required from 'bool boost::spirit::qi::action<Subject, >>> > Action>::parse(Iterator&, const Iterator&, Context&, const Skipper&, >>> > Attribute&) const [with Iterator = __gnu_cxx::__normal_iterator<const >>> > char*, std::__cxx11::basic_string<char> >; Context = >>> > >>> > boost::spirit::context<boost::fusion::cons<std::__cxx11::basic_string<char>&, >>> > boost::fusion::nil_>, boost::fusion::vector<> >; Skipper = >>> > boost::spirit::unused_type; Attribute = const >>> > boost::spirit::unused_type; Subject = >>> > >>> > boost::spirit::qi::raw_directive<boost::spirit::qi::plus<boost::spirit::qi::reference<const >>> > boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >, char(), >>> > boost::spirit::unused_type, boost::spirit::unused_type, >>> > boost::spirit::unused_type> > > >; Action = client::label_validation]' >>> > >>> > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp:33:65: >>> > required from 'bool boost::spirit::qi::detail::parser_binder<Parser, >>> > Auto>::call(Iterator&, const Iterator&, Context&, const Skipper&, >>> > mpl_::true_) const [with Iterator = __gnu_cxx::__normal_iterator<const >>> > char*, std::__cxx11::basic_string<char> >; Skipper = >>> > boost::spirit::unused_type; Context = >>> > >>> > boost::spirit::context<boost::fusion::cons<std::__cxx11::basic_string<char>&, >>> > boost::fusion::nil_>, boost::fusion::vector<> >; Parser = >>> > >>> > boost::spirit::qi::action<boost::spirit::qi::raw_directive<boost::spirit::qi::plus<boost::spirit::qi::reference<const >>> > boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >, char(), >>> > boost::spirit::unused_type, boost::spirit::unused_type, >>> > boost::spirit::unused_type> > > >, client::label_validation>; Auto = >>> > mpl_::bool_<false>; mpl_::true_ = mpl_::bool_<true>]' >>> > >>> > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/nonterminal/detail/parser_binder.hpp:53:67: >>> > [ skipping 4 instantiation contexts, use >>> > -ftemplate-backtrace-limit=0 to disable ] >>> > >>> > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/function/function_template.hpp:1061:16: >>> > required from 'boost::function<R(T0, T1, T2, T3)>::function(Functor, >>> > typename boost::enable_if_c<(! boost::is_integral<Functor>::value), >>> > int>::type) [with Functor = >>> > >>> > boost::spirit::qi::detail::parser_binder<boost::spirit::qi::action<boost::spirit::qi::raw_directive<boost::spirit::qi::plus<boost::spirit::qi::reference<const >>> > boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >, char(), >>> > boost::spirit::unused_type, boost::spirit::unused_type, >>> > boost::spirit::unused_type> > > >, client::label_validation>, >>> > mpl_::bool_<false> >; R = bool; T0 = >>> > __gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >&; T1 = const >>> > __gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >&; T2 = >>> > >>> > boost::spirit::context<boost::fusion::cons<std::__cxx11::basic_string<char>&, >>> > boost::fusion::nil_>, boost::fusion::vector<> >&; T3 = const >>> > boost::spirit::unused_type&; typename boost::enable_if_c<(! >>> > boost::is_integral<Functor>::value), int>::type = int]' >>> > >>> > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/function/function_template.hpp:1114:5: >>> > required from 'typename boost::enable_if_c<(! >>> > boost::is_integral<Functor>::value), boost::function<R(T0, T1, T2, >>> > T3)>&>::type boost::function<R(T0, T1, T2, T3)>::operator=(Functor) >>> > [with Functor = >>> > >>> > boost::spirit::qi::detail::parser_binder<boost::spirit::qi::action<boost::spirit::qi::raw_directive<boost::spirit::qi::plus<boost::spirit::qi::reference<const >>> > boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >, char(), >>> > boost::spirit::unused_type, boost::spirit::unused_type, >>> > boost::spirit::unused_type> > > >, client::label_validation>, >>> > mpl_::bool_<false> >; R = bool; T0 = >>> > __gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >&; T1 = const >>> > __gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >&; T2 = >>> > >>> > boost::spirit::context<boost::fusion::cons<std::__cxx11::basic_string<char>&, >>> > boost::fusion::nil_>, boost::fusion::vector<> >&; T3 = const >>> > boost::spirit::unused_type&; typename boost::enable_if_c<(! >>> > boost::is_integral<Functor>::value), boost::function<R(T0, T1, T2, >>> > T3)>&>::type = boost::function<bool(__gnu_cxx::__normal_iterator<const >>> > char*, std::__cxx11::basic_string<char> >&, const >>> > __gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >&, >>> > >>> > boost::spirit::context<boost::fusion::cons<std::__cxx11::basic_string<char>&, >>> > boost::fusion::nil_>, boost::fusion::vector<> >&, const >>> > boost::spirit::unused_type&)>&]' >>> > >>> > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/nonterminal/rule.hpp:183:19: >>> > required from 'static void boost::spirit::qi::rule<Iterator, T1, T2, >>> > T3, T4>::define(boost::spirit::qi::rule<Iterator, T1, T2, T3, T4>&, >>> > const Expr&, mpl_::true_) [with Auto = mpl_::bool_<false>; Expr = >>> > boost::proto::exprns_::expr<boost::proto::tagns_::tag::subscript, >>> > boost::proto::argsns_::list2<const >>> > boost::proto::exprns_::expr<boost::proto::tagns_::tag::subscript, >>> > boost::proto::argsns_::list2<const >>> > boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal, >>> > boost::proto::argsns_::term<boost::spirit::tag::raw>, 0>&, const >>> > boost::proto::exprns_::expr<boost::proto::tagns_::tag::unary_plus, >>> > >>> > boost::proto::argsns_::list1<boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const >>> > char*, std::__cxx11::basic_string<char> >, char(), >>> > boost::spirit::unused_type, boost::spirit::unused_type, >>> > boost::spirit::unused_type>&>, 1>&>, 2>&, >>> > boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal, >>> > boost::proto::argsns_::term<const client::label_validation&>, 0> >, >>> > 2>; Iterator = __gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >; T1 = >>> > std::__cxx11::basic_string<char>(); T2 = boost::spirit::unused_type; >>> > T3 = boost::spirit::unused_type; T4 = boost::spirit::unused_type; >>> > mpl_::true_ = mpl_::bool_<true>]' >>> > >>> > /opt/wandbox/boost-1.65.1/gcc-head/include/boost/spirit/home/qi/nonterminal/rule.hpp:221:32: >>> > required from 'boost::spirit::qi::rule<Iterator, T1, T2, T3, T4>& >>> > boost::spirit::qi::rule<Iterator, T1, T2, T3, T4>::operator=(const >>> > Expr&) [with Expr = >>> > boost::proto::exprns_::expr<boost::proto::tagns_::tag::subscript, >>> > boost::proto::argsns_::list2<const >>> > boost::proto::exprns_::expr<boost::proto::tagns_::tag::subscript, >>> > boost::proto::argsns_::list2<const >>> > boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal, >>> > boost::proto::argsns_::term<boost::spirit::tag::raw>, 0>&, const >>> > boost::proto::exprns_::expr<boost::proto::tagns_::tag::unary_plus, >>> > >>> > boost::proto::argsns_::list1<boost::spirit::qi::rule<__gnu_cxx::__normal_iterator<const >>> > char*, std::__cxx11::basic_string<char> >, char(), >>> > boost::spirit::unused_type, boost::spirit::unused_type, >>> > boost::spirit::unused_type>&>, 1>&>, 2>&, >>> > boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal, >>> > boost::proto::argsns_::term<const client::label_validation&>, 0> >, >>> > 2>; Iterator = __gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >; T1 = >>> > std::__cxx11::basic_string<char>(); T2 = boost::spirit::unused_type; >>> > T3 = boost::spirit::unused_type; T4 = boost::spirit::unused_type]' >>> > prog.cc:79:20: required from >>> > 'client::my_grammar<Iterator>::my_grammar() [with Iterator = >>> > __gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> >]' >>> > prog.cc:129:20: required from here >>> > prog.cc:58:20: error: 'class >>> > boost::iterator_range<__gnu_cxx::__normal_iterator<const char*, >>> > std::__cxx11::basic_string<char> > >' has no member named 'length' >>> > pass = l.length() < 63; >>> > ~~^~~~~~ >>> > >>> > >>> > >>> >> #include <boost/spirit/include/qi.hpp> >>> >> >>> >> namespace qi = boost::spirit::qi; >>> >> namespace ascii = qi::ascii; >>> >> >>> >> template >>> >> < >>> >> typename Iterator >>> >>> >>> >> struct grammar : qi::grammar<Iterator, std::vector<std::string>()> >>> >> { >>> >> qi::rule<Iterator, std::vector<std::string>()> domain; >>> >> qi::rule<Iterator, std::string()> label; >>> >> >>> >> grammar() >>> >> : grammar::base_type(domain) >>> >> { >>> >> domain = label >> *('.' >> label); >>> >> label %= qi::raw[ascii::alpha >> *(ascii::alnum | '-')][check_label()]; >>> >> } >>> >> >>> >> struct check_label >>> >> { >>> >> template >>> >> < >>> >> typename Attrib, typename Context >>> >>> >>> >> void operator()(Attrib &attr, Context &context, bool &pass) const >>> >> { >>> >> auto label_length = attr.size(); >>> >> auto last_char = attr[label_length - 1]; >>> >> if(label_length < 64 && std::isalnum(last_char)) >>> >> { >>> >> pass = true; >>> >> } >>> >> else >>> >> { >>> >> pass = false; >>> >> } >>> >> } >>> >> }; >>> >> }; >>> >> >>> >> int main() >>> >> { >>> >> std::string input = "E-PHUMZ8G8j1KEZG26C.xx1.-"; >>> >> >>> >> std::vector<std::string> domain; >>> >> >>> >> auto b = input.cbegin(); >>> >> auto e = input.cend(); >>> >> >>> >> if(qi::parse(b, e, grammar<std::string::const_iterator>(), domain)) >>> >> { >>> >> std::string d; >>> >> >>> >> for(const auto &label : domain) >>> >> { >>> >> if(!d.empty()) >>> >> { >>> >> d += '.'; >>> >> } >>> >> >>> >> d += label; >>> >> } >>> >> >>> >> std::cout << "matched " << d << '\n'; >>> >> if(b != e) >>> >> { >>> >> std::cout << "unmatched " << std::string(b, e) << '\n'; >>> >> } >>> >> } >>> >> else >>> >> { >>> >> std::cout << "nothing matched\n"; >>> >> } >>> >> } >>> >> >>> >> ? >>> >> >>> >> (There may be errors... It's 1AM here.) >>> >> >>> >> J >>> >> >>> >> 2018-01-03 0:54 GMT+01:00 Joel de Guzman <[email protected]>: >>> >>> >>> >>> On 03/01/2018 6:59 AM, Michael Powell wrote: >>> >>>> >>> >>>> On Tue, Jan 2, 2018 at 3:24 PM, Joel de Guzman<[email protected]> >>> >>>> wrote: >>> >>>>> >>> >>>>> On 02/01/2018 11:42 PM, Michael Powell wrote: >>> >>>>>> >>> >>>>>> Now after providing additional follow up, live examples, etc, any >>> >>>>>> feedback on this at all? >>> >>>>>> >>> >>>>>> This cannot be that difficult, however any of the documentation, >>> >>>>>> etc, >>> >>>>>> I am scanning does not seem to work or are incomplete at best, >>> >>>>>> which >>> >>>>>> isn't helping the case. >>> >>>>> >>> >>>>> >>> >>>>> Not sure. I know you presented some code, but is it minimal enough? >>> >>>>> To me, minimal code would look like something like the code here: >>> >>>>> http://boost-spirit.com/home/feedback-and-support/ >>> >>>> >>> >>>> There is nothing I consider extraneous in the examples I presented. >>> >>>> There is a test scaffold, the grammar, and the AST. It's all pretty >>> >>>> clearly outlined in the examples. Anything more or other than that I >>> >>>> would consider NOT minimal. >>> >>> >>> >>> >>> >>> Give it some more effort. For example, focus on one exact problem. The >>> >>> very subject of this thread does not even convey any usable >>> >>> information >>> >>> other than "not working". Most often than not, I could distill >>> >>> problematic >>> >>> code to only a few lines --one or two rules is ideal. You do not even >>> >>> have to have grammars. Also, get rid of the scaffolding, etc. >>> >>> >>> >>> Again, you'll have better luck if the essence of your question can >>> >>> be fully comprehended in one or two minutes. Do I need to study RFC >>> >>> 1034 to understand your problem? If not, then that information is >>> >>> extraneous. If yes, then your issue requires too much investment in >>> >>> time (at least for me). >>> >>> >>> >>> Regards, >>> >>> -- >>> >>> Joel de Guzman >>> >>> http://www.ciere.com >>> >>> http://boost-spirit.com >>> >>> http://www.cycfi.com/ >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> Check out the vibrant tech community on one of the world's most >>> >>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >>> >>> _______________________________________________ >>> >>> Spirit-general mailing list >>> >>> [email protected] >>> >>> https://lists.sourceforge.net/lists/listinfo/spirit-general >>> >> >>> >> >>> >> >>> >> >>> >> ------------------------------------------------------------------------------ >>> >> Check out the vibrant tech community on one of the world's most >>> >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >>> >> _______________________________________________ >>> >> Spirit-general mailing list >>> >> [email protected] >>> >> https://lists.sourceforge.net/lists/listinfo/spirit-general >>> >> >>> >>> >>> ------------------------------------------------------------------------------ >>> Check out the vibrant tech community on one of the world's most >>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >>> _______________________________________________ >>> Spirit-general mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/spirit-general >> >> >> >> ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> _______________________________________________ >> Spirit-general mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/spirit-general >> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot