当前位置: 首页>>代码示例>>C++>>正文


C++ parse_expression函数代码示例

本文整理汇总了C++中parse_expression函数的典型用法代码示例。如果您正苦于以下问题:C++ parse_expression函数的具体用法?C++ parse_expression怎么用?C++ parse_expression使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了parse_expression函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dump_endpoint

static int
dump_endpoint(int argc, char** argv)
{
	if (argc < 2) {
		kprintf("usage: tcp_endpoint [address]\n");
		return 0;
	}

	TCPEndpoint* endpoint = (TCPEndpoint*)parse_expression(argv[1]);
	endpoint->Dump();

	return 0;
}
开发者ID:Sylvain78,项目名称:haiku,代码行数:13,代码来源:tcp.cpp

示例2: selection_statement_init

static struct selection_statement *parse_switch_statement(struct parser *parser) {
	struct expression *expr;
	struct selection_statement *selstmt = selection_statement_init(SEL_TYPE_SWITCH);
	struct statement *stmt;

	expect(parser->lexer, TOK_LPAREN);
	expr = parse_expression(parser);
	expect(parser->lexer, TOK_RPAREN);
	stmt = parse_statement(parser);

	selstmt->switch_stmt.expr = expr;
	selstmt->switch_stmt.stmt = stmt;
	return selstmt;
}
开发者ID:shunting1986,项目名称:scc,代码行数:14,代码来源:stmt-parser.c

示例3: iteration_statement_init

static struct iteration_statement *parse_while_statement(struct parser *parser) {
	struct expression *expr;
	struct statement *stmt;
	struct iteration_statement *iter_stmt = iteration_statement_init(ITER_TYPE_WHILE);

	expect(parser->lexer, TOK_LPAREN);
	expr = parse_expression(parser);
	expect(parser->lexer, TOK_RPAREN);
	stmt = parse_statement(parser);

	iter_stmt->while_stmt.expr = expr;
	iter_stmt->while_stmt.stmt = stmt;
	return iter_stmt;
}
开发者ID:shunting1986,项目名称:scc,代码行数:14,代码来源:stmt-parser.c

示例4: parse_primary_expression

void parse_primary_expression(void) {
  Token t = get_token();
  if (t.type == T_OPEN_BRACKET) {
    parse_expression();
    t = get_token();
    if (t.type != T_CLOSE_BRACKET) {
      fprintf(stderr, "Syntax Error: Mismatch Bracket\n");
      exit(-1);
    }
  } else {
    unget_token();
    parse_split();
  }
}
开发者ID:Trietptm-on-Coding-Algorithms,项目名称:ecalc,代码行数:14,代码来源:parse.c

示例5: alloc_node

struct node *parse_argument(struct compiler *compiler)
{
    struct node *result = alloc_node(compiler, N_ARGUMENT);

    result->left = parse_expression(compiler);
    result->right = 0;

    if(lexer_matches(compiler, T_COMMA))
        result->right = parse_argument(compiler);
    else
        result->right = 0;

    return result;
}
开发者ID:stonegao,项目名称:mirb,代码行数:14,代码来源:parser.c

示例6: xml_attribute_cast_impl

 static inline boost::optional<mapnik::expression_ptr> xml_attribute_cast_impl(xml_tree const& tree, std::string const& source)
 {
     std::map<std::string,mapnik::expression_ptr>::const_iterator itr = tree.expr_cache_.find(source);
     if (itr != tree.expr_cache_.end())
     {
         return itr->second;
     }
     else
     {
         mapnik::expression_ptr expr = parse_expression(source);
         tree.expr_cache_.emplace(source,expr);
         return expr;
     }
 }
开发者ID:Airphrame,项目名称:mapnik,代码行数:14,代码来源:xml_attribute_cast.hpp

示例7: put_location_marker

/** parse_FOR            parse for statements.
 *
 *      for(<statement>; <expression>; <expression>)
 *              <statement>;
 *
 * @param p_function_id : ptr to this statements function Id.
 */
