X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FConsole%2FParse.cc;h=e4e1e660f415b3b1ed425d4a02e938e63107f661;hb=0461eef93912cb9d454d726b4a7b4ccf50ed31bd;hp=dc1dbce4a6f5f30caf0b1debfe2ba20035731332;hpb=958bdb52c39fa39f4ef91cafd9628bcb4f85a03c;p=senf.git diff --git a/Utils/Console/Parse.cc b/Utils/Console/Parse.cc index dc1dbce..e4e1e66 100644 --- a/Utils/Console/Parse.cc +++ b/Utils/Console/Parse.cc @@ -349,6 +349,29 @@ prefix_ void senf::console::CommandParser::parseArguments(std::string const & ar } } +prefix_ void senf::console::CommandParser::parsePath(std::string const & path, + ParseCommandInfo & info) +{ + typedef boost::spirit::position_iterator PositionIterator; + PositionIterator b (path.begin(), path.end(), std::string("")); + PositionIterator e (path.end(), path.end(), std::string("")); + detail::ParseDispatcher::BindInfo bind (impl().dispatcher, info); + boost::spirit::parse_info result; + try { + result = boost::spirit::parse( b, e, + impl().grammar.use_parser(), + impl().grammar.use_parser() ); + } + catch (boost::spirit::parser_error & ex) { + throwParserError(ex); + } + if (! result.full) { + boost::spirit::file_position pos (result.stop.get_position()); + throw ParserErrorException("path expected") + << "\nat " << pos.file << ":" << pos.line << ":" << pos.column; + } +} + struct senf::console::CommandParser::SetIncremental { SetIncremental(CommandParser & parser) : parser_ (parser) {