Event_Bool_No_Param () : Event_Bool_No_Param::base_type(start) { using qi::lit; start = lit("STATE_TIMEOUT") | lit("RAMPING_COMPLETED") | lit("PASSIVE_MEAS_COMPLETED") ; }
bool Compiler::execute() { using phoenix::ref; using qi::lit; using qi::no_skip; // iterate over stream input typedef std::istreambuf_iterator<char> base_iterator_type; base_iterator_type in_begin(m_input); // convert input iterator to forward iterator, usable by spirit parser typedef spirit::multi_pass<base_iterator_type> forward_iterator_type; forward_iterator_type fwd_begin = spirit::make_default_multi_pass(in_begin); forward_iterator_type fwd_end; // Initialize global scope Scope globalScope; StdLib::Init(globalScope); // Parsers ExpParser<forward_iterator_type> exp_; CmdParser<forward_iterator_type> cmd_(exp_); CodeParser<forward_iterator_type> code_(exp_); typedef qi::rule<forward_iterator_type, std::string(), ascii::space_type> StringRule; typedef qi::rule<forward_iterator_type, ascii::space_type> VoidRule; StringRule cmdline_ = lit('[') > (cmd_(ref(globalScope)) | code_(ref(globalScope))) > lit(']') ; VoidRule program_ = +( cmdline_[ref(m_output) << qi::_1] > -no_skip[ lit("\n")[ref(m_output) << endl] ] ); //BOOST_SPIRIT_DEBUG_NODE(cmdline_); //BOOST_SPIRIT_DEBUG_NODE(program_); bool r = qi::phrase_parse( fwd_begin, fwd_end, program_, ascii::space ); if (!r || fwd_begin != fwd_end) { return false; } // Cleanup the global scope :) m_output << globalScope.bytecode() << endl; return r; }
repeat_remove_cmd_parser< Iterator >::repeat_remove_cmd_parser(): repeat_remove_cmd_parser::base_type(start) { using qi::lit; using qi::uint_; using qi::_val; using qi::_1; start = (lit("remove") | lit("rm") | lit("r")) >> uint_ [ _val = phx::construct< repeat_remove_cmd >(_1 - phx::val(1u)) ] ; }
bool parse_dasharray(Iterator first, Iterator last, std::vector<double>& dasharray) { using qi::double_; using qi::phrase_parse; using qi::_1; using qi::lit; using qi::char_; #if BOOST_VERSION > 104200 using qi::no_skip; #else using qi::lexeme; #endif using phoenix::push_back; // SVG // dasharray ::= (length | percentage) (comma-wsp dasharray)? // no support for 'percentage' as viewport is unknown at load_map // bool r = phrase_parse(first, last, (double_[push_back(phoenix::ref(dasharray), _1)] % #if BOOST_VERSION > 104200 no_skip[char_(", ")] #else lexeme[char_(", ")] #endif | lit("none")), qi::ascii::space); if (first != last) { return false; } return r; }
best_cmd_parser< Iterator >::best_cmd_parser(): best_cmd_parser::base_type(start) { using qi::lit; start = lit("best")[phx::nothing] ; }
chart_cmd_parser< Iterator >::chart_cmd_parser(): chart_cmd_parser::base_type(start) { using qi::lit; start = lit("chart") [phx::nothing] // >> enum_vals ; }
vista_header_grammer() : vista_header_grammer::base_type ( vista_header ) { using qi::lit; using qi::lexeme; using ascii::char_; using ascii::string; using namespace qi::labels; using phoenix::at_c; using phoenix::push_back; start_tag = lit ( "V-data 2 {" ); }
repeat_add_cmd_parser< Iterator >::repeat_add_cmd_parser(): repeat_add_cmd_parser::base_type(start) { using qi::lit; using qi::_val; start = lit("add") [ _val = phx::val(repeat_add_cmd{}) ] ; }
debug_cmd_parser< Iterator >::debug_cmd_parser(): debug_cmd_parser::base_type(start) { using qi::lit; using qi::_val; start = lit("dbg") [ _val = phx::val(debug_cmd{}) ] ; }
tagger(F f_ = F()) : tagger::base_type(start), f(f_) { using qi::omit; using qi::raw; using qi::eps; using qi::lit; using qi::_1; using qi::_r1; using qi::_r2; start = omit[raw[lit(_r2)] [f(_r1, _1)]]; epsilon = omit[raw[eps] [f(_r1, _1)]]; }