From 19f05f5afcadb1b0d815b1fa44cd5f09a1d37268 Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Thu, 4 Jun 2020 19:15:14 +0400 Subject: [PATCH] Rename HasComments to Comment; remove *.cabal --- .gitignore | 1 + tools/lsp/squirrel/squirrel.cabal | 74 ------------------- tools/lsp/squirrel/src/AST/Parser.hs | 6 +- tools/lsp/squirrel/src/AST/Scope.hs | 2 +- tools/lsp/squirrel/src/AST/Types.hs | 36 ++++----- .../src/{HasComments.hs => Comment.hs} | 2 +- tools/lsp/squirrel/src/Parser.hs | 2 +- tools/lsp/squirrel/src/Tree.hs | 2 +- 8 files changed, 26 insertions(+), 99 deletions(-) delete mode 100644 tools/lsp/squirrel/squirrel.cabal rename tools/lsp/squirrel/src/{HasComments.hs => Comment.hs} (96%) diff --git a/.gitignore b/.gitignore index 0fc670a39..8eab4bea8 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ nix/result .idea *.iml stale_outputs_checked +*.cabal diff --git a/tools/lsp/squirrel/squirrel.cabal b/tools/lsp/squirrel/squirrel.cabal deleted file mode 100644 index 516cb704a..000000000 --- a/tools/lsp/squirrel/squirrel.cabal +++ /dev/null @@ -1,74 +0,0 @@ -cabal-version: 1.12 - --- This file has been generated from package.yaml by hpack version 0.33.0. --- --- see: https://github.com/sol/hpack --- --- hash: 0561ca5eedeec178effcd82246fe314b488637ceea34ea241eb4943714bdb7aa - -name: squirrel -version: 0.0.0 -build-type: Simple - -library - exposed-modules: - AST - AST.Parser - AST.Scope - AST.Types - Error - HasComments - Lattice - Parser - ParseTree - Pretty - Range - Tree - Union - other-modules: - Paths_squirrel - hs-source-dirs: - src/ - default-extensions: BangPatterns BlockArguments DataKinds DeriveFoldable DeriveFunctor DeriveTraversable DerivingStrategies DerivingVia FlexibleContexts FlexibleInstances GADTs GeneralisedNewtypeDeriving LambdaCase MultiParamTypeClasses NamedFieldPuns OverloadedStrings QuasiQuotes ScopedTypeVariables StandaloneDeriving TemplateHaskell TypeFamilies TypeOperators UndecidableInstances FunctionalDependencies ViewPatterns - ghc-options: -freverse-errors -Wall -threaded - include-dirs: - vendor - c-sources: - vendor/parser.c - build-depends: - base - , bytestring - , data-default - , data-fix - , mtl - , pretty - , template-haskell - , text - , tree-sitter - default-language: Haskell2010 - -executable squirrel - main-is: Main.hs - other-modules: - Paths_squirrel - hs-source-dirs: - app/ - default-extensions: BangPatterns BlockArguments DataKinds DeriveFoldable DeriveFunctor DeriveTraversable DerivingStrategies DerivingVia FlexibleContexts FlexibleInstances GADTs GeneralisedNewtypeDeriving LambdaCase MultiParamTypeClasses NamedFieldPuns OverloadedStrings QuasiQuotes ScopedTypeVariables StandaloneDeriving TemplateHaskell TypeFamilies TypeOperators UndecidableInstances FunctionalDependencies ViewPatterns - ghc-options: -freverse-errors -Wall -threaded - build-depends: - base - , bytestring - , data-default - , data-fix - , haskell-lsp - , hslogger - , interpolate - , lens - , mtl - , pretty - , squirrel - , stm - , template-haskell - , text - , tree-sitter - default-language: Haskell2010 diff --git a/tools/lsp/squirrel/src/AST/Parser.hs b/tools/lsp/squirrel/src/AST/Parser.hs index b193e52b7..32079e019 100644 --- a/tools/lsp/squirrel/src/AST/Parser.hs +++ b/tools/lsp/squirrel/src/AST/Parser.hs @@ -16,10 +16,10 @@ import Union ranged :: ( Functor f - , Member f fs + , Member f fs ) => Parser (f (Tree fs ASTInfo)) - -> Parser (Tree fs ASTInfo) + -> Parser (Tree fs ASTInfo) ranged p = do r <- getInfo a <- p @@ -46,8 +46,8 @@ declaration = do ranged do pure ValueDecl <*> binding <|> do ranged do pure ValueDecl <*> vardecl <|> do ranged do pure ValueDecl <*> constdecl + <|> do ranged do pure Action <*> attributes <|> do typedecl - <|> do ranged do pure Action <*> attributes <|> do include include :: Parser (Pascal ASTInfo) diff --git a/tools/lsp/squirrel/src/AST/Scope.hs b/tools/lsp/squirrel/src/AST/Scope.hs index f2baf9a3e..5b19acb3b 100644 --- a/tools/lsp/squirrel/src/AST/Scope.hs +++ b/tools/lsp/squirrel/src/AST/Scope.hs @@ -29,7 +29,7 @@ import Parser import Range import AST.Types import Tree -import HasComments +import Comment import Pretty -- | Scope-holding monad. diff --git a/tools/lsp/squirrel/src/AST/Types.hs b/tools/lsp/squirrel/src/AST/Types.hs index 0a251cceb..a5ba6e6a3 100644 --- a/tools/lsp/squirrel/src/AST/Types.hs +++ b/tools/lsp/squirrel/src/AST/Types.hs @@ -37,15 +37,15 @@ data Declaration it deriving stock (Functor, Foldable, Traversable) data Binding it - = Irrefutable it it -- ^ (Pattern) (Expr) - | Function Bool it [it] it it -- ^ (Name) [VarDecl] (Type) (Expr) - | Var it it it -- ^ (Name) (Type) (Expr) - | Const it it it -- ^ (Name) (Type) (Expr) + = Irrefutable it it -- ^ (Pattern) (Expr) + | Function Bool it [it] it it -- ^ (Name) [VarDecl] (Type) (Expr) + | Var it it it -- ^ (Name) (Type) (Expr) + | Const it it it -- ^ (Name) (Type) (Expr) deriving (Show) via PP (Binding it) deriving stock (Functor, Foldable, Traversable) data VarDecl it - = Decl it it it -- ^ (Mutable) (Name) (Type) + = Decl it it it -- ^ (Mutable) (Name) (Type) deriving (Show) via PP (VarDecl it) deriving stock (Functor, Foldable, Traversable) @@ -57,22 +57,22 @@ data Mutable it data Type it - = TArrow it it -- ^ (Type) (Type) - | TRecord [it] -- ^ [TField] - | TVar it -- ^ (Name) - | TSum [it] -- ^ [Variant] - | TProduct [it] -- ^ [Type] - | TApply it [it] -- (Name) [Type] + = TArrow it it -- ^ (Type) (Type) + | TRecord [it] -- ^ [TField] + | TVar it -- ^ (Name) + | TSum [it] -- ^ [Variant] + | TProduct [it] -- ^ [Type] + | TApply it [it] -- (Name) [Type] deriving (Show) via PP (Type it) deriving stock (Functor, Foldable, Traversable) data Variant it - = Variant it (Maybe it) -- (Name) (Maybe (Type)) + = Variant it (Maybe it) -- (Name) (Maybe (Type)) deriving (Show) via PP (Variant it) deriving stock (Functor, Foldable, Traversable) data TField it - = TField it it -- (Name) (Type) + = TField it it -- (Name) (Type) deriving (Show) via PP (TField it) deriving stock (Functor, Foldable, Traversable) @@ -97,12 +97,12 @@ data Expr it | MapRemove it it -- (Expr) (QualifiedName) | SetRemove it it -- (Expr) (QualifiedName) | Indexing it it -- (QualifiedName) (Expr) - | Case it [it] -- (Expr) [Alt] + | Case it [it] -- (Expr) [Alt] | Skip - | ForLoop it it it it -- (Name) (Expr) (Expr) (Expr) - | WhileLoop it it -- (Expr) (Expr) - | Seq [it] -- [Declaration] - | Lambda [it] it it -- [VarDecl] (Type) (Expr) + | ForLoop it it it it -- (Name) (Expr) (Expr) (Expr) + | WhileLoop it it -- (Expr) (Expr) + | Seq [it] -- [Declaration] + | Lambda [it] it it -- [VarDecl] (Type) (Expr) | ForBox it (Maybe it) Text it it -- (Name) (Maybe (Name)) Text (Expr) (Expr) | MapPatch it [it] -- (QualifiedName) [MapBinding] | SetPatch it [it] -- (QualifiedName) [Expr] diff --git a/tools/lsp/squirrel/src/HasComments.hs b/tools/lsp/squirrel/src/Comment.hs similarity index 96% rename from tools/lsp/squirrel/src/HasComments.hs rename to tools/lsp/squirrel/src/Comment.hs index 25dfa82a3..d55bd03be 100644 --- a/tools/lsp/squirrel/src/HasComments.hs +++ b/tools/lsp/squirrel/src/Comment.hs @@ -2,7 +2,7 @@ {- | Comments and utilities. -} -module HasComments +module Comment ( HasComments(..) , c ) diff --git a/tools/lsp/squirrel/src/Parser.hs b/tools/lsp/squirrel/src/Parser.hs index ec578d870..b9c60e16e 100644 --- a/tools/lsp/squirrel/src/Parser.hs +++ b/tools/lsp/squirrel/src/Parser.hs @@ -76,7 +76,7 @@ import qualified Data.Text as Text import ParseTree import Range import Pretty -import HasComments +import Comment import Error import Debug.Trace diff --git a/tools/lsp/squirrel/src/Tree.hs b/tools/lsp/squirrel/src/Tree.hs index 362f0a414..8e5bd6a49 100644 --- a/tools/lsp/squirrel/src/Tree.hs +++ b/tools/lsp/squirrel/src/Tree.hs @@ -29,7 +29,7 @@ import Data.Foldable import Union import Lattice -import HasComments +import Comment import Pretty import Error