• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ parse_expression函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: parse_variable

// variable = identifier { '.' identifier | '[' expression ']' }
static enum v7_err parse_variable(struct v7 *v7) {
  struct v7_val **v = NULL, key = str_to_val(v7->tok, v7->tok_len);
  struct v7_val *ns = find(v7, &key), ro_prop;

  if (!v7->no_exec) {
    TRY(v7_make_and_push(v7, V7_UNDEF));
    v = v7_top(v7);
  }

  while (*v7->cursor == '.' || *v7->cursor == '[') {
    int ch = *v7->cursor;

    TRY(match(v7, ch));
    CHECK(v7->no_exec || ns != NULL, V7_SYNTAX_ERROR);
    v7->cur_obj = ns;

    if (ch == '.') {
      TRY(parse_identifier(v7));
      if (!v7->no_exec) {
        key = str_to_val(v7->tok, v7->tok_len);
        ns = get2(ns, &key);
        if (ns != NULL && ns->type == V7_RO_PROP) {
          ns->v.prop_func(v7->cur_obj, &ro_prop);
          ns = &ro_prop;
        }
      }
    } else {
      TRY(parse_expression(v7));
      TRY(match(v7, ']'));
      if (!v7->no_exec) {
        ns = get2(ns, v7_top(v7)[-1]);
        if (ns != NULL && ns->type == V7_RO_PROP) {
          ns->v.prop_func(v7->cur_obj, &ro_prop);
          ns = &ro_prop;
        }
        TRY(inc_stack(v7, -1));
      }
    }
  }

  if (v != NULL && ns != NULL) {
    free_val(v7, v[-1]);
    v[-1] = ns;
    v[-1]->ref_count++;
  }

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


示例17: parse_if

static ifstatement_t* parse_if(parser_t* p)
{
	ifstatement_t* ifstatement = (ifstatement_t*)malloc(sizeof(ifstatement_t));
	match(p, TT_IF);
	ifstatement->expression = parse_expression(p);
	ifstatement->block = parse_block(p);
	token_type_t tok = get_token(p->t);
	if (TT_ELSE == tok) {
		ifstatement->else_block = parse_block(p);
		match(p, TT_END);
	} else {
		ifstatement->else_block = 0;
		expect(p, TT_END);
	}
	return ifstatement;
}
开发者ID:cenan,项目名称:betik,代码行数:16,代码来源:parser.c


示例18: parse_if

/*
 *	IF statement
 */
void
parse_if(TOKEN *first_token)
{
    TOKEN	token;

    out_white_space(first_token);
    out_str("if (");

    if ((parse_expression(&token) != RESERVED) ||
            (token.token_type != THEN))
        parse_error("Missing THEN in IF statement");
    else {
        out_pre_line(&token);
        out_char(')');
        out_white_space(&token);
    }
}
开发者ID:dbremner,项目名称:retrocomputing,代码行数:20,代码来源:parse.c


示例19: create_node

Node* Parser::parse_constant_definition()
{ // expects TOKEN_WORD as a current token
	Node *node = create_node(NODE_CONSTANT_DEFINITION);
	node->constant_definition_name = _current->word;

	next_token();

	if (_current->kind != TOKEN_EQUALS) {
		error("Error: expected '=' in constant definition for \"%s\"",
				node->constant_definition_name.c_str());
	} else {
		next_token();
		node->next.push_back(parse_expression());
	}

	return node;
}
开发者ID:ruslashev,项目名称:revl,代码行数:17,代码来源:parser.cpp


示例20: step

	void Parser::parse_return(StatementList *list)
	{
		ReturnNode *node = list->add<ReturnNode>(memory_pool);

		node->range.capture(lexer.lexeme);
		
		step();

		if(is_expression(lexeme()))
		{
			node->has_value = true;
			node->value = parse_expression();
			lexer.lexeme.prev_set(node->range);
		}
		else
			node->has_value = false;
	}
开发者ID:Zoxc,项目名称:legion,代码行数:17,代码来源:statements.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ parse_file函数代码示例发布时间:2022-05-30
下一篇:
C++ parse_expr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap