本文整理汇总了C++中parse_identifier函数的典型用法代码示例。如果您正苦于以下问题:C++ parse_identifier函数的具体用法?C++ parse_identifier怎么用?C++ parse_identifier使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_identifier函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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) };
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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 */
}
示例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;
}
示例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);
}
示例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 */
}
示例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;
}