Thread: [cedet-semantic] some proposals for c.bnf
Brought to you by:
zappo
From: Regina & J. R. <jen...@as...> - 2003-06-02 22:06:20
|
Hi, you have done a great job of improvement for the C++-parsing in semantic 1.4.4. However, I still have some proposals: - 'short int' is not recognized, althought 'long int' has been added now, I think this should be added too. - nested classes or structs defined outside of the containing class/struct are not parsed, as e.g. in: class container { public: struct contained; container(); ~container(); } struct container::contained { public: contained(); ~contained(); } This is valid C++ syntax, but the definition of container::contained will not be parsed and therefore not shown int the ECB method window. For myself, I changed the 'typesimple'-rule in c.bnf like so: # Jens Rock: added an opt-class befor the type names, and a parent # property to the respective extra-spec typesimple : struct-or-class opt-class opt-name opt-template-specifier opt-class-parents semantic-list ( ,$3 type ,$1 (let ((semantic-c-classname (cons (car ,$3) (car ,$1)))) (EXPANDFULL $6 classsubparts)) $5 (ASSOC 'template-specifier $4 'parent (car ,$2)) nil ) | struct-or-class opt-class opt-name opt-template-specifier opt-class-parents ( ,$3 type ,$1 nil $5 (ASSOC 'template-specifier $4 'parent (car ,$2)) nil ) | UNION opt-class opt-name unionparts ( ,$3 type $1 $4 nil (ASSOC 'parent (car ,$2)) nil ) | ENUM opt-class opt-name enumparts ( ,$3 type $1 $4 nil (ASSOC 'parent (car ,$2)) nil ) # Klaus Berndl <kla...@sd...>: a typedef can be a typeformbase # with all this declmods stuff. | TYPEDEF declmods typeformbase cv-declmods typedef-symbol-list ## We put the type this typedef renames into PARENT ## but will move it in the expand function. ( $5 type $1 nil $3 nil nil ) ; This seems to work for me and I can navigate better now. - the difference between type declarations and definitions is not mirrored in c.bnf. I'd propose to handle types in this regard just like functions and to add a (prototype . t) to the extra-spec of the declaration. This could enable tools looking for the definition of a given symbol as opposed to a mere declaration. (If anyone wishes something like this). Kind Regards Jens Rock |
From: Eric M. L. <er...@si...> - 2003-06-03 22:35:32
|
Hi Jens, Thanks for the patch! To others: Could someone volunteer to apply this patch and test it against the 1.4 and the 2.0 branch? Thanks Eric >>> "Regina & Jens Rock" <jen...@as...> seems to think that: >Hi, > >you have done a great job of improvement for the >C++-parsing in semantic 1.4.4. > >However, I still have some proposals: > >- 'short int' is not recognized, althought > 'long int' has been added now, I think this > should be added too. > > >- nested classes or structs defined outside > of the containing class/struct are not parsed, > as e.g. in: > > class container > { > public: > struct contained; > container(); > ~container(); > } > > struct container::contained > { > public: > contained(); > ~contained(); > } > > This is valid C++ syntax, but the definition > of container::contained will not be parsed > and therefore not shown int the ECB method > window. > For myself, I changed the 'typesimple'-rule > in c.bnf like so: > ># Jens Rock: added an opt-class befor the type names, and a parent ># property to the respective extra-spec >typesimple : struct-or-class opt-class opt-name opt-template-specifier > opt-class-parents semantic-list > ( ,$3 type ,$1 > (let ((semantic-c-classname (cons (car ,$3) (car ,$1)))) > (EXPANDFULL $6 classsubparts)) > $5 > (ASSOC 'template-specifier $4 'parent (car ,$2)) > nil ) > | struct-or-class opt-class opt-name opt-template-specifier >opt-class-parents > ( ,$3 type ,$1 nil $5 > (ASSOC 'template-specifier $4 'parent (car ,$2)) > nil ) > | UNION opt-class opt-name unionparts > ( ,$3 type $1 $4 nil (ASSOC 'parent (car ,$2)) nil ) > | ENUM opt-class opt-name enumparts > ( ,$3 type $1 $4 nil (ASSOC 'parent (car ,$2)) nil ) ># Klaus Berndl <kla...@sd...>: a typedef can be a typeformbase ># with all this declmods stuff. > | TYPEDEF declmods typeformbase cv-declmods typedef-symbol-list > ## We put the type this typedef renames into PARENT > ## but will move it in the expand function. > ( $5 type $1 nil $3 nil nil ) > ; > > This seems to work for me and I can navigate better now. > > >- the difference between type declarations and definitions > is not mirrored in c.bnf. I'd propose to handle types > in this regard just like functions and to add a (prototype . t) > to the extra-spec of the declaration. This could enable > tools looking for the definition of a given symbol as opposed > to a mere declaration. (If anyone wishes something like this). > > > >Kind Regards > >Jens Rock > > > >------------------------------------------------------- >This SF.net email is sponsored by: eBay >Get office equipment for less on eBay! >http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 >_______________________________________________ >cedet-semantic mailing list >ced...@li... >https://lists.sourceforge.net/lists/listinfo/cedet-semantic > |