void cx_parser::parse_FOR(cx_symtab_node* p_function_id) {

    int break_point = put_location_marker();
    int statementMarker = put_location_marker();
    int condition_marker = put_location_marker();
    int increment_marker = put_location_marker();

    get_token_append(); // for

    conditional_get_token_append(tc_left_paren, err_missing_left_paren);

    if (token != tc_semicolon) {
        // declaration would go here //
        parse_declarations_or_assignment(p_function_id);
        conditional_get_token_append(tc_semicolon, err_missing_semicolon);
    } else get_token_append();

    fixup_location_marker(condition_marker);
    if (token != tc_semicolon) {

        // expr 2
        check_boolean(parse_expression());
        conditional_get_token_append(tc_semicolon, err_missing_semicolon);
    } else get_token_append();

    fixup_location_marker(increment_marker);
    if (token != tc_right_paren) {
        // expr 3
        parse_expression();
    }

    conditional_get_token_append(tc_right_paren, err_missing_right_paren);
    fixup_location_marker(statementMarker);
    parse_statement(p_function_id);
    fixup_location_marker(break_point);

}
开发者ID:DTSCode,项目名称:Cx,代码行数:44,代码来源:parse_statement.cpp

示例8: IVR_WARN

NodeBase* NodeStopRecord::run(base_script_t* param) {
    if (NULL == param) {
        IVR_WARN("base_script_t pointer should not be null");
        return NULL;
    }

    IVR_TRACE("%s", enter(param->name_var_map).c_str());

    const char* exit = EXIT_FAIL;
    string callid;
    fw_id_t fs_no = param->fid;

    if (true == parse_expression(_callid, param->name_var_map, callid)) {
        IVR_TRACE("callid=%s", callid.c_str());

        fs_opr_t* opr = NULL;

        if (fs_mgr_t::instance()->fetch_opr(fs_no, &opr) == IVR_SUCCESS) {
            if (NULL != opr) {
                if (opr->record(callid.c_str(), "", false) == IVR_SUCCESS) {
                    exit = EXIT_SUCC;
                } else {
                    IVR_WARN("opr stop record failed(callid %s)", _callid.c_str());
                }

                fs_mgr_t::instance()->free_opr(&opr);
            } else {
                IVR_WARN("fetch opr failed. freeswitch no is %d", fs_no);
            }
        }
    } else {
        IVR_WARN("parse callid failed(%s)", _callid.c_str());
    }

    NodeBase* exit_node_ptr = NULL;
    std::map<std::string, NodeBase*>::iterator citr;
    citr = _exit_node_map.find(exit);

    if (citr != _exit_node_map.end()) {
        exit_node_ptr = citr->second;

        IVR_TRACE("%s exit from %s()",
                  leave(param->name_var_map).c_str(), exit);
    } else {
        IVR_WARN("Can not find exit %s in _exit_node_map", exit);
    }

    return exit_node_ptr;
}
开发者ID:AaronZhangL,项目名称:CC,代码行数:49,代码来源:node_stoprecord.cpp

示例9: eat

struct instruction *parse_for(void)
{
  int decreasing = 0;
  eat(FOR);
  struct expr *lhs = parse_expression();
  struct assignment *a = parse_assignment(lhs);
  if (current_lang == LANG_EN && lookahead[0]->type == DECREASING)
  {
    decreasing = 1;
    eat(DECREASING);
  }
  else
    eat(UNTIL);
  struct expr *until = parse_expression();
  if (current_lang == LANG_FR && lookahead[0]->type == DECREASING)
  {
    decreasing = 1;
    eat(DECREASING);
  }
  eat(DO); eat(EOL);
  instructionlist_t block = parse_block();
  eat(END); eat(FOR); eat(EOL);
  return forblock(a, until, decreasing, block);
}
开发者ID:Saruta,项目名称:a2c,代码行数:24,代码来源:parser.c

示例10: parse_return

/*
 *	RETURN statement
 *	Handles RETURN [ <expression> ] ;
 */
void
parse_return(TOKEN *first_token)
{
    TOKEN	token;
    int	token_class;

    out_white_space(first_token);
    out_str("return");

    token_class = parse_expression(&token);
    if (token_class != END_OF_LINE)
        parse_error("';' expected");
    else
        out_token(&token);
}
开发者ID:dbremner,项目名称:retrocomputing,代码行数:19,代码来源:parse.c

示例11: parse_if_statement

static enum v7_err parse_if_statement(struct v7 *v7) {
  int old_no_exec = v7->no_exec;

  TRY(match(v7, '('));
  TRY(parse_expression(v7));
  TRY(match(v7, ')'));
  assert(v7->no_exec || v7->sp > 0);  // Stack may be empty if v7->no_exec
  if (!v7->no_exec && !v7_is_true(v7_top(v7)[-1])) {
    v7->no_exec = 1;
  }
  TRY(parse_compound_statement(v7));
  v7->no_exec = old_no_exec;

  return V7_OK;
}
开发者ID:di3online,项目名称:v7,代码行数:15,代码来源:v7.c

示例12: temp_at

struct at_type *
temp_at()
{
    if (at != NULL)
	free_at(at);
    
    at = (struct at_type *) gp_alloc(sizeof(struct at_type), "action table");

    memset(at, 0, sizeof(*at));		/* reset action table !!! */
    at_size = MAX_AT_LEN;

    parse_recursion_level = 0;
    parse_expression();
    return (at);
}
开发者ID:Reen,项目名称:gnuplot,代码行数:15,代码来源:parse.c

示例13: parse_statement

//  statement  =  declaration | return_statement | if_statement
//                assignment | expression [ ";" ]
static enum v7_err parse_statement(struct v7 *v7, int *is_return_statement) {
  if (*v7->cursor == '_' || is_alpha(*v7->cursor)) {
    TRY(parse_identifier(v7));    // Load identifier into v7->tok, v7->tok_len
    if (test_token(v7, "var", 3)) {
      TRY(parse_declaration(v7));
    } else if (test_token(v7, "return", 6)) {
      TRY(parse_return_statement(v7));
      if (is_return_statement != NULL) *is_return_statement = 1;
    } else if (test_token(v7, "if", 2)) {
      TRY(parse_if_statement(v7));
    } else {
      v7->cursor = v7->tok;
      TRY(parse_expression(v7));
    }
  } else {
    TRY(parse_expression(v7));
  }

  // Skip optional semicolons
  while (*v7->cursor == ';') match(v7, *v7->cursor);

  //return is_return_statement;
  return V7_OK;
}
开发者ID:di3online,项目名称:v7,代码行数:26,代码来源:v7.c

示例14: cmd_faults

static int
cmd_faults(int argc, char** argv)
{
	if (argc > 2) {
		print_debugger_command_usage(argv[0]);
		return B_KDEBUG_ERROR;
	}

	if (argc == 2)
		gInvokeCommandDirectly = parse_expression(argv[1]) == 0;

	kprintf("Fault handling is %s%s.\n", argc == 2 ? "now " : "",
		gInvokeCommandDirectly ? "off" : "on");
	return 0;
}
开发者ID:mylegacy,项目名称:haiku,代码行数:15,代码来源:debug_builtin_commands.cpp

示例15: SiS19X_DebuggerCommand

static int SiS19X_DebuggerCommand(int argc, char** argv)
{
    const char* usageInfo = "usage:" DRIVER_NAME " [index] <t|r>\n"
                            " - t - dump Transmit ring;\n"
                            " - r - dump Receive ring.\n"
                            " - g - dump reGisters.\n";

    uint64 cardId = 0;
    int cmdIndex = 1;

    if (argc < 2) {
        kprintf(usageInfo);
        return 0;
    } else if (argc > 2) {
        cardId = parse_expression(argv[2]);
        cmdIndex++;
    }

    if (cardId >= numCards) {
        kprintf("%" B_PRId64 " - invalid index.\n", cardId);
        kprintf(usageInfo);
        return 0;
    }

    Device* device = gDevices[cardId];
    if (device == NULL) {
        kprintf("Invalid device pointer!!!.\n");
        return 0;
    }

    switch(*argv[cmdIndex]) {
    case 'g':
        device->DumpRegisters();
        break;
    case 't':
        device->fTxDataRing.Dump();
        break;
    case 'r':
        device->fRxDataRing.Dump();
        break;
    default:
        kprintf("'%s' - invalid parameter\n", argv[cmdIndex]);
        kprintf(usageInfo);
        break;
    }

    return 0;
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:48,代码来源:Driver.cpp


注:本文中的parse_expression函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。