mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
Rename the Term module to Data.Term.
This commit is contained in:
parent
e8b7e89dca
commit
9bd0b02ac9
@ -41,6 +41,7 @@ library
|
||||
, Data.Syntax.Markup
|
||||
, Data.Syntax.Statement
|
||||
, Data.Syntax.Type
|
||||
, Data.Term
|
||||
, Decorators
|
||||
, Diff
|
||||
, Files
|
||||
@ -77,7 +78,6 @@ library
|
||||
, SES
|
||||
, SplitDiff
|
||||
, Syntax
|
||||
, Term
|
||||
, TreeSitter
|
||||
build-depends: base >= 4.8 && < 5
|
||||
, aeson
|
||||
|
@ -8,11 +8,11 @@ import Data.Functor.Classes
|
||||
import Data.List.NonEmpty (NonEmpty(..))
|
||||
import Data.Maybe
|
||||
import Data.Proxy
|
||||
import Data.Term
|
||||
import Data.These
|
||||
import Data.Union
|
||||
import Diff
|
||||
import GHC.Generics
|
||||
import Term
|
||||
|
||||
-- | A single step in a diffing algorithm, parameterized by the types of terms, diffs, and the result of the applicable algorithm.
|
||||
data AlgorithmF term1 term2 result partial where
|
||||
|
@ -26,12 +26,12 @@ import Data.Range
|
||||
import Data.Semigroup ((<>))
|
||||
import Data.Source
|
||||
import Data.Record
|
||||
import Data.Term
|
||||
import Data.These
|
||||
import Diff
|
||||
import Info (byteRange, setByteRange)
|
||||
import Prelude hiding (fst, snd)
|
||||
import SplitDiff
|
||||
import Term
|
||||
|
||||
-- | Assign line numbers to the lines on each side of a list of rows.
|
||||
numberedRows :: [Join These a] -> [Join These (Int, a)]
|
||||
|
@ -18,10 +18,10 @@ import Data.Record
|
||||
import Data.Semigroup
|
||||
import Data.Span
|
||||
import qualified Data.Syntax.Assignment as Assignment
|
||||
import Data.Term
|
||||
import Data.Union
|
||||
import GHC.Generics
|
||||
import GHC.Stack
|
||||
import Term
|
||||
|
||||
-- Combinators
|
||||
|
||||
|
@ -15,8 +15,8 @@ import Data.Record
|
||||
import qualified Data.Syntax as Syntax
|
||||
import qualified Data.Syntax.Declaration as Declaration
|
||||
import qualified Data.Syntax.Statement as Statement
|
||||
import Data.Term
|
||||
import Data.Union
|
||||
import Term
|
||||
|
||||
-- | An F-algebra on some carrier functor 'f'.
|
||||
type FAlgebra f a = f a -> a
|
||||
|
@ -113,10 +113,10 @@ import Data.Record
|
||||
import Data.Semigroup
|
||||
import qualified Data.Source as Source (Source, slice, sourceBytes)
|
||||
import qualified Data.Syntax.Assignment.Table as Table
|
||||
import Data.Term
|
||||
import GHC.Stack
|
||||
import qualified Info
|
||||
import Prelude hiding (fail, until)
|
||||
import Term
|
||||
import Text.Parser.Combinators as Parsers hiding (choice)
|
||||
import TreeSitter.Language
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{-# LANGUAGE DataKinds, MultiParamTypeClasses, RankNTypes, TypeFamilies, TypeOperators #-}
|
||||
module Term
|
||||
module Data.Term
|
||||
( Term(..)
|
||||
, termIn
|
||||
, TermF(..)
|
@ -10,10 +10,10 @@ import Data.ByteString.Char8 (ByteString, pack, unpack)
|
||||
import Data.Functor.Classes (Show1 (liftShowsPrec))
|
||||
import Data.JSON.Fields
|
||||
import Data.Proxy
|
||||
import Data.Term
|
||||
import Data.Text.Encoding (decodeUtf8)
|
||||
import Data.Union
|
||||
import GHC.Generics
|
||||
import Term
|
||||
|
||||
-- | Compute a 'ByteString' label for a 'Show1'able 'Term'.
|
||||
--
|
||||
|
@ -12,7 +12,7 @@ import Data.JSON.Fields
|
||||
import Data.Mergeable
|
||||
import Data.Patch
|
||||
import Data.Record
|
||||
import Term
|
||||
import Data.Term
|
||||
import Text.Show
|
||||
|
||||
-- | A recursive structure indicating the changed & unchanged portions of a labelled tree.
|
||||
|
@ -16,6 +16,7 @@ import Data.Maybe (fromMaybe, isJust)
|
||||
import Data.Record
|
||||
import qualified Data.Syntax as Syntax
|
||||
import qualified Data.Syntax.Declaration as Declaration
|
||||
import Data.Term
|
||||
import Data.Text (Text)
|
||||
import Data.These
|
||||
import Data.Union
|
||||
@ -24,7 +25,6 @@ import Diff
|
||||
import Info hiding (Empty, Return)
|
||||
import RWS
|
||||
import Syntax (Syntax(Leaf))
|
||||
import Term
|
||||
|
||||
|
||||
-- | Diff two Syntax terms recursively.
|
||||
|
@ -5,10 +5,10 @@ import Control.Comonad.Trans.Cofree
|
||||
import Data.Aeson
|
||||
import Data.Foldable
|
||||
import Data.Record
|
||||
import Data.Term
|
||||
import GHC.Generics
|
||||
import Info
|
||||
import qualified Syntax as S
|
||||
import Term
|
||||
|
||||
-- | A programming language.
|
||||
data Language
|
||||
|
@ -7,10 +7,10 @@ import Data.Foldable (toList)
|
||||
import Data.Maybe
|
||||
import Data.Record
|
||||
import Data.Source
|
||||
import Data.Term
|
||||
import Data.Text
|
||||
import Info
|
||||
import qualified Syntax as S
|
||||
import Term
|
||||
|
||||
termAssignment
|
||||
:: Source -- ^ The source of the term.
|
||||
|
@ -1,22 +1,22 @@
|
||||
{-# LANGUAGE DataKinds, GADTs, RankNTypes, TypeOperators #-}
|
||||
module Language.JSON.Syntax
|
||||
( assignment
|
||||
, Syntax
|
||||
, Grammar
|
||||
, Term)
|
||||
where
|
||||
( assignment
|
||||
, Syntax
|
||||
, Grammar
|
||||
, Term)
|
||||
where
|
||||
|
||||
import Data.Record
|
||||
import Data.Syntax (makeTerm, parseError)
|
||||
import qualified Data.Syntax as Syntax
|
||||
import Data.Syntax.Assignment hiding (Assignment, Error)
|
||||
import qualified Data.Syntax.Assignment as Assignment
|
||||
import qualified Data.Syntax.Declaration as Declaration
|
||||
import qualified Data.Syntax.Literal as Literal
|
||||
import Language.JSON.Grammar as Grammar
|
||||
import qualified Term
|
||||
import Data.Record
|
||||
import qualified Data.Term as Term
|
||||
import Data.Union
|
||||
import GHC.Stack
|
||||
import Language.JSON.Grammar as Grammar
|
||||
|
||||
type Syntax =
|
||||
[ Literal.Array
|
||||
|
@ -8,10 +8,10 @@ module Language.Markdown
|
||||
import CMarkGFM
|
||||
import Data.Ix
|
||||
import Data.Source
|
||||
import Data.Term
|
||||
import qualified Data.Syntax.Assignment as A (AST, Node(..))
|
||||
import Info
|
||||
import TreeSitter.Language (Symbol(..), SymbolType(..))
|
||||
import Term
|
||||
|
||||
data Grammar
|
||||
= Document
|
||||
|
@ -16,12 +16,12 @@ import Data.Syntax.Assignment hiding (Assignment, Error)
|
||||
import qualified Data.Syntax.Assignment as Assignment
|
||||
import qualified Data.Syntax.Declaration as Declaration
|
||||
import qualified Data.Syntax.Markup as Markup
|
||||
import Data.Term as Term (Term(..), TermF(..), termIn, unwrap)
|
||||
import qualified Data.Text as Text
|
||||
import Data.Text.Encoding (encodeUtf8)
|
||||
import Data.Union
|
||||
import GHC.Stack
|
||||
import Language.Markdown as Grammar (Grammar(..))
|
||||
import Term (Term(..), TermF(..), termIn, unwrap)
|
||||
|
||||
type Syntax =
|
||||
'[ Markup.Document
|
||||
|
@ -24,11 +24,11 @@ import qualified Data.Syntax.Expression as Expression
|
||||
import qualified Data.Syntax.Literal as Literal
|
||||
import qualified Data.Syntax.Statement as Statement
|
||||
import qualified Data.Syntax.Type as Type
|
||||
import qualified Data.Term as Term
|
||||
import Data.Union
|
||||
import GHC.Generics
|
||||
import GHC.Stack
|
||||
import Language.Python.Grammar as Grammar
|
||||
import qualified Term
|
||||
|
||||
type Syntax =
|
||||
'[ Comment.Comment
|
||||
|
@ -6,11 +6,11 @@ import Data.List (partition)
|
||||
import Data.Record
|
||||
import Data.Semigroup
|
||||
import Data.Source
|
||||
import Data.Term
|
||||
import Data.Text (Text)
|
||||
import Info
|
||||
import Language
|
||||
import qualified Syntax as S
|
||||
import Term
|
||||
|
||||
termAssignment
|
||||
:: Source -- ^ The source of the term.
|
||||
|
@ -19,10 +19,10 @@ import qualified Data.Syntax.Declaration as Declaration
|
||||
import qualified Data.Syntax.Expression as Expression
|
||||
import qualified Data.Syntax.Literal as Literal
|
||||
import qualified Data.Syntax.Statement as Statement
|
||||
import qualified Data.Term as Term
|
||||
import Data.Union
|
||||
import GHC.Stack
|
||||
import Language.Ruby.Grammar as Grammar
|
||||
import qualified Term
|
||||
|
||||
-- | The type of Ruby syntax.
|
||||
type Syntax = '[
|
||||
|
@ -6,11 +6,11 @@ import Control.Comonad.Cofree (unwrap)
|
||||
import Data.Foldable (toList)
|
||||
import Data.Record
|
||||
import Data.Source
|
||||
import Data.Term
|
||||
import Data.Text (Text)
|
||||
import Info
|
||||
import Language
|
||||
import qualified Syntax as S
|
||||
import Term
|
||||
|
||||
termAssignment
|
||||
:: Source -- ^ The source of the term.
|
||||
|
@ -18,6 +18,7 @@ import Data.Record
|
||||
import Data.Source as Source
|
||||
import qualified Data.Syntax as Syntax
|
||||
import Data.Syntax.Assignment
|
||||
import Data.Term
|
||||
import Data.Union
|
||||
import Foreign.Ptr
|
||||
import Info hiding (Empty, Go)
|
||||
@ -27,7 +28,6 @@ import qualified Language.Markdown.Syntax as Markdown
|
||||
import qualified Language.Python.Syntax as Python
|
||||
import qualified Language.Ruby.Syntax as Ruby
|
||||
import Syntax hiding (Go)
|
||||
import Term
|
||||
import qualified TreeSitter.Language as TS (Language, Symbol)
|
||||
import TreeSitter.Go
|
||||
import TreeSitter.Python
|
||||
|
13
src/RWS.hs
13
src/RWS.hs
@ -14,27 +14,26 @@ module RWS
|
||||
|
||||
import Control.Applicative (empty)
|
||||
import Control.Arrow ((&&&))
|
||||
import Control.Monad.Random
|
||||
import Control.Monad.State.Strict
|
||||
import Data.Align.Generic
|
||||
import Data.Array.Unboxed
|
||||
import Data.Foldable
|
||||
import Data.Function ((&))
|
||||
import Data.Functor.Classes
|
||||
import Data.Functor.Foldable
|
||||
import Data.Hashable
|
||||
import qualified Data.IntMap as IntMap
|
||||
import Data.KdMap.Static hiding (elems, empty)
|
||||
import Data.List (sortOn)
|
||||
import Data.Maybe
|
||||
import Data.Record
|
||||
import Data.Semigroup hiding (First(..))
|
||||
import Data.Term as Term
|
||||
import Data.These
|
||||
import Data.Traversable
|
||||
import Term
|
||||
import Data.Array.Unboxed
|
||||
import Data.Functor.Classes
|
||||
import Diff (DiffF(..), deleting, inserting, merge, replacing)
|
||||
import SES
|
||||
import Data.KdMap.Static hiding (elems, empty)
|
||||
import qualified Data.IntMap as IntMap
|
||||
|
||||
import Control.Monad.Random
|
||||
import System.Random.Mersenne.Pure64
|
||||
|
||||
type Label f fields label = forall b. TermF f (Record fields) b -> label
|
||||
|
@ -26,6 +26,7 @@ import qualified Data.Map as Map
|
||||
import Data.Output
|
||||
import Data.Record
|
||||
import Data.Syntax.Algebra (RAlgebra)
|
||||
import Data.Term
|
||||
import Data.Text (Text)
|
||||
import Diff
|
||||
import Info (DefaultFields)
|
||||
@ -34,7 +35,6 @@ import Renderer.Patch as R
|
||||
import Renderer.SExpression as R
|
||||
import Renderer.TOC as R
|
||||
import Syntax as S
|
||||
import Term
|
||||
|
||||
-- | Specification of renderers for diffs, producing output in the parameter type.
|
||||
data DiffRenderer output where
|
||||
|
@ -9,9 +9,9 @@ import Data.Functor.Foldable (cata)
|
||||
import Data.Patch
|
||||
import Data.Record
|
||||
import Data.Semigroup
|
||||
import Data.Term
|
||||
import Diff
|
||||
import Prelude hiding (replicate)
|
||||
import Term
|
||||
|
||||
-- | Returns a ByteString SExpression formatted diff.
|
||||
renderSExpressionDiff :: (ConstrainAll Show fields, Foldable syntax, Functor syntax) => Diff syntax (Record fields) (Record fields) -> ByteString
|
||||
|
@ -36,6 +36,7 @@ import Data.Patch
|
||||
import Data.Record
|
||||
import Data.Semigroup ((<>), sconcat)
|
||||
import Data.Source as Source
|
||||
import Data.Term
|
||||
import Data.Text (toLower)
|
||||
import qualified Data.Text as T
|
||||
import Data.Union
|
||||
@ -50,7 +51,6 @@ import Data.Syntax.Algebra (RAlgebra)
|
||||
import qualified Data.Syntax as Syntax
|
||||
import qualified Data.Syntax.Declaration as Declaration
|
||||
import qualified Data.Syntax.Markup as Markup
|
||||
import Term
|
||||
|
||||
data Summaries = Summaries { changes, errors :: !(Map.Map T.Text [Value]) }
|
||||
deriving (Eq, Show)
|
||||
|
@ -15,6 +15,7 @@ import Data.ByteString (ByteString)
|
||||
import Data.Functor.Both as Both
|
||||
import Data.Output
|
||||
import Data.Record
|
||||
import Data.Term
|
||||
import Decorators
|
||||
import Diff
|
||||
import Info
|
||||
@ -23,7 +24,6 @@ import qualified Language
|
||||
import Parser
|
||||
import Renderer
|
||||
import Semantic.Task as Task
|
||||
import Term
|
||||
|
||||
-- This is the primary interface to the Semantic library which provides two
|
||||
-- major classes of functionality: semantic parsing and diffing of source code
|
||||
|
@ -42,6 +42,7 @@ import Data.Semigroup ((<>))
|
||||
import qualified Data.Syntax as Syntax
|
||||
import Data.Syntax.Algebra (RAlgebra, decoratorWithAlgebra)
|
||||
import qualified Data.Syntax.Assignment as Assignment
|
||||
import Data.Term
|
||||
import qualified Data.Time.Clock as Time
|
||||
import qualified Data.Time.Clock.POSIX as Time (getCurrentTime)
|
||||
import qualified Data.Time.LocalTime as LocalTime
|
||||
@ -55,7 +56,6 @@ import Language.Markdown
|
||||
import Parser
|
||||
import System.Exit (die)
|
||||
import System.IO (Handle, hPutStr, stderr)
|
||||
import Term
|
||||
import TreeSitter
|
||||
import Semantic.Log
|
||||
|
||||
|
@ -2,8 +2,8 @@ module SplitDiff where
|
||||
|
||||
import Control.Monad.Free
|
||||
import Data.Record
|
||||
import Data.Term
|
||||
import Info
|
||||
import Term
|
||||
|
||||
-- | A patch to only one side of a diff.
|
||||
data SplitPatch a
|
||||
|
@ -16,6 +16,7 @@ import Data.Record
|
||||
import Data.Source
|
||||
import Data.Span
|
||||
import qualified Data.Syntax.Assignment as A
|
||||
import Data.Term
|
||||
import Data.Text (Text, pack)
|
||||
import Language
|
||||
import qualified Language.Go as Go
|
||||
@ -25,7 +26,6 @@ import Foreign
|
||||
import Foreign.C.String (peekCString)
|
||||
import Foreign.Marshal.Array (allocaArray)
|
||||
import qualified Syntax as S
|
||||
import Term
|
||||
import qualified TreeSitter.Document as TS
|
||||
import qualified TreeSitter.Node as TS
|
||||
import qualified TreeSitter.Language as TS
|
||||
|
@ -17,12 +17,12 @@ import Data.Range
|
||||
import Data.Record
|
||||
import Data.Semigroup ((<>))
|
||||
import qualified Data.Source as Source
|
||||
import Data.Term
|
||||
import qualified Data.Text as Text
|
||||
import Data.These
|
||||
import Diff
|
||||
import SplitDiff
|
||||
import Syntax
|
||||
import Term
|
||||
import Test.Hspec (Spec, describe, it, parallel)
|
||||
import Test.Hspec.Expectations.Pretty
|
||||
import Test.Hspec.LeanCheck
|
||||
|
@ -44,6 +44,7 @@ import qualified Data.Syntax as Syntax
|
||||
import qualified Data.Syntax.Comment as Comment
|
||||
import qualified Data.Syntax.Declaration as Declaration
|
||||
import qualified Data.Syntax.Statement as Statement
|
||||
import Data.Term
|
||||
import Data.Text as T (Text, pack)
|
||||
import qualified Data.Text.Encoding as T
|
||||
import Data.These
|
||||
@ -52,7 +53,6 @@ import Diff
|
||||
import Renderer.TOC
|
||||
import RWS
|
||||
import Syntax as S
|
||||
import Term
|
||||
import Test.LeanCheck
|
||||
|
||||
type Tier a = [a]
|
||||
|
@ -6,13 +6,13 @@ import Data.Bifunctor
|
||||
import Data.Functor.Listable (ListableSyntax)
|
||||
import Data.Record
|
||||
import qualified Data.Syntax as Syntax
|
||||
import Data.Term
|
||||
import Data.These
|
||||
import Data.Union
|
||||
import Decorators
|
||||
import Diff
|
||||
import Interpreter
|
||||
import RWS
|
||||
import Term
|
||||
import Test.Hspec
|
||||
import Test.Hspec.LeanCheck
|
||||
|
||||
|
@ -9,9 +9,9 @@ import Data.Semigroup ((<>))
|
||||
import Data.Source
|
||||
import Data.Span
|
||||
import Data.Syntax.Assignment
|
||||
import Data.Term
|
||||
import GHC.Stack (getCallStack)
|
||||
import Prelude hiding (words)
|
||||
import Term
|
||||
import Test.Hspec
|
||||
import TreeSitter.Language (Symbol(..), SymbolType(..))
|
||||
|
||||
|
@ -5,11 +5,11 @@ import Data.Functor.Both
|
||||
import Data.Functor.Foldable (cata)
|
||||
import Data.Functor.Listable (ListableSyntax)
|
||||
import Data.Record
|
||||
import Data.Term
|
||||
import Data.Union
|
||||
import Diff
|
||||
import Interpreter
|
||||
import RWS
|
||||
import Term
|
||||
import Test.Hspec
|
||||
import Test.Hspec.LeanCheck
|
||||
|
||||
|
@ -6,10 +6,10 @@ import Data.Functor.Foldable hiding (Nil)
|
||||
import Data.Functor.Listable
|
||||
import Data.Record
|
||||
import qualified Data.Syntax as Syntax
|
||||
import Data.Term
|
||||
import Data.Union
|
||||
import Diff
|
||||
import Interpreter
|
||||
import Term
|
||||
import Test.Hspec (Spec, describe, it, parallel)
|
||||
import Test.Hspec.Expectations.Pretty
|
||||
import Test.Hspec.LeanCheck
|
||||
|
@ -4,13 +4,13 @@ import Data.Blob
|
||||
import Data.Functor (void)
|
||||
import Data.Functor.Both as Both
|
||||
import Data.Patch
|
||||
import Data.Term
|
||||
import Diff
|
||||
import Language
|
||||
import Renderer
|
||||
import Semantic
|
||||
import Semantic.Task
|
||||
import Syntax
|
||||
import Term
|
||||
import Test.Hspec hiding (shouldBe, shouldNotBe, shouldThrow, errorCall)
|
||||
import Test.Hspec.Expectations.Pretty
|
||||
|
||||
|
@ -16,6 +16,7 @@ import Data.Patch
|
||||
import Data.Record
|
||||
import Data.Semigroup ((<>))
|
||||
import Data.Source
|
||||
import Data.Term
|
||||
import Data.Text (Text)
|
||||
import Data.These
|
||||
import Diff
|
||||
@ -30,7 +31,6 @@ import Semantic
|
||||
import Semantic.Task
|
||||
import SpecHelpers
|
||||
import Syntax as S
|
||||
import Term
|
||||
import Test.Hspec (Spec, describe, it, parallel)
|
||||
import Test.Hspec.Expectations.Pretty
|
||||
import Test.Hspec.LeanCheck
|
||||
|
@ -4,8 +4,8 @@ module TermSpec where
|
||||
import Category
|
||||
import Data.Functor.Listable
|
||||
import Data.Record
|
||||
import Data.Term
|
||||
import Syntax
|
||||
import Term
|
||||
import Test.Hspec (Spec, describe, parallel)
|
||||
import Test.Hspec.Expectations.Pretty
|
||||
import Test.Hspec.LeanCheck
|
||||
|
Loading…
Reference in New Issue
Block a user