{"action":"opened","issue":{"url":"https://api.github.com/repos/RomanYankovsky/DelphiAST/issues/235","repository_url":"https://api.github.com/repos/RomanYankovsky/DelphiAST","labels_url":"https://api.github.com/repos/RomanYankovsky/DelphiAST/issues/235/labels{/name}","comments_url":"https://api.github.com/repos/RomanYankovsky/DelphiAST/issues/235/comments","events_url":"https://api.github.com/repos/RomanYankovsky/DelphiAST/issues/235/events","html_url":"https://github.com/RomanYankovsky/DelphiAST/issues/235","id":262500384,"number":235,"title":"Class abstract | sealed is not recorded.","user":{"login":"JBontes","id":11998466,"avatar_url":"https://avatars1.githubusercontent.com/u/11998466?v=4","gravatar_id":"","url":"https://api.github.com/users/JBontes","html_url":"https://github.com/JBontes","followers_url":"https://api.github.com/users/JBontes/followers","following_url":"https://api.github.com/users/JBontes/following{/other_user}","gists_url":"https://api.github.com/users/JBontes/gists{/gist_id}","starred_url":"https://api.github.com/users/JBontes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JBontes/subscriptions","organizations_url":"https://api.github.com/users/JBontes/orgs","repos_url":"https://api.github.com/users/JBontes/repos","events_url":"https://api.github.com/users/JBontes/events{/privacy}","received_events_url":"https://api.github.com/users/JBontes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-10-03T16:40:02Z","updated_at":"2017-10-03T16:40:02Z","closed_at":null,"author_association":"NONE","body":"abstract and sealed classes are not recorded properly.\r\n\r\nThe fix:\r\n\r\n```Delphi\r\nprocedure TmwSimplePasPar.ClassType;\r\nbegin\r\n  Expected(ptClass);\r\n  case TokenID of\r\n    ptIdentifier: //NASTY hack because Abstract is generally an ExID, except in this case when it should be a keyword.\r\n      begin\r\n        if Lexer.ExID = ptAbstract then\r\n          DirectiveAbstract;\r\n\r\n        if Lexer.ExID = ptHelper then\r\n          ClassHelper;\r\n      end;\r\n    ptSealed:\r\n      DirectiveSealed;\r\n  end;\r\n  case TokenID of\r\n    ptEnd:\r\n      begin\r\n        ClassTypeEnd;\r\n        NextToken; { Direct descendant of TObject without new members }\r\n      end;\r\n    ptRoundOpen:\r\n      begin\r\n        ClassHeritage;\r\n        case TokenID of\r\n          ptEnd:\r\n            begin\r\n              Expected(ptEnd);\r\n              ClassTypeEnd;\r\n            end;\r\n          ptSemiColon: ClassTypeEnd;\r\n        else\r\n          begin\r\n            ClassMemberList; { Direct descendant of TObject }\r\n            Expected(ptEnd);\r\n            ClassTypeEnd;\r\n          end;\r\n        end;\r\n      end;\r\n    ptSemicolon: ClassTypeEnd;\r\n  else\r\n    begin\r\n      ClassMemberList; { Direct descendant of TObject }\r\n      Expected(ptEnd);\r\n      ClassTypeEnd;\r\n    end;\r\n  end;\r\nend;\r\n\r\nprocedure TmwSimplePasPar.DirectiveSealed;\r\nbegin\r\n  Expected(ptSealed);\r\nend;\r\n\r\nprocedure TmwSimplePasPar.DirectiveAbstract;\r\nbegin\r\n  ExpectedEx(ptAbstract);  //abstract is an ExID.\r\nend;\r\n\r\ntype\r\n  TAttributeValue = (atAsm, atTrue, atFunction, atProcedure, atClassOf, atClass,\r\n    atConst, atConstructor, atDestructor, atEnum, atInterface, atNil, atNumeric,\r\n    atOut, atPointer, atName, atString, atSubRange, atVar, atType{ExplicitType},\r\n    atObject, atSealed, atAbstract, atFinal);\r\n\r\n\r\nprocedure TPasSyntaxTreeBuilder.DirectiveSealed;\r\nbegin\r\n  //hack, must go to a better attributeType, however sealed, abstract cannot coexist\r\n  //Perhaps sealed, abstract and final should all share a attribute type called anInheritance\r\n  FStack.Peek.Attribute[anAbstract]:= AttributeValues[atSealed];\r\n  inherited;\r\nend;\r\n\r\nprocedure TPasSyntaxTreeBuilder.DirectiveAbstract;\r\nbegin\r\n  //anAbstract Attribute can contain both 'sealed' and 'abstract'\r\n  FStack.Peek.Attribute[anAbstract]:= AttributeValues[atAbstract];\r\n  inherited;\r\nend;\r\n\r\n\r\n\r\n```"}}
{"actor":{"display_login":"JBontes"}}