本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}