*** /pub/tmp/emacs-21.2/lib-src/ebrowse.c Fri Nov 16 11:49:37 2001 --- ebrowse.c Wed Mar 27 18:50:04 2002 *************** *** 473,478 **** --- 473,488 ---- struct search_path *search_path; struct search_path *search_path_tail; + /* List of idents. added by alextov 26.03.02 + A list is used to store names of member variables defined in the + following way: class A { int x, y;} */ + struct idlist + { + struct idlist* next; + char* id; + }; + + /* Function prototypes. */ int yylex P_ ((void)); *************** *** 530,535 **** --- 540,550 ---- int globals P_ ((int)); void yyerror P_ ((char *, char *)); + /* added by alextov 26.03.02 */ + /* Add a copy of id to a list. The list is created if needed */ + void add_to_id_list (char *, struct idlist**); + /* Delete a list and all items in it */ + void delete_id_list (struct idlist**); /*********************************************************************** *************** *** 609,614 **** --- 624,663 ---- /*********************************************************************** + List of idents. added by alextov 26.03.02 + ***********************************************************************/ + /* Add a copy of id to a list. The list is created if needed */ + void + add_to_id_list (char *id, struct idlist** id_list) + { + struct idlist* tmp_list = (struct idlist*) xmalloc(sizeof(struct idlist)); + tmp_list->id = xstrdup(id); + tmp_list->next = NULL; + if (*id_list == NULL) + *id_list = tmp_list; + else + { + struct idlist* cur_list = *id_list; + while (cur_list->next != NULL) cur_list = cur_list->next; + cur_list->next = tmp_list; + } + } + + /* Delete a list and all items in it */ + void + delete_id_list (struct idlist** id_list) + { + struct idlist* tmp_list; + while (*id_list) + { + xfree((*id_list)->id); + tmp_list = *id_list; + *id_list = (*id_list)->next; + xfree(tmp_list); + } + } + + /*********************************************************************** Symbols ***********************************************************************/ *************** *** 2619,2624 **** --- 2668,2676 ---- unsigned hash = 0; int tilde = 0; + /* added by alextov 26.03.02 */ + struct idlist* id_list = NULL; + while (!LOOKING_AT4 (';', '{', '}', YYEOF)) { switch (LA1) *************** *** 2687,2693 **** } else strcpy (id, yytext); ! MATCH (); break; case OPERATOR: --- 2739,2757 ---- } else strcpy (id, yytext); ! ! /* added by alextov 26.03.02 */ ! if (!type_seen) ! { ! char *last_id; ! parse_qualified_param_ident_or_type (&last_id); ! type_seen = 1; ! } ! else { ! add_to_id_list(id, &id_list); ! MATCH (); ! } ! /* -- */ break; case OPERATOR: *************** *** 2726,2731 **** --- 2790,2798 ---- if (LOOKING_AT ('{') && id && cls) add_member_defn (cls, id, regexp, pos, hash, 0, sc, flags); + /* added by alextov 26.03.02 */ + delete_id_list(&id_list); + xfree (id); id = NULL; sc = SC_MEMBER; *************** *** 2753,2763 **** else skip_to (';'); break; ! case INT: case CHAR: case LONG: case UNSIGNED: case SIGNED: case CONST: case DOUBLE: case VOID: case SHORT: case VOLATILE: case BOOL: case WCHAR: ! case TYPENAME: typeseen: type_seen = 1; MATCH (); --- 2820,2830 ---- else skip_to (';'); break; ! case INT: case CHAR: case LONG: case UNSIGNED: case SIGNED: case CONST: case DOUBLE: case VOID: case SHORT: case VOLATILE: case BOOL: case WCHAR: ! case TYPENAME: case FLOAT: typeseen: type_seen = 1; MATCH (); *************** *** 2771,2788 **** declaration. We don't want to add friend classes as members. */ if (id && sc != SC_FRIEND && cls) { regexp = matching_regexp (); pos = BUFFER_POS (); ! if (cls != NULL) ! { ! if (type_seen || !paren_seen) ! add_member_decl (cls, id, regexp, pos, 0, 1, sc, vis, 0); ! else ! add_member_decl (cls, id, regexp, pos, hash, 0, sc, vis, 0); ! } } ! MATCH (); print_info (); } --- 2838,2866 ---- declaration. We don't want to add friend classes as members. */ if (id && sc != SC_FRIEND && cls) { + /* added by alextov 26.03.02 */ + struct idlist* cur_list = id_list; + regexp = matching_regexp (); pos = BUFFER_POS (); ! /* using of lists added by alextov 26.03.02 */ ! ! while (cur_list != NULL) ! { ! if (cls != NULL) ! { ! if (type_seen || !paren_seen) ! add_member_decl (cls, cur_list->id, regexp, ! pos, 0, 1, sc, vis, 0); ! else ! add_member_decl (cls, cur_list->id, regexp, ! pos, hash, 0, sc, vis, 0); ! } ! cur_list = cur_list->next; ! } } ! MATCH (); print_info (); } *************** *** 2790,2809 **** { /* A named enum. */ if (sc == SC_TYPE && id && cls) ! { ! regexp = matching_regexp (); ! pos = BUFFER_POS (); ! if (cls != NULL) ! { ! add_member_decl (cls, id, regexp, pos, 0, 1, sc, vis, 0); ! add_member_defn (cls, id, regexp, pos, 0, 1, sc, 0); ! } ! } ! skip_matching (); print_info (); } xfree (id); } --- 2868,2909 ---- { /* A named enum. */ if (sc == SC_TYPE && id && cls) ! { ! regexp = matching_regexp (); ! pos = BUFFER_POS (); ! ! if (cls != NULL) ! { ! add_member_decl (cls, id, regexp, pos, 0, 1, sc, vis, 0); ! add_member_defn (cls, id, regexp, pos, 0, 1, sc, 0); ! } ! } ! skip_matching (); ! /* a member with named or unnamed enum like ! class A { enum {C, D} member;} or ! class A { enum B {C, D} member;} ! added by alextov 27.03.02 */ ! if (LA1 == IDENT && sc == SC_TYPE && cls) ! { ! id = (char *) xrealloc (id, strlen (yytext) + 1); ! strcpy (id, yytext); ! regexp = matching_regexp (); ! pos = BUFFER_POS (); ! ! if (cls != NULL) ! { ! add_member_decl (cls, id, regexp, pos, 0, 1, SC_MEMBER, vis, 0); ! add_member_defn (cls, id, regexp, pos, 0, 1, SC_MEMBER, 0); ! } ! MATCH (); ! } print_info (); } + + /* added by alextov 26.03.02 */ + delete_id_list(&id_list); xfree (id); }