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

C++ parse_identifier函数代码示例

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

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



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

示例1: while

reaver::despayre::id_expression reaver::despayre::_v1::parse_id_expression(reaver::despayre::context & ctx)
{
    std::vector<identifier> identifiers;
    identifiers.push_back(parse_identifier(ctx));

    while (peek(ctx, token_type::dot))
    {
        expect(ctx, token_type::dot);
        identifiers.push_back(parse_identifier(ctx));
    }

    return { range_type{ identifiers.front().range.start(), identifiers.back().range.end() }, std::move(identifiers) };
}
开发者ID:griwes,项目名称:despayre,代码行数:13,代码来源:parser.cpp


示例2: handle_type

static void handle_type(char *s)
{
  char *name;
  symbol *sym;

  if(!(name=parse_identifier(&s))){
    syntax_error(10);  /* identifier expected */
    return;
  }
  sym=new_import(name);
  myfree(name);
  s=skip(s);
  if(*s==',')
    s=skip(s+1);
  else
    syntax_error(9);
  if(!strncmp(s,"@object",7)){
    sym->flags|=TYPE_OBJECT;
    s=skip(s+7);
  }else if(!strncmp(s,"@function",9)){
    sym->flags|=TYPE_FUNCTION;
    s=skip(s+9);
  }else
    sym->flags|=parse_constexpr(&s);
  eol(s);
}
开发者ID:ezrec,项目名称:vasm,代码行数:26,代码来源:syntax.c


示例3: parse_assingment

/*
parse_assignment

Matches a valid assignment

Parameters: none

Return: none
*/
void parse_assingment(Tree &cst){
	cst.add_branch_node("assignment");
	parse_identifier(cst);
	match("=", cst);
	parse_expr(cst);
	cst.kill_all_children();
}
开发者ID:jbancamper,项目名称:Bob-the-Compiler,代码行数:16,代码来源:parse.cpp


示例4: handle_globl

static void handle_globl(char *s)
{
  char *name;
  symbol *sym;

  for (;;) {
    if (!(name = parse_identifier(&s))) {
      syntax_error(10);  /* identifier expected */
      return;
    }
    sym = new_import(name);
    myfree(name);

    if (sym->flags & EXPORT)
      general_error(62,sym->name,get_bind_name(sym)); /* binding already set */
    sym->flags |= EXPORT;

    s = skip(s);
    if (*s == ',')
      s = skip(s+1);
    else
      break;
  }

  eol(s);
}
开发者ID:kusma,项目名称:vasm,代码行数:26,代码来源:syntax.c


示例5: process_eqe

static inline void process_eqe(struct ehca_shca *shca, struct ehca_eqe *eqe)
{
	u64 eqe_value;
	u32 token;
	struct ehca_cq *cq;

	eqe_value = eqe->entry;
	ehca_dbg(&shca->ib_device, "eqe_value=%llx", eqe_value);
	if (EHCA_BMASK_GET(EQE_COMPLETION_EVENT, eqe_value)) {
		ehca_dbg(&shca->ib_device, "Got completion event");
		token = EHCA_BMASK_GET(EQE_CQ_TOKEN, eqe_value);
		read_lock(&ehca_cq_idr_lock);
		cq = idr_find(&ehca_cq_idr, token);
		if (cq)
			atomic_inc(&cq->nr_events);
		read_unlock(&ehca_cq_idr_lock);
		if (cq == NULL) {
			ehca_err(&shca->ib_device,
				 "Invalid eqe for non-existing cq token=%x",
				 token);
			return;
		}
		reset_eq_pending(cq);
		if (ehca_scaling_code)
			queue_comp_task(cq);
		else {
			comp_event_callback(cq);
			if (atomic_dec_and_test(&cq->nr_events))
				wake_up(&cq->wait_completion);
		}
	} else {
		ehca_dbg(&shca->ib_device, "Got non completion event");
		parse_identifier(shca, eqe_value);
	}
}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:35,代码来源:ehca_irq.c


示例6: parse_keyvalue

static variable_t*
parse_keyvalue(char **ptr, group_t *head) {
    char *p = *ptr;
    char name[MAXIDLEN];
    variable_t* var;

    parse_identifier(&p, name, sizeof(name));

    skip_whitespace(&p);
    if (*p != '=') {
        fprintf(stderr, "%s:%d: No assignment detected!\n", __func__, lineno);
        return NULL;
    } else {
        p++;
    }
    skip_whitespace(&p);

    /* create variable, assume string */
    var = new_variable(name, VT_STRING);
    /* parse value of variable */
    parse_expr(&p, var, head);

    *ptr = p;
    return var;
}
开发者ID:dpuyosa,项目名称:awutils,代码行数:25,代码来源:parsecfg.c


示例7: parse_para

var_decl_t parse_para(tokenizer_t t) {
    char * filename = cur_tok(t).filename;
    int line = cur_tok(t).line_num;
    eat_it(t, TOK_INT);
    char * f0 = parse_identifier(t);
    char *f = (char *)malloc(sizeof(char) * strlen(f0) + 1);
    strcpy(f, f0);
    return mk_var_decl(filename, line, f);
}
开发者ID:nukamu,项目名称:c0_compiler,代码行数:9,代码来源:parser.c


示例8: parse_function_definition

// function_defition = "function" "(" func_params ")" "{" func_body "}"
static enum v7_err parse_function_definition(struct v7 *v7, struct v7_val **v,
                                             int num_params) {
  int i = 0, old_no_exec = v7->no_exec, old_sp = v7->sp;
  const char *src = v7->cursor;

  // If 'v' (func to call) is NULL, that means we're just parsing function
  // definition to save it's body.
  v7->no_exec = v == NULL;
  TRY(match(v7, '('));

  // Initialize new scope
  if (!v7->no_exec) {
    v7->current_scope++;
    CHECK(v7->current_scope < (int) ARRAY_SIZE(v7->scopes),
          V7_RECURSION_TOO_DEEP);
    CHECK(v7->scopes[v7->current_scope].v.props == NULL, V7_INTERNAL_ERROR);
    CHECK(v7->scopes[v7->current_scope].type == V7_OBJ, V7_INTERNAL_ERROR);
  }

  while (*v7->cursor != ')') {
    TRY(parse_identifier(v7));
    if (!v7->no_exec) {
      struct v7_val *key = v7_mkval_str(v7, v7->tok, v7->tok_len);
      struct v7_val *val = i < num_params ? v[i + 1] : v7_mkval(v7, V7_UNDEF);
      v7_set(v7, &v7->scopes[v7->current_scope], key, val);
    }
    i++;
    if (!test_and_skip_char(v7, ',')) break;
  }
  TRY(match(v7, ')'));
  TRY(match(v7, '{'));

  while (*v7->cursor != '}') {
    int is_return_statement = 0;
    inc_stack(v7, old_sp - v7->sp);   // Clean up the stack from prev stmt
    TRY(parse_statement(v7, &is_return_statement));
    if (is_return_statement) break;   // Leave statement value on stack
  }

  if (v7->no_exec) {
    TRY(v7_make_and_push(v7, V7_FUNC));
    v7_top(v7)[-1]->v.func = v7_strdup(src, (v7->cursor + 1) - src);
  }
  TRY(match(v7, '}'));

  // Deinitialize scope
  if (!v7->no_exec) {
    v7->scopes[v7->current_scope].ref_count = 1;  // Force free_val() below
    free_val(v7, &v7->scopes[v7->current_scope]);
    v7->current_scope--;
    assert(v7->current_scope >= 0);
  }

  v7->no_exec = old_no_exec;
  return V7_OK;
}
开发者ID:di3online,项目名称:v7,代码行数:57,代码来源:v7.c


示例9: get_section_name

static string
get_section_name (tree t) {
  if (N(t) != 3) return "";
  string s= as_string (t[2]);
  int i= 0, n= N(s);
  string cmd= parse_command_name (s, i);
  if (cmd != "Section" && cmd != "End") return "";
  while (i<n && is_blank (s[i])) i++;
  string ident= parse_identifier (s, i);
  return ident;
}
开发者ID:KarlHegbloom,项目名称:texmacs,代码行数:11,代码来源:parse_vernac.cpp


示例10: parse_key

/* key = identifier | string */
static int parse_key(struct frozen *f) {
  int ch = cur(f);
  if (is_alpha(ch)) {
    TRY(parse_identifier(f));
  } else if (ch == '"') {
    TRY(parse_string(f));
  } else {
    return ch == END_OF_STRING ? JSON_STRING_INCOMPLETE : JSON_STRING_INVALID;
  }
  return 0;
}
开发者ID:ALLTERCO,项目名称:mongoose-iot,代码行数:12,代码来源:frozen.c


示例11: handle_macro

static void handle_macro(char *s)
{
  char *name;

  if (name = parse_identifier(&s)) {
    eol(s);
    new_macro(name,nodotneeded ?"endm":".endm");
    myfree(name);
  }
  else
    syntax_error(10);  /* identifier expected */
}
开发者ID:ezrec,项目名称:vasm,代码行数:12,代码来源:syntax.c


示例12: parse_enunciation

static tree
parse_enunciation (string s) {
  int i= 0, n= N(s);
  string kind= parse_command_name (s, i);
  while (i<n && is_blank (s[i])) i++;
  string name= parse_identifier (s, i);
  while (i<n && is_blank (s[i])) i++;
  tree body= parse_subcommand (s (i, n));
  tree r= compound ("coq-enunciation", "", "dark grey");
  r << kind << name << body;
  return r;
}
开发者ID:KarlHegbloom,项目名称:texmacs,代码行数:12,代码来源:parse_vernac.cpp


示例13: handle_macundef

static void handle_macundef(char *s)
{
  char *name;

  while (name = parse_identifier(&s)) {
    undef_macro(name);
    myfree(name);
    s = skip(s);
    if (*s != ',')
      break;
    s = skip(s+1);
  }
  eol(s);
}
开发者ID:kusma,项目名称:vasm,代码行数:14,代码来源:syntax.c


示例14: handle_macro

static void handle_macro(char *s)
{
  char *name;

  if (name = parse_identifier(&s)) {
    s = skip(s);
    if (ISEOL(s))
      s = NULL;  /* no named arguments */
    new_macro(name,endm_dirlist,s);
    myfree(name);
  }
  else
    syntax_error(10);  /* identifier expected */
}
开发者ID:kusma,项目名称:vasm,代码行数:14,代码来源:syntax.c


示例15: parse_var_decl

var_decl_list_t parse_var_decl(tokenizer_t t) {
    var_decl_list_t d = mk_var_decl_list();
    char * filename = cur_tok(t).filename;
    int line = cur_tok(t).line_num;
    while(cur_tok(t).kind ==  TOK_INT) {
        parse_type_expr(t);
        char * f =(char *)malloc(sizeof(char) * 100);
        strcpy(f, parse_identifier(t));
        var_decl_t x = mk_var_decl(filename, line, f);
        var_decl_list_add(d, x);
        eat_it(t, TOK_SEMICOLON);
    }
    return d;
}
开发者ID:nukamu,项目名称:c0_compiler,代码行数:14,代码来源:parser.c


示例16: parse_key

/* key = identifier | string */
static int parse_key(struct frozen *f) {
  int ch = cur(f);
#if 0
  printf("%s [%.*s]\n", __func__, (int) (f->end - f->cur), f->cur);
#endif
  if (is_alpha(ch)) {
    TRY(parse_identifier(f));
  } else if (ch == '"') {
    TRY(parse_string(f));
  } else {
    return ch == END_OF_STRING ? JSON_STRING_INCOMPLETE : JSON_STRING_INVALID;
  }
  return 0;
}
开发者ID:Henk-B,项目名称:frozen,代码行数:15,代码来源:frozen.c


示例17: parse_declaration

//  declaration =   "var" identifier [ "=" expression ] [ "," { i [ "=" e ] } ]
static enum v7_err parse_declaration(struct v7 *v7) {
  int sp = v7_sp(v7);

  do {
    inc_stack(v7, sp - v7_sp(v7));  // Clean up the stack after prev decl
    TRY(parse_identifier(v7));
    if (*v7->cursor == '=') {
      if (!v7->no_exec) v7_make_and_push(v7, V7_UNDEF);
      TRY(parse_assignment(v7, &v7->scopes[v7->current_scope]));
    }
  } while (test_and_skip_char(v7, ','));

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


示例18: handle_global

static void handle_global(char *s)
{
  symbol *sym;
  char *name;
  name=s;
  if(!(name=parse_identifier(&s))){
    syntax_error(10);
    return;
  }
  sym=new_import(name);
  sym->flags|=EXPORT;
  myfree(name);
  eol(s);
}
开发者ID:ezrec,项目名称:vasm,代码行数:14,代码来源:syntax.c


示例19: parse_fun_difinition

fun_def_t parse_fun_difinition(tokenizer_t t) {
    char * filename = cur_tok(t).filename;
    int line = cur_tok(t).line_num;
    parse_type_expr(t);
    char *f0;
    char *f;
    f0 = parse_identifier(t);
    f = (char *)malloc(sizeof(char) * strlen(f0) + 1);
    strcpy(f, f0);
    eat_it(t, TOK_LPAREN);
    var_decl_list_t param = parse_para_list(t);
    eat_it(t, TOK_RPAREN);
    stmt_t body = parse_comp_stmt(t);
    return mk_fun_def(filename, line, f, param, body);
}
开发者ID:nukamu,项目名称:c0_compiler,代码行数:15,代码来源:parser.c


示例20: getval

static int getval (lcc_connection_t *c, int argc, char **argv)
{
  lcc_identifier_t ident;

  size_t   ret_values_num   = 0;
  gauge_t *ret_values       = NULL;
  char   **ret_values_names = NULL;

  int status;
  size_t i;

  assert (strcasecmp (argv[0], "getval") == 0);

  if (argc != 2) {
    fprintf (stderr, "ERROR: getval: Missing identifier.\n");
    return (-1);
  }

  memset (&ident, 0, sizeof (ident));
  status = parse_identifier (c, argv[1], &ident);
  if (status != 0)
    return (status);

#define BAIL_OUT(s) \
  do { \
    if (ret_values != NULL) \
      free (ret_values); \
    if (ret_values_names != NULL) { \
      for (i = 0; i < ret_values_num; ++i) \
        free (ret_values_names[i]); \
      free (ret_values_names); \
    } \
    ret_values_num = 0; \
    return (s); \
  } while (0)

  status = lcc_getval (c, &ident,
      &ret_values_num, &ret_values, &ret_values_names);
  if (status != 0) {
    fprintf (stderr, "ERROR: %s\n", lcc_strerror (c));
    BAIL_OUT (-1);
  }

  for (i = 0; i < ret_values_num; ++i)
    printf ("%s=%e\n", ret_values_names[i], ret_values[i]);
  BAIL_OUT (0);
#undef BAIL_OUT
} /* getval */
开发者ID:dacamp,项目名称:collectd,代码行数:48,代码来源:collectdctl.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ parse_int函数代码示例发布时间:2022-05-30
下一篇:
C++ parse_headers函数代码示例发布时间: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