Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. template <typename Iterator>
  2. struct employee_parser : qi::grammar<Iterator, employee(), ascii::space_type>
  3. {
  4.     employee_parser() : employee_parser::base_type(start)
  5.     {
  6.         using qi::int_;
  7.         using qi::lit;
  8.         using qi::double_;
  9.         using qi::lexeme;
  10.         using ascii::char_;
  11.  
  12.         quoted_string %= lexeme['"' >> +(char_ - '"') >> '"'];
  13.  
  14.         start %=
  15.             lit("employee")
  16.             >> '{'
  17.             >>  int_ >> ','
  18.             >>  quoted_string >> ','
  19.             >>  quoted_string >> ','
  20.             >>  double_
  21.             >>  '}'
  22.             ;
  23.     }
  24.  
  25.     qi::rule<Iterator, std::string(), ascii::space_type> quoted_string;
  26.     qi::rule<Iterator, employee(), ascii::space_type> start;
  27. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement