X3_DEBUG compilation error

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

X3_DEBUG compilation error

Mario Lang
Hi.

My grammar is almost ready.  So now I am beginning to throw real input
at it, which unfortunately produces some unexpected parse failures.  So
off I go, and #define BOOST_SPIRIT_X3_DEBUG.  I am getting a compile
error (attached).  The parser compiles without X3_DEBUG defined.
I am seeing Attribute and Attribute_, while Attribute_ is a
std::vector<Attribute>.  I am wondering, is this a corner-case not
handled in the debug code, or is there some subtle problem with my usage
of X3?  Unfortunately, I didn't manage to isolate the case into a small
file yet.  Since this error message doesn't ring a bell at all, I am
hoping some of you might have an idea what could be wrong.

Code is on github.com/mlang/bmc in x3 branch.  Since X3 isn't released
yet, you need to fiddle with the include paths to get x3_tests to
compile.  I haven't committed the X3_DEBUG stuff yet, since it doesn't
work...

--- a/parser.cpp
+++ b/parser.cpp
@@ -1,3 +1,6 @@
+#include <boost/fusion/include/io.hpp>
+#include <iostream>
+#define BOOST_SPIRIT_X3_DEBUG
 #include <bmc/braille/parser/ast_adapted.hpp>
 #include <bmc/braille/parser/parser.hpp>
 #include <boost/spirit/home/support/char_encoding/unicode.hpp>
@@ -6,6 +9,8 @@
 
 namespace bmc { namespace braille { namespace parser {
 
+namespace ast { using boost::fusion::operator<<; }
+
 using boost::spirit::x3::_attr;
 using boost::spirit::x3::_val;
 using boost::spirit::x3::annotate_on_success;


In file included from /tmp/src/boost/boost/spirit/home/x3/nonterminal/rule.hpp:10:0,
                 from /tmp/src/boost/boost/spirit/home/x3/nonterminal.hpp:10,
                 from /tmp/src/boost/boost/spirit/home/x3.hpp:17,
                 from parser.cpp:7:
/tmp/src/boost/boost/spirit/home/x3/nonterminal/detail/rule.hpp: In instantiation of ‘static bool boost::spirit::x3::detail::rule_parser<Attribute, ID>::call_rule_definition(const RHS&, const char*, Iterator&, const Iterator&, const Context&, ActualAttribute&, ExplicitAttrPropagation) [with RHS = boost::spirit::x3::list<boost::spirit::x3::rule<bmc::braille::parser::paragraph_element, bmc::braille::parser::ast::paragraph_element>, boost::spirit::x3::alternative<bmc::braille::parser::brl_parser<boost::spirit::char_encoding::unicode, std::equal_to, 63u>, boost::spirit::x3::eol_parser> >; Iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >; Context = boost::spirit::x3::context<boost::spirit::x3::error_handler_tag, const std::reference_wrapper<boost::spirit::x3::error_handler<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> > > >, boost::spirit::x3::unused_type>; ActualAttribute = std::vector<bmc::braille::parser::ast::paragraph>; ExplicitAttrPropagation = mpl_::bool_<false>; Attribute = bmc::braille::parser::ast::paragraph; ID = bmc::braille::parser::paragraph]’:
/tmp/src/boost/boost/spirit/home/x3/nonterminal/rule.hpp:64:39:   required from ‘bool boost::spirit::x3::rule_definition<ID, RHS, Attribute, force_attribute_>::parse(Iterator&, const Iterator&, const Context&, boost::spirit::x3::unused_type, Attribute_&) const [with Iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >; Context = boost::spirit::x3::context<boost::spirit::x3::error_handler_tag, const std::reference_wrapper<boost::spirit::x3::error_handler<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> > > >, boost::spirit::x3::unused_type>; Attribute_ = std::vector<bmc::braille::parser::ast::paragraph>; ID = bmc::braille::parser::paragraph; RHS = boost::spirit::x3::list<boost::spirit::x3::rule<bmc::braille::parser::paragraph_element, bmc::braille::parser::ast::paragraph_element>, boost::spirit::x3::alternative<bmc::braille::parser::brl_parser<boost::spirit::char_encoding::unicode, std::equal_to, 63u>, boost::spirit::x3::eol_parser> >; Attribute = bmc::braille::parser::ast::paragraph; bool force_attribute_ = false]’
parser.cpp:618:1:   required from ‘bool bmc::braille::parser::parse_rule(boost::spirit::x3::rule<bmc::braille::parser::paragraph, bmc::braille::parser::ast::paragraph>, Iterator&, const Iterator&, const Context&, Attribute&) [with Iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >; Context = boost::spirit::x3::context<boost::spirit::x3::error_handler_tag, const std::reference_wrapper<boost::spirit::x3::error_handler<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> > > >, boost::spirit::x3::unused_type>; Attribute = std::vector<bmc::braille::parser::ast::paragraph>]’
/tmp/src/boost/boost/spirit/home/x3/nonterminal/rule.hpp:116:30:   required from ‘bool boost::spirit::x3::rule<ID, Attribute, force_attribute>::parse(Iterator&, const Iterator&, const Context&, boost::spirit::x3::unused_type, Attribute_&) const [with Iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >; Context = boost::spirit::x3::context<boost::spirit::x3::error_handler_tag, const std::reference_wrapper<boost::spirit::x3::error_handler<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> > > >, boost::spirit::x3::unused_type>; Attribute_ = std::vector<bmc::braille::parser::ast::paragraph>; ID = bmc::braille::parser::paragraph; Attribute = bmc::braille::parser::ast::paragraph; bool force_attribute_ = false]’
/tmp/src/boost/boost/spirit/home/x3/operator/detail/sequence.hpp:324:13:   required from ‘bool boost::spirit::x3::detail::parse_sequence(const Parser&, Iterator&, const Iterator&, const Context&, RContext&, Attribute&, boost::spirit::x3::traits::tuple_attribute) [with Parser = boost::spirit::x3::sequence<boost::spirit::x3::sequence<boost::spirit::x3::sequence<boost::spirit::x3::sequence<boost::spirit::x3::optional<boost::spirit::x3::sequence<boost::spirit::x3::sequence<boost::spirit::x3::sequence<boost::spirit::x3::kleene<bmc::braille::parser::brl_parser<boost::spirit::char_encoding::unicode, std::equal_to, 63u> >, boost::spirit::x3::rule<bmc::braille::parser::key_and_time_signature, bmc::braille::parser::ast::key_and_time_signature> >, boost::spirit::x3::kleene<bmc::braille::parser::brl_parser<boost::spirit::char_encoding::unicode, std::equal_to, 63u> > >, boost::spirit::x3::eol_parser> >, boost::spirit::x3::optional<boost::spirit::x3::repeat_directive<bmc::braille::parser::brl_parser<boost::spirit::char_encoding::unicode, std::equal_to, 63u>, boost::spirit::x3::detail::infinite_count<int> > > >, boost::spirit::x3::optional<boost::spirit::x3::sequence<boost::spirit::x3::rule<bmc::braille::parser::section_number, unsigned int>, bmc::braille::parser::brl_parser<boost::spirit::char_encoding::unicode, std::equal_to, 63u> > > >, boost::spirit::x3::optional<boost::spirit::x3::sequence<boost::spirit::x3::rule<bmc::braille::parser::measure_range, bmc::braille::parser::ast::measure_range>, bmc::braille::parser::brl_parser<boost::spirit::char_encoding::unicode, std::equal_to, 63u> > > >, boost::spirit::x3::rule<bmc::braille::parser::paragraph, bmc::braille::parser::ast::paragraph> >; Iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >; Context = boost::spirit::x3::context<boost::spirit::x3::error_handler_tag, const std::reference_wrapper<boost::spirit::x3::error_handler<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> > > >, boost::spirit::x3::unused_type>; RContext = bmc::braille::parser::ast::section; Attribute = bmc::braille::parser::ast::section]’
/tmp/src/boost/boost/spirit/home/x3/operator/sequence.hpp:44:42:   required from ‘bool boost::spirit::x3::sequence<Left, Right>::parse(Iterator&, const Iterator&, const Context&, RContext&, Attribute&) const [with Iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >; Context = boost::spirit::x3::context<boost::spirit::x3::error_handler_tag, const std::reference_wrapper<boost::spirit::x3::error_handler<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> > > >, boost::spirit::x3::unused_type>; RContext = bmc::braille::parser::ast::section; Attribute = bmc::braille::parser::ast::section; Left = boost::spirit::x3::sequence<boost::spirit::x3::sequence<boost::spirit::x3::sequence<boost::spirit::x3::optional<boost::spirit::x3::sequence<boost::spirit::x3::sequence<boost::spirit::x3::sequence<boost::spirit::x3::kleene<bmc::braille::parser::brl_parser<boost::spirit::char_encoding::unicode, std::equal_to, 63u> >, boost::spirit::x3::rule<bmc::braille::parser::key_and_time_signature, bmc::braille::parser::ast::key_and_time_signature> >, boost::spirit::x3::kleene<bmc::braille::parser::brl_parser<boost::spirit::char_encoding::unicode, std::equal_to, 63u> > >, boost::spirit::x3::eol_parser> >, boost::spirit::x3::optional<boost::spirit::x3::repeat_directive<bmc::braille::parser::brl_parser<boost::spirit::char_encoding::unicode, std::equal_to, 63u>, boost::spirit::x3::detail::infinite_count<int> > > >, boost::spirit::x3::optional<boost::spirit::x3::sequence<boost::spirit::x3::rule<bmc::braille::parser::section_number, unsigned int>, bmc::braille::parser::brl_parser<boost::spirit::char_encoding::unicode, std::equal_to, 63u> > > >, boost::spirit::x3::optional<boost::spirit::x3::sequence<boost::spirit::x3::rule<bmc::braille::parser::measure_range, bmc::braille::parser::ast::measure_range>, bmc::braille::parser::brl_parser<boost::spirit::char_encoding::unicode, std::equal_to, 63u> > > >; Right = boost::spirit::x3::rule<bmc::braille::parser::paragraph, bmc::braille::parser::ast::paragraph>]’
/tmp/src/boost/boost/spirit/home/x3/operator/detail/sequence.hpp:324:13:   [ skipping 45 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/tmp/src/boost/boost/spirit/home/x3/nonterminal/rule.hpp:116:30:   required from ‘bool boost::spirit::x3::rule<ID, Attribute, force_attribute>::parse(Iterator&, const Iterator&, const Context&, boost::spirit::x3::unused_type, Attribute_&) const [with Iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >; Context = boost::spirit::x3::context<boost::spirit::x3::error_handler_tag, const std::reference_wrapper<boost::spirit::x3::error_handler<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> > > >, boost::spirit::x3::unused_type>; Attribute_ = bmc::braille::parser::ast::score; ID = bmc::braille::parser::score; Attribute = bmc::braille::parser::ast::score; bool force_attribute_ = false]’
/tmp/src/boost/boost/spirit/home/x3/directive/with.hpp:62:21:   required from ‘bool boost::spirit::x3::with_directive<Subject, ID, T>::parse(Iterator&, const Iterator&, const Context&, RContext&, Attribute&) const [with Iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >; Context = boost::spirit::x3::unused_type; RContext = const boost::spirit::x3::unused_type; Attribute = bmc::braille::parser::ast::score; Subject = boost::spirit::x3::rule<bmc::braille::parser::score, bmc::braille::parser::ast::score>; ID = boost::spirit::x3::error_handler_tag; T = const std::reference_wrapper<boost::spirit::x3::error_handler<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> > > >]’
/tmp/src/boost/boost/spirit/home/x3/core/parse.hpp:35:68:   required from ‘bool boost::spirit::x3::parse_main(Iterator&, Iterator, const Parser&, Attribute&) [with Iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >; Parser = boost::spirit::x3::with_directive<boost::spirit::x3::rule<bmc::braille::parser::score, bmc::braille::parser::ast::score>, boost::spirit::x3::error_handler_tag, const std::reference_wrapper<boost::spirit::x3::error_handler<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> > > > >; Attribute = bmc::braille::parser::ast::score]’
/tmp/src/boost/boost/spirit/home/x3/core/parse.hpp:47:26:   required from ‘bool boost::spirit::x3::parse(Iterator&, Iterator, const Parser&, Attribute&) [with Iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >; Parser = boost::spirit::x3::with_directive<boost::spirit::x3::rule<bmc::braille::parser::score, bmc::braille::parser::ast::score>, boost::spirit::x3::error_handler_tag, const std::reference_wrapper<boost::spirit::x3::error_handler<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> > > > >; Attribute = bmc::braille::parser::ast::score]’
parser.cpp:641:23:   required from ‘bmc::braille::parser::result_t<typename boost::spirit::x3::traits::attribute_of<R, C>::type, Iterator> bmc::braille::parser::parse_with_error_handler(Iterator&, const Iterator&, const Parser&, std::ostream&, std::string, bool) [with Iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >; Parser = boost::spirit::x3::rule<bmc::braille::parser::score, bmc::braille::parser::ast::score>; Context = boost::spirit::x3::unused_type; bmc::braille::parser::result_t<typename boost::spirit::x3::traits::attribute_of<R, C>::type, Iterator> = std::tuple<boost::optional<bmc::braille::parser::ast::score>, boost::spirit::x3::error_handler<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t, std::char_traits<char32_t>, std::allocator<char32_t> > > > >; typename boost::spirit::x3::traits::attribute_of<R, C>::type = bmc::braille::parser::ast::score; bmc::braille::parser::error_handler<Iterator> = boost::spirit::x3::error_handler<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> > >; std::ostream = std::basic_ostream<char>; std::string = std::basic_string<char>]’
parser.cpp:705:64:   required from here
/tmp/src/boost/boost/spirit/home/x3/nonterminal/detail/rule.hpp:329:60: error: no matching function for call to ‘boost::spirit::x3::detail::context_debug<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >, std::vector<bmc::braille::parser::ast::paragraph> >::context_debug(const char*&, __gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >&, const __gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >&, transform_attr&, bool&)’
                 dbg(rule_name, first, last, attr_, ok_parse);
                                                            ^
/tmp/src/boost/boost/spirit/home/x3/nonterminal/detail/rule.hpp:62:9: note: candidate: boost::spirit::x3::detail::context_debug<Iterator, Attribute>::context_debug(const char*, const Iterator&, const Iterator&, const Attribute&, const bool&) [with Iterator = __gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >; Attribute = std::vector<bmc::braille::parser::ast::paragraph>]
         context_debug(
         ^
/tmp/src/boost/boost/spirit/home/x3/nonterminal/detail/rule.hpp:62:9: note:   no known conversion for argument 4 from ‘transform_attr {aka bmc::braille::parser::ast::paragraph}’ to ‘const std::vector<bmc::braille::parser::ast::paragraph>&’
/tmp/src/boost/boost/spirit/home/x3/nonterminal/detail/rule.hpp:60:12: note: candidate: constexpr boost::spirit::x3::detail::context_debug<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >, std::vector<bmc::braille::parser::ast::paragraph> >::context_debug(const boost::spirit::x3::detail::context_debug<__gnu_cxx::__normal_iterator<const char32_t*, std::basic_string<char32_t> >, std::vector<bmc::braille::parser::ast::paragraph> >&)
     struct context_debug
            ^
/tmp/src/boost/boost/spirit/home/x3/nonterminal/detail/rule.hpp:60:12: note:   candidate expects 1 argument, 5 provided

--
CYa,
  ⡍⠁⠗⠊⠕ | Debian Developer <URL:http://debian.org/>
  .''`. | Get my public key via finger mlang/[hidden email]
 : :' : | 1024D/7FC1A0854909BCCDBE6C102DDFFC022A6B113E44
 `. `'
   `-      <URL:http://delysid.org/>  <URL:http://www.staff.tugraz.at/mlang/>

------------------------------------------------------------------------------
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general