dhscanner-ast 1.3.1 → 1.4.0
raw patch · 2 files changed
+84/−82 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Ast: [dataMemberAnnotations] :: DataMember -> [Exp]
+ Ast: [stmtMethodAnnotations] :: StmtMethodContent -> [Exp]
- Ast: DataMember :: MemberName -> Maybe Var -> Maybe Exp -> DataMember
+ Ast: DataMember :: MemberName -> Maybe Var -> Maybe Exp -> [Exp] -> DataMember
- Ast: StmtMethodContent :: Maybe Var -> MethodName -> [Param] -> [Stmt] -> Location -> ClassName -> [SuperName] -> StmtMethodContent
+ Ast: StmtMethodContent :: Maybe Var -> MethodName -> [Param] -> [Stmt] -> [Exp] -> Location -> ClassName -> [SuperName] -> StmtMethodContent
Files
- dhscanner-ast.cabal +81/−81
- src/Ast.hs +3/−1
dhscanner-ast.cabal view
@@ -1,81 +1,81 @@-cabal-version: 3.12 -name: dhscanner-ast -category: parsing -synopsis: abstract syntax tree for multiple programming languages -description: - - The [abstract ayntax tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (ast) - aims to be a data structure able to represent /multiple/ abstract syntax trees from - /various/ programming languages. Its main purpose is to serve as the first step for /static code analysis/, - as part of the [dhscanner](https://github.com/OrenGitHub/dhscanner) framework - for CI/CD security code scans. As part of that framework, - it targets mostly languages used for /cloud native applications/: - __Python__, __Ruby__, __Php__, __Javascript__, __Typescript__, __Java__ and __Golang__. - Typically, a file is first parsed with the corresponding native parser of the language it's written in - (see [Python's native parser](https://docs.python.org/3/library/ast.html) for example). - The native ast is then dumped (as JSON, or plain text) - and sent to a [Happy](https://haskell-happy.readthedocs.io/en/latest/) + - [Alex](https://haskell-alex.readthedocs.io/en/latest/) Haskell parser - which accommodates the natively parsed content into the ast. - Geared towards static code analysis, the ast design abstracts away details that are normally ignored anyway. - For example, it does not distinguish between __try__ and __catch__ blocks, - and models both of them as plain sequential code blocks. Every file has exactly one ast that represents it. - Non Haskell parogrammers note: The ast is /immutable/ (like everything else in Haskell ...) - -version: 1.3.1 -license: GPL-3.0-only -license-file: LICENSE -author: OrenGitHub -maintainer: Oren Ish Shalom -copyright: (c) 2024 Oren Ish Shalom -homepage: https://github.com/OrenGitHub/dhscanner -stability: experimental -build-type: Simple - -common ghc_options - - ghc-options: -Wall -Werror=incomplete-patterns -O2 - -library - - import: - ghc_options - - exposed-modules: - Ast, - Token, - Location - - build-depends: - aeson >= 2.2 && < 2.4, - base >= 4.22 && < 4.23, - containers >= 0.8 && < 0.9 - - hs-source-dirs: - src - - default-language: - GHC2024 - -test-suite dhscanner-ast-test - - import: - ghc_options - - type: - exitcode-stdio-1.0 - - hs-source-dirs: - test - - main-is: - Main.hs - - build-depends: - base, - dhscanner-ast, - QuickCheck, - random - - default-language: - GHC2024 +cabal-version: 3.12+name: dhscanner-ast+category: parsing+synopsis: abstract syntax tree for multiple programming languages+description:++ The [abstract ayntax tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (ast)+ aims to be a data structure able to represent /multiple/ abstract syntax trees from+ /various/ programming languages. Its main purpose is to serve as the first step for /static code analysis/,+ as part of the [dhscanner](https://github.com/OrenGitHub/dhscanner) framework+ for CI/CD security code scans. As part of that framework,+ it targets mostly languages used for /cloud native applications/:+ __Python__, __Ruby__, __Php__, __Javascript__, __Typescript__, __Java__ and __Golang__.+ Typically, a file is first parsed with the corresponding native parser of the language it's written in+ (see [Python's native parser](https://docs.python.org/3/library/ast.html) for example).+ The native ast is then dumped (as JSON, or plain text)+ and sent to a [Happy](https://haskell-happy.readthedocs.io/en/latest/) ++ [Alex](https://haskell-alex.readthedocs.io/en/latest/) Haskell parser+ which accommodates the natively parsed content into the ast.+ Geared towards static code analysis, the ast design abstracts away details that are normally ignored anyway.+ For example, it does not distinguish between __try__ and __catch__ blocks,+ and models both of them as plain sequential code blocks. Every file has exactly one ast that represents it.+ Non Haskell parogrammers note: The ast is /immutable/ (like everything else in Haskell ...)++version: 1.4.0+license: GPL-3.0-only+license-file: LICENSE+author: OrenGitHub+maintainer: Oren Ish Shalom+copyright: (c) 2024 Oren Ish Shalom+homepage: https://github.com/OrenGitHub/dhscanner+stability: experimental+build-type: Simple++common ghc_options++ ghc-options: -Wall -Werror=incomplete-patterns -O2++library++ import:+ ghc_options++ exposed-modules:+ Ast,+ Token,+ Location++ build-depends:+ aeson >= 2.2 && < 2.4,+ base >= 4.22 && < 4.23,+ containers >= 0.8 && < 0.9++ hs-source-dirs:+ src++ default-language:+ GHC2024++test-suite dhscanner-ast-test++ import:+ ghc_options++ type:+ exitcode-stdio-1.0++ hs-source-dirs:+ test++ main-is:+ Main.hs++ build-depends:+ base,+ dhscanner-ast,+ QuickCheck,+ random++ default-language:+ GHC2024
src/Ast.hs view
@@ -144,7 +144,8 @@ { dataMemberName :: Token.MemberName, dataMemberNominalType :: Maybe Var, - dataMemberInitValue :: Maybe Exp + dataMemberInitValue :: Maybe Exp, + dataMemberAnnotations :: [ Exp ] } deriving ( Show, Eq, Ord, Generic, ToJSON, FromJSON ) @@ -162,6 +163,7 @@ stmtMethodName :: Token.MethodName, stmtMethodParams :: [ Param ], stmtMethodBody :: [ Stmt ], + stmtMethodAnnotations :: [ Exp ], stmtMethodLocation :: Location, hostingClassName :: Token.ClassName, hostingClassSupers :: [ Token.SuperName ]