From: SourceForge.net <no...@so...> - 2012-02-07 12:13:18
|
Feature Requests item #3485296, was opened at 2012-02-07 03:44 Message generated for change (Comment added) made by kambi You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=354213&aid=3485296&group_id=4213 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Priority: 5 Private: No Submitted By: VCejka (vcejka) Assigned to: Nobody/Anonymous (nobody) Summary: attributes support Initial Comment: I'm working on support for attributes added to Delphi at version 2010. I need it, because parser fails when some attribute is found. It is not finished yet, but I have no experience with FPC. If someone has some idea or demand, please post it. Here are my current notes on implementation: Changes to PasDoc: Tokenizer: - added token Attribute + token string - defined constant AttributeStart + AttributeEnd ([]) Items: - To TPasItem added property Attributes as TstringVector containing list of attributes defined for this item. It is created in constructor and destroyed in destructor Parser: - added private boolean field AttributeIsPossible to Tparser - added private field CurrentAttributes (TstringVector) to Tparser, created in constructor and destroyed in destructor - Attributes are found in square brackets before item. If parser finds them, stores them to CurrentAttributes field. - Once some attributes is defined when CDFP is analyzed, it is moved from CurrentAtributes to Attributes field of TPasMethod in TParser.ParseCDFP - Once some attributes is defined when Constant is analyzed, it is moved from CurrentAtributes to Attributes field of TPasConstant in TParser.ParseConstant - Once some attributes is defined when Enum is analyzed, it is moved from CurrentAtributes to Attributes field of TPasEnum in TParser.ParseEnum - Once some attributes is defined when Property is analyzed, it is moved from CurrentAtributes to Attributes field of TPasProperty in TParser.ParseProperty - Once some attributes is defined when some field of some record is analyzed, it is moved from CurrentAtributes to Attributes field of TPasFieldVariable in TParser.ParseRecordCase, but it is not possible to apply attributes to cases of record fields. - Once some attributes is defined when type is analyzed, it is moved from CurrentAtributes to Attributes field of TPasType in TParser.ParseType - Once some attributes is defined when field of class or record is analyzed, it is moved from CurrentAtributes to Attributes field of TPasFieldVariable in TParser. ParseFieldsVariables - Parsing of attributes is disabled when interface section of some unit is entered and enabled when some type starts to be parsed (TParser.ParseInterfaceSection) - Parsing of attributes is disabled when new type identifier is found and type definition is expected (TParser.ParseType) - When attribute is possible, it is extracted by TParser.PeekNextToken. When identifier is found, there can be no attribute, so checking is disabled until next semicolon. When attribute is possible, left square bracket is checked. If found, tokens until next right squate bracket are taken as attribute. - When members of class, interface or object are analysed, it is supposed that attribute can be just in front of keyword or identifier, so checking is enabled at the beginning, token is taken and attributes checking is disabled again (TParser.ParseCioMembers). When end directive occurs (end of CIO), attributes, even if found and not used, are cleared. - Also when CIO type declaration is parsed, parsing of attributes is enabled at the beginning, token is taken and parsing of attributes is disabled. When CIO is found, founf attributes are moved to Attributes field of TPasCio. (TParser.ParseCioTypeDecl) - Internal types of CIO are not parsed for attributes at this moment!!! Should it be added? ---------------------------------------------------------------------- >Comment By: Michalis Kamburelis (kambi) Date: 2012-02-07 04:13 Message: On the other hand, it's a feature request, so it's probably better to leave it open :) In any case, I understand that you're volunteering to send a patch for this some day soon :) Oh, and as for FPC: I don't think FPC can parse Delphi 2010 attributes now. PasDoc source code of course must be compileable by FPC (as well as Delphi), but don't worry about it if you don't want to. I use FPC and will fix eventual incompatibilities. ---------------------------------------------------------------------- Comment By: Michalis Kamburelis (kambi) Date: 2012-02-07 04:07 Message: From a quick reading, everything seems sensible, you're most welcome to work on it and I'll apply :) Note that it's better to discuss stuff on a maling list (https://lists.sourceforge.net/lists/listinfo/pasdoc-main ), tracker should be used for things that can eventually be closed as "done". I currently close this issue (although you can still post comments and reopen it), as there's nothing for me to do here :) As for: > Internal types of CIO are not parsed for attributes at this moment!!! Should it be added? Internal types are parsed and handled in SVN version of PasDoc, thanks to Arno Garrels. For example, this works: https://pasdoc.svn.sourceforge.net/svnroot/pasdoc/trunk/tests/ok_nested_types.pas . You should definitely prepare your patches against SVN version of the pasdoc source code. Instructions for SVN on main www page, http://pasdoc.sipsolutions.net/ , basically just "svn co https://pasdoc.svn.sourceforge.net/svnroot/pasdoc/trunk". ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=354213&aid=3485296&group_id=4213 |