1 |
/* ebrowse.c --- parsing files for the ebrowse C++ browser |
/* ebrowse.c --- parsing files for the ebrowse C++ browser |
2 |
|
|
3 |
Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, |
Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, |
4 |
2000, 2001 Free Software Foundation Inc. |
2000, 2001, 2002 Free Software Foundation Inc. |
5 |
|
|
6 |
This file is part of GNU Emacs. |
This file is part of GNU Emacs. |
7 |
|
|
2423 |
} |
} |
2424 |
} |
} |
2425 |
|
|
2426 |
|
int |
2427 |
|
skip_initializer () |
2428 |
|
{ |
2429 |
|
for (;;) |
2430 |
|
{ |
2431 |
|
switch (LA1) |
2432 |
|
{ |
2433 |
|
case ';': |
2434 |
|
case ',': |
2435 |
|
case YYEOF: |
2436 |
|
return; |
2437 |
|
|
2438 |
|
case '{': |
2439 |
|
case '[': |
2440 |
|
case '(': |
2441 |
|
skip_matching (); |
2442 |
|
break; |
2443 |
|
|
2444 |
|
default: |
2445 |
|
MATCH (); |
2446 |
|
break; |
2447 |
|
} |
2448 |
|
} |
2449 |
|
} |
2450 |
|
|
2451 |
/* Build qualified namespace alias (A::B::c) and return it. */ |
/* Build qualified namespace alias (A::B::c) and return it. */ |
2452 |
|
|
3229 |
} |
} |
3230 |
} |
} |
3231 |
|
|
3232 |
|
/* Add to class *CLS information for the declaration of variable or |
3233 |
|
type *ID. If *CLS is null, this means a global declaration. SC is |
3234 |
|
the storage class of *ID. FLAGS is a bit set giving additional |
3235 |
|
information about the member (see the F_* defines). */ |
3236 |
|
|
3237 |
|
void |
3238 |
|
add_declarator (cls, id, flags, sc) |
3239 |
|
struct sym **cls; |
3240 |
|
char **id; |
3241 |
|
int flags, sc; |
3242 |
|
{ |
3243 |
|
if (LOOKING_AT2 (';', ',')) |
3244 |
|
{ |
3245 |
|
/* The end of a member variable or of an access declaration |
3246 |
|
`X::f'. To distinguish between them we have to know whether |
3247 |
|
type information has been seen. */ |
3248 |
|
if (*id) |
3249 |
|
{ |
3250 |
|
char *regexp = matching_regexp (); |
3251 |
|
int pos = BUFFER_POS (); |
3252 |
|
|
3253 |
|
if (cls) |
3254 |
|
add_member_defn (cls, *id, regexp, pos, 0, 1, SC_UNKNOWN, flags); |
3255 |
|
else |
3256 |
|
add_global_defn (*id, regexp, pos, 0, 1, sc, flags); |
3257 |
|
} |
3258 |
|
|
3259 |
|
MATCH (); |
3260 |
|
print_info (); |
3261 |
|
} |
3262 |
|
else if (LOOKING_AT ('{')) |
3263 |
|
{ |
3264 |
|
if (sc == SC_TYPE && *id) |
3265 |
|
{ |
3266 |
|
/* A named enumeration. */ |
3267 |
|
char *regexp = matching_regexp (); |
3268 |
|
int pos = BUFFER_POS (); |
3269 |
|
add_global_defn (*id, regexp, pos, 0, 1, sc, flags); |
3270 |
|
} |
3271 |
|
|
3272 |
|
skip_matching (); |
3273 |
|
print_info (); |
3274 |
|
} |
3275 |
|
|
3276 |
|
xfree (*id); |
3277 |
|
*id = NULL; |
3278 |
|
*cls = NULL; |
3279 |
|
} |
3280 |
|
|
3281 |
/* Parse a declaration. */ |
/* Parse a declaration. */ |
3282 |
|
|
3331 |
} |
} |
3332 |
|
|
3333 |
case '=': |
case '=': |
3334 |
/* Assumed to be the start of an initialization in this context. |
/* Assumed to be the start of an initialization in this |
3335 |
Skip over everything up to ';'. */ |
context. */ |
3336 |
skip_to (';'); |
skip_initializer (); |
3337 |
break; |
break; |
3338 |
|
|
3339 |
|
case ',': |
3340 |
|
add_declarator (&cls, &id, flags, sc); |
3341 |
|
break; |
3342 |
|
|
3343 |
case OPERATOR: |
case OPERATOR: |
3344 |
{ |
{ |
3345 |
char *s = operator_name (&sc); |
char *s = operator_name (&sc); |
3426 |
} |
} |
3427 |
} |
} |
3428 |
|
|
3429 |
if (LOOKING_AT (';')) |
add_declarator (&cls, &id, flags, sc); |
|
{ |
|
|
/* The end of a member variable or of an access declaration |
|
|
`X::f'. To distinguish between them we have to know whether |
|
|
type information has been seen. */ |
|
|
if (id) |
|
|
{ |
|
|
char *regexp = matching_regexp (); |
|
|
int pos = BUFFER_POS (); |
|
|
|
|
|
if (cls) |
|
|
add_member_defn (cls, id, regexp, pos, 0, 1, SC_UNKNOWN, flags); |
|
|
else |
|
|
add_global_defn (id, regexp, pos, 0, 1, sc, flags); |
|
|
} |
|
|
|
|
|
MATCH (); |
|
|
print_info (); |
|
|
} |
|
|
else if (LOOKING_AT ('{')) |
|
|
{ |
|
|
if (sc == SC_TYPE && id) |
|
|
{ |
|
|
/* A named enumeration. */ |
|
|
regexp = matching_regexp (); |
|
|
pos = BUFFER_POS (); |
|
|
add_global_defn (id, regexp, pos, 0, 1, sc, flags); |
|
|
} |
|
|
|
|
|
skip_matching (); |
|
|
print_info (); |
|
|
} |
|
|
|
|
|
xfree (id); |
|
3430 |
} |
} |
3431 |
|
|
3432 |
|
|