本文整理汇总了C++中statik类的典型用法代码示例。如果您正苦于以下问题:C++ statik类的具体用法?C++ statik怎么用?C++ statik使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了statik类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: lexer
auto_ptr<Rule> exstatik::CreateLexer_Simple() {
auto_ptr<Rule> lexer(STAR("lexer"));
Rule* or_ = lexer->AddChild(OR("or"));
or_->AddChild(KEYWORD("new"));
or_->AddChild(KEYWORD("del"));
or_->AddChild(KEYWORD(";"));
return lexer;
}
开发者ID:Johnicholas,项目名称:shok,代码行数:8,代码来源:Lexer.cpp
示例2: lexer
auto_ptr<Rule> exstatik::CreateLexer_JSON() {
auto_ptr<Rule> lexer(STAR("lexer"));
Rule* or_ = lexer->AddChild(OR("Or"));
or_->AddChild(KEYWORD("="));
or_->AddChild(KEYWORD("{"));
or_->AddChild(KEYWORD("}"));
or_->AddChild(KEYWORD(";"));
or_->AddChild(REGEXP("ID", boost::regex("[A-Za-z_][0-9A-Za-z_]*")));
or_->AddChild(REGEXP("INT", boost::regex("[0-9]+")));
or_->AddChild(REGEXP("STR", boost::regex("(\'([^\'\\\\\\\\]|\\\\.)*\')|(\\\"([^\\\"\\\\\\\\]|\\\\.)*\\\")")));
or_->AddChild(REGEXP("WS", boost::regex("[ \t\r]+")));
return lexer;
}
开发者ID:nfomon,项目名称:shok,代码行数:13,代码来源:Lexer.cpp
示例3: parser
// parser = ((new ;)|(del ;))*
auto_ptr<Rule> exstatik::CreateParser_Simple() {
auto_ptr<Rule> parser(STAR("parser"));
Rule* stmts_ = parser->AddChild(OR("Or (stmts)"))
->CapOutput("cmd");
Rule* newstmt_ = stmts_->AddChild(SEQ("new stmt"));
newstmt_->AddChild(META("new"));
//newstmt_->AddChild(META("x"));
newstmt_->AddChild(META(";"))
->SilenceOutput();
Rule* delstmt_ = stmts_->AddChild(SEQ("del stmt"));
delstmt_->AddChild(META("del"));
//delstmt_->AddChild(META("x"));
delstmt_->AddChild(META(";"))
->SilenceOutput();
return parser;
}
开发者ID:nfomon,项目名称:shok,代码行数:17,代码来源:Parser.cpp
示例4: while
// C parser
auto_ptr<Rule> exstatik::CreateParser_C() {
auto_ptr<Rule> identifier_(META("identifier", "ID")); // goto_statement_
auto_ptr<Rule> integer_constant_(META("integer", "INT")); // constant_
auto_ptr<Rule> character_constant_(META("char", "CHAR")); // constant_
auto_ptr<Rule> floating_constant_(META("float", "FLOAT")); // constant_
auto_ptr<Rule> enumeration_constant_(META("enum", "ENUM")); // constant_
auto_ptr<Rule> constant_(OR("constant")); // FAKE constant_expression_
constant_->AddChild(integer_constant_);
constant_->AddChild(character_constant_);
constant_->AddChild(floating_constant_);
constant_->AddChild(enumeration_constant_);
/*
postfix-expression:
primary-expression
postfix-expression [ expression ]
postfix-expression ( argument-expression-list_OPT )
postfix-expression . identifier
postfix-expression -> identifier
postfix-expression ++
postfix-expression --
primary-expression:
identifier
constant
string
( expression )
argument-expression-list:
assignment-expression
argument-expression-list , assignment-expression
*/
auto_ptr<Rule> unary_operator_(OR("unary-operator"));
unary_operator_->AddChild(META("&", "&"));
unary_operator_->AddChild(META("*", "*"));
unary_operator_->AddChild(META("+", "+"));
unary_operator_->AddChild(META("-", "-"));
unary_operator_->AddChild(META("~", "~"));
unary_operator_->AddChild(META("!", "!"));
// FAKE
auto_ptr<Rule> constant_expression_(constant_); // FAKE direct-declarator-suffix-1
/*
conditional-expression:
logical-OR-expression
logical-OR-expression ? expression : conditional-expression
constant-expression:
conditional-expression
logical-OR-expression:
logical-AND-expression
logical-OR-expression || logical-AND-expression
logical-AND-expression:
inclusive-OR-expression
logical-AND-expression && inclusive-OR-expression
inclusive-OR-expression:
exclusive-OR-expression
inclusive-OR-expression | exclusive-OR-expression
exclusive-OR-expression:
AND-expression
exclusive-OR-expression ^ AND-expression
AND-expression:
equality-expression
AND-expression & equality-expression
equality-expression:
relational-expression
equality-expression == relational-expression
equality-expression != relational-expression
relational-expression:
shift-expression
relational-expression < shift-expression
relational-expression > shift-expression
relational-expression <= shift-expression
relational-expression >= shift-expression
shift-expression:
additive-expression
shift-expression << additive-expression
shift-expression >> additive-expression
additive-expression:
multiplicative-expression
additive-expression + multiplicative-expression
additive-expression - multiplicative-expression
multiplicative-expression:
cast-expression
multiplicative-expression * cast-expression
multiplicative-expression / cast-expression
multiplicative-expression % cast-expression
cast-expression:
unary-expression
( type-name ) cast-expression
unary-expression:
postfix-expression
++ unary-expression
-- unary-expression
unary-operator cast-expression
sizeof unary-expression
sizeof ( type-name )
*/
//.........这里部分代码省略.........
开发者ID:nfomon,项目名称:shok,代码行数:101,代码来源:Parser.cpp
注:本文中的statik类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论