37 #include <boost/spirit/include/qi.hpp>
44 URIGrammar::URIGrammar() :
45 URIGrammar::base_type ( start )
47 using namespace boost::spirit;
48 start = protocol > hostname > - ( port ) > - ( path ) > -( extension ) > - ( data_pairs_vector );
53 protocol = + ( qi::char_ - qi::lit (
":" ) ) > qi::lit (
"://" );
54 hostname = + ( qi::char_ - qi::lit (
":" ) - qi::lit (
"?" ) ) ;
55 port = qi::lit (
":" ) > + ( qi::char_ - ascii::punct ) ;
56 path = qi::lit (
"/" ) > + ( qi::char_ - qi::lit (
"." ) - qi::lit (
"?" ) );
57 extension = qi::lit (
"." ) > + ( qi::char_ - qi::lit (
"?" ) ) ;
58 data_pairs_vector = qi::lit (
"?" ) > *data_pairs;
59 data_pairs = data_pairs_1 > data_pairs_2;
60 data_pairs_1 = + ( qi::char_ - qi::lit (
"=" ) ) > qi::lit (
"=" );
61 data_pairs_2 = * ( qi::char_ - qi::lit (
"&" ) ) >> - ( qi::lit (
"&" ) );
63 empty_string = boost::spirit::qi::as_string[ boost::spirit::eps ];