
On Tuesday 03 January 2006 22:00, Eric Niebler wrote:
Bjørn Roald wrote:
On Tuesday 03 January 2006 10:43, Eric Niebler wrote:
You'll notice that I eliminated your name_value_pair_ regex. That's because it exposed a bug in xpressive. :-P
Fixed. Please get the latest version of xpressive from the Vault.
I tried to use the xpressive library from the Boost CVS and I ran into some problems. Do I understand the above to mean that the Vault version is a better choice?
No, the Vault is pretty much the same as what is in CVS at the moment. What is the problem you're seeing?
Using static regexp to create simple grammars I encountered two problems. 1. The example code for nested grammar in the documentation produced only printout of part of the results compared to the documentation. 2. Creating a more complex grammar with static regexp I encountered core dumps attempting to print nested matches. Call stack is listed below. I suspect it is related to my lack of understanding the static regexp features/rules/limitations. I am atempting to use nested regexp in the grammar that match stuff like C++ comments and literal strings, when I remove them it all works better. I have read that regexp in general break if you nest unlimited lenght specifiers like + or *. Can that be what causes the core dump? If this is the case, is this a limitation we have to live with? Any workaround? If you like me to post the code I can reduce it as much as I can first. --- Bjørn Call Stack: (gdb) bt #0 0x0805648b in std::ostream_iterator<char, char, std::char_traits<char>>::operator= (this=0xbfe80af0, __value=@0x0) at stream_iterator.h:196 #1 0x0805be0d in std::__copy<char const*, std::ostream_iterator<char, char, std::char_traits<char> > > (__first=0x0, __last=0x8c3bd13 "}..\" .. {dfgdg() {aa} fddd \"dffdfd\\\"dfdfgg\"}{bb}ddd // ", 'g' <repeats 12 times>, "\nddd // ostekake\nddd // pannekake\n/*\n", 'd' <repeats 12 times>, "\n*/\n/*", 'e' <repeats 15 times>, "*/\n}\n\n", __result={<std::iterator<std::output_iterator_tag,void,void,void,void>> = {<No data fields>}, _M_stream = 0x1c7280, _M_string = 0x0}) at stl_algobase.h:247 #2 0x08059bf3 in std::__copy_aux2<char const*, std::ostream_iterator<char, char, std::char_traits<char> > > (__first=0x0, __last=0x8c3bd13 "}..\" .. {dfgdg(){aa} fddd \"dffdfd\\\"dfdfgg\"}{bb}ddd // ", 'g' <repeats 12 times>, "\nddd // ostekake\nddd // pannekake\n/*\n", 'd' <repeats 12 times>, "\n*/\n/*", 'e' <repeats 15 times>, "*/\n}\n\n", __result={<std::iterator<std::output_iterator_tag,void,void,void,void>> = {<No data fields>}, _M_stream = 0x1c7280, _M_string = 0x0}) at stl_algobase.h:273 #3 0x08056453 in std::__copy_ni2<char const*, std::ostream_iterator<char, char, std::char_traits<char> > > (__first=0x0, __last=0x8c3bd13 "}..\" .. {dfgdg(){aa} fddd \"dffdfd\\\"dfdfgg\"}{bb}ddd // ", 'g' <repeats 12 times>, "\nddd // ostekake\nddd // pannekake\n/*\n", 'd' <repeats 12 times>, "\n*/\n/*", 'e' <repeats 15 times>, "*/\n}\n\n", __result=Cannot access memory at address 0x0 ) at stl_algobase.h:308 #4 0x08054719 in std::__copy_ni1<__gnu_cxx::__normal_iterator<char const*, std::string>, std::ostream_iterator<char, char, std::char_traits<char> > > (__first={_M_current = 0x0}, __last={_M_current = 0x8c3bd13 "}..\" .. {dfgdg(){aa} fddd \"dffdfd\\\"dfdfgg\"}{bb}ddd // ", 'g' <repeats 12 times>, "\nddd // ostekake\nddd // pannekake\n/*\n", 'd' <repeats 12 times>, "\n*/\n/*", 'e' <repeats 15 times>, "*/\n}\n\n"}, __result=Cannot access memory at address 0x0 ) at stl_algobase.h:317 #5 0x080523bb in std::copy<__gnu_cxx::__normal_iterator<char const*, std::string>, std::ostream_iterator<char, char, std::char_traits<char> > > (__first={_M_current = 0x0}, __last={_M_current = 0x8c3bd13 "}..\" .. {dfgdg(){aa} fddd \"dffdfd\\\"dfdfgg\"}{bb}ddd // ", 'g' <repeats 12 times>, "\nddd // ostekake\nddd // pannekake\n/*\n", 'd' <repeats 12 times>, "\n*/\n/*", 'e' <repeats 15 times>, "*/\n}\n\n"}, __result=Cannot access memory at address 0x0 ) at stl_algobase.h:358 #6 0x08050be8 in boost::xpressive::operator<< <__gnu_cxx::__normal_iterator<char const*, std::string>, char, std::char_traits<char> > (sout=@0x1c7280, sub=@0x8c3be70) at sub_match.hpp:139 #7 0x080524d3 in output_nested_results::operator()<__gnu_cxx::__normal_iterator<char const*, std::string> > (this=0xbfe80d3c, what=@0x8c3bc20) at test1.cpp:28 #8 0x08050ca6 in std::for_each<std::_List_const_iterator<boost::xpressive::match_results<__gnu_cxx::__normal_iterator<char const*, std::string> > >, output_nested_results> (__first={_M_node = 0x8c3bc18}, __last={_M_node = 0xbfe80e38}, __f={tabs_ = 0}) at stl_algo.h:158 #9 0x0804ec89 in main () at test1.cpp:94