本文整理汇总了C++中statik::STAR方法的典型用法代码示例。如果您正苦于以下问题:C++ statik::STAR方法的具体用法?C++ statik::STAR怎么用?C++ statik::STAR使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类statik
的用法示例。
在下文中一共展示了statik::STAR方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parser
// parser = ((cmd|codeblock)end)*
auto_ptr<Rule> exstatik::CreateParser_Complex() {
auto_ptr<Rule> parser(STAR("parser"));
Rule* line = parser->AddChild(SEQ("line"));
//line->AddChild(META("WS"));
Rule* cmdorcode = line->AddChild(OR("Or (cmdorcode)"));
Rule* end = line->AddChild(OR("end"));
end->AddChild(META(";"));
end->AddChild(META("\n"));
Rule* cmdline = cmdorcode->AddChild(SEQ("cmdline"));
cmdline->AddChild(META("ID", "program"));
Rule* cmdargs = cmdline->AddChild(STAR("* (cmdargs)"));
Rule* cmdarg = cmdargs->AddChild(SEQ("cmdarg"));
cmdarg->AddChild(META("WS"));
cmdarg->AddChild(META("arg"));
Rule* codeblock = cmdorcode->AddChild(SEQ("codeblock"));
codeblock->AddChild(META("{"));
Rule* stmts = codeblock->AddChild(STAR("* (stmts)"));
codeblock->AddChild(META("}"));
Rule* stmt = stmts->AddChild(OR("Or (stmt)"));
Rule* newstmt = stmt->AddChild(SEQ("new stmt"));
newstmt->AddChild(META("new"));
newstmt->AddChild(META("WS"));
newstmt->AddChild(META("identifier", "ID"));
newstmt->AddChild(META(";"));
Rule* delstmt = stmt->AddChild(SEQ("del stmt"));
delstmt->AddChild(META("del"));
delstmt->AddChild(META("WS"));
delstmt->AddChild(META("identifier", "ID"));
delstmt->AddChild(META(";"));
return parser;
}
示例2: lexer
auto_ptr<Rule> exstatik::CreateLexer_Nick() {
auto_ptr<Rule> lexer(STAR("star"));
Rule* or1_ = lexer->AddChild(OR("or1"));
or1_->AddChild(KEYWORD("car"));
or1_->AddChild(KEYWORD("cat"));
Rule* star2_ = or1_->AddChild(STAR("star2"));
star2_->AddChild(KEYWORD("dog"));
return lexer;
}
示例3: lexer
auto_ptr<Rule> exstatik::CreateLexer_Splash() {
auto_ptr<Rule> lexer(STAR("star"));
Rule* or_ = lexer->AddChild(OR("or"));
or_->AddChild(KEYWORD("cat"));
or_->AddChild(KEYWORD("dog"));
or_->AddChild(KEYWORD("car"));
return lexer;
}
示例4: while
//.........这里部分代码省略.........
jump_statement_->AddChild(goto_statement_);
jump_statement_->AddChild(continue_statement_);
jump_statement_->AddChild(break_statement_);
jump_statement_->AddChild(return_statement_);
/*
labeled-statement:
identifier : statement
case constant-expression : statement
default : statement
expression-statement:
expression_OPT ;
(compound-statement)
selection-statement:
if ( expression ) statement
if ( expression ) statement else statement
switch ( expression ) statement
iteration-statement:
while ( expression ) statement
do statement while ( expression ) ;
for ( expression_OPT ; expression_OPT ; expression_OPT ) statement
*/
auto_ptr<Rule> statement_(OR("statement")); // compound_statement_
//statement_->AddChild(labeled_statement_);
//statement_->AddChild(expression_statement_);
//statement_->AddChild(selection_statement_);
//statement_->AddChild(iteration_statement_);
statement_->AddChild(jump_statement_);
auto_ptr<Rule> compound_statement_(SEQ("compound-statement")); // function_definition_
compound_statement_->CapOutput("compound-statement");
compound_statement_->AddChild(META("{", "{"));
Rule* declaration_STAR = compound_statement_->AddChild(STAR("declaration-STAR"));
Rule* statement_STAR = compound_statement_->AddChild(STAR("statement-STAR"));
Rule* statement_REC = statement_STAR->AddChild(statement_);
compound_statement_->AddChild(META("}", "}"));
/*
type-name:
specifier-qualifier-list abstract-declarator_OPT
*/
auto_ptr<Rule> direct_abstract_declarator_3(SEQ("direct-abstract-declarator-3")); // direct_abstract_declarator_
auto_ptr<Rule> direct_abstract_declarator_2(SEQ("direct-abstract-declarator-2")); // direct_abstract_declarator_
auto_ptr<Rule> direct_abstract_declarator_1(SEQ("direct-abstract-declarator-1")); // direct_abstract_declarator_
auto_ptr<Rule> direct_abstract_declarator_(OR("direct-abstract-declarator")); // abstract_declarator_1
Rule* direct_abstract_declarator_1_REC = direct_abstract_declarator_->AddChild(direct_abstract_declarator_1);
Rule* direct_abstract_declarator_2_REC = direct_abstract_declarator_->AddChild(direct_abstract_declarator_2);
Rule* direct_abstract_declarator_3_REC = direct_abstract_declarator_->AddChild(direct_abstract_declarator_3);
auto_ptr<Rule> abstract_declarator_1(SEQ("abstract-declarator-1")); // abstract_declarator_
auto_ptr<Rule> abstract_declarator_(OR("abstract-declarator")); // parameter_declaration_1
auto_ptr<Rule> initializer_2(SEQ("initializer-2")); // initializer_1
auto_ptr<Rule> initializer_1(SEQ("initializer-1")); // initializer_
auto_ptr<Rule> initializer_(OR("initializer")); // init_declarator_
initializer_->AddChild(assignment_expression_);
Rule* initializer_1_REC = initializer_->AddChild(initializer_1);
Rule* initializer_2_REC = initializer_->AddChild(initializer_2);