|
From: SourceForge.net <no...@so...> - 2012-02-07 11:44:58
|
Feature Requests item #3485296, was opened at 2012-02-07 03:44 Message generated for change (Tracker Item Submitted) made by vcejka 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? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=354213&aid=3485296&group_id=4213 |