本文整理汇总了C++中qi::lit方法的典型用法代码示例。如果您正苦于以下问题:C++ qi::lit方法的具体用法?C++ qi::lit怎么用?C++ qi::lit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qi
的用法示例。
在下文中一共展示了qi::lit方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Event_Bool_No_Param
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")
;
}
示例2: execute
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;
}
示例3: lit
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))
]
;
}
示例4: parse_dasharray
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;
}
示例5:
best_cmd_parser< Iterator >::best_cmd_parser():
best_cmd_parser::base_type(start)
{
using qi::lit;
start =
lit("best")[phx::nothing]
;
}
示例6:
chart_cmd_parser< Iterator >::chart_cmd_parser():
chart_cmd_parser::base_type(start)
{
using qi::lit;
start =
lit("chart")
[phx::nothing]
// >> enum_vals
;
}
示例7: vista_header_grammer
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 {" );
}
示例8:
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{})
]
;
}
示例9:
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{})
]
;
}
示例10: tagger
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)]];
}