From: g0dil Date: Fri, 13 Nov 2009 15:29:12 +0000 (+0000) Subject: Utils/Console: Join multiple consecutive '/' chars in parser X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=247619677f93babcb621649e3728238bfdbc8646;p=senf.git Utils/Console: Join multiple consecutive '/' chars in parser git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1525 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Utils/Console/Parse.ih b/senf/Utils/Console/Parse.ih index 3af920f..e0e42d6 100644 --- a/senf/Utils/Console/Parse.ih +++ b/senf/Utils/Console/Parse.ih @@ -293,12 +293,12 @@ namespace detail { relpath = ( word [ push_back(path_, token_) ] - % ch_p('/') ) - >> ( ! ch_p('/') [ push_back(path_, construct_()) ] ) + % +ch_p('/') ) + >> ( ! (+ch_p('/') ) [ push_back(path_, construct_()) ] ) ; abspath - = ch_p('/') [ push_back(path_, construct_()) ] + = (+ch_p('/')) [ push_back(path_, construct_()) ] >> ( relpath | eps_p [ push_back(path_, construct_()) ] ) ; diff --git a/senf/Utils/Console/Parse.test.cc b/senf/Utils/Console/Parse.test.cc index 17ff943..dc9bafb 100644 --- a/senf/Utils/Console/Parse.test.cc +++ b/senf/Utils/Console/Parse.test.cc @@ -89,7 +89,7 @@ BOOST_AUTO_UNIT_TEST(commandGrammar) { static char text[] = "# Comment\n" - "doo / bii / doo arg" + "doo / bii / // doo arg" " flab::blub" " 123.434>a" " (a,b;c (huhu/{haha}))" @@ -128,7 +128,7 @@ BOOST_AUTO_UNIT_TEST(commandGrammar) { ss.str(""); BOOST_CHECK( boost::spirit::parse( - "ls /foo/bar;", + "ls //foo/bar;", grammar.use_parser(), grammar.use_parser() ) . full ); BOOST_CHECK_EQUAL( ss.str(), "builtin_ls( None('')/Word('foo')/Word('bar') )\n" ); @@ -164,7 +164,7 @@ BOOST_AUTO_UNIT_TEST(commandGrammar) { ss.str(""); BOOST_CHECK( boost::spirit::parse( - "foo/bar/ {", + "foo/bar// {", grammar.use_parser(), grammar.use_parser() ) . full ); BOOST_CHECK_EQUAL( ss.str(),