6 #ifndef SPIRIT_PO_PO_GRAMMAR_HPP_INCLUDED
7 #define SPIRIT_PO_PO_GRAMMAR_HPP_INCLUDED
9 #ifndef BOOST_SPIRIT_USE_PHOENIX_V3
10 #define BOOST_SPIRIT_USE_PHOENIX_V3
13 #include <boost/spirit/include/qi.hpp>
14 #include <boost/phoenix/core.hpp>
15 #include <boost/phoenix/operator.hpp>
16 #include <boost/fusion/include/std_pair.hpp>
17 #include <boost/fusion/include/define_struct.hpp>
21 #include <boost/optional/optional.hpp>
28 typedef unsigned int uint;
29 namespace qi = boost::spirit::qi;
30 namespace phoenix = boost::phoenix;
32 template <
typename Iterator>
33 struct po_grammar : qi::grammar<Iterator, po_message()> {
58 qi::rule<Iterator, qi::locals<bool>>
fuzzy;
81 escaped_character = lit(
'\\') >> (char_(
"\'\"\\") | (lit(
'n') >> attr(
'\n')) | (lit(
't') >> attr(
'\t')));
115 fuzzy = lit(
'#') >> (&lit(
','))[qi::_a =
false] >> *(lit(
',') >> -(lit(
" fuzzy")[qi::_a =
true]) >> *(char_ -
'\n' -
',')) >> lit(
'\n') >> qi::eps(qi::_a);
std::pair< std::string, std::vector< std::string > > plural_and_strings_type
qi::rule< Iterator, std::string()> multiline_string
qi::rule< Iterator > skipped_block
qi::rule< Iterator, std::vector< std::string >)> message_single_str
qi::rule< Iterator > preamble_comment_line
qi::rule< Iterator, po_message()> message
qi::rule< Iterator, std::string()> message_id_plural
qi::rule< Iterator, bool()> message_preamble
consume any number of non-white comment line (using #).
qi::rule< Iterator, plural_and_strings_type()> message_plural
qi::rule< Iterator, std::string()> single_line_string
qi::rule< Iterator, std::string()> message_context
qi::rule< Iterator, std::vector< std::string >uint)> message_strs
qi::rule< Iterator, std::string(uint)> message_str_plural
qi::rule< Iterator, plural_and_strings_type()> message_singular
qi::rule< Iterator, qi::locals< bool > > fuzzy
qi::rule< Iterator > white_line
qi::rule< Iterator, char()> escaped_character
qi::rule< Iterator > ignored_comments
consume any number of blocks, consisting of any number of comments followed by a white line
qi::rule< Iterator, std::string()> message_str
qi::rule< Iterator > comment_line
qi::rule< Iterator > preamble_comment_block
qi::rule< Iterator > skipped_line
qi::rule< Iterator, std::string()> message_id