mirror of
https://github.com/github/semantic.git
synced 2024-12-26 00:12:29 +03:00
Use semantic-source’s definition of Span.
This commit is contained in:
parent
b082341704
commit
0b642f579d
@ -17,9 +17,9 @@ import Control.Effect.Error
|
|||||||
import Control.Effect.Fail
|
import Control.Effect.Fail
|
||||||
import Control.Effect.Reader
|
import Control.Effect.Reader
|
||||||
import Data.Text (Text, pack)
|
import Data.Text (Text, pack)
|
||||||
import Data.Text.Prettyprint.Doc (Pretty (..))
|
|
||||||
import GHC.Stack
|
import GHC.Stack
|
||||||
import Prelude hiding (fail)
|
import Prelude hiding (fail)
|
||||||
|
import Source.Span
|
||||||
|
|
||||||
data Loc = Loc
|
data Loc = Loc
|
||||||
{ locPath :: !Text
|
{ locPath :: !Text
|
||||||
@ -30,27 +30,9 @@ data Loc = Loc
|
|||||||
interactive :: Loc
|
interactive :: Loc
|
||||||
interactive = Loc "<interactive>" emptySpan
|
interactive = Loc "<interactive>" emptySpan
|
||||||
|
|
||||||
data Span = Span
|
|
||||||
{ spanStart :: {-# UNPACK #-} !Pos
|
|
||||||
, spanEnd :: {-# UNPACK #-} !Pos
|
|
||||||
}
|
|
||||||
deriving (Eq, Ord, Show)
|
|
||||||
|
|
||||||
instance Pretty Span where
|
|
||||||
pretty (Span s e) = pretty s <> "-" <> pretty e
|
|
||||||
|
|
||||||
emptySpan :: Span
|
emptySpan :: Span
|
||||||
emptySpan = Span (Pos 1 1) (Pos 1 1)
|
emptySpan = Span (Pos 1 1) (Pos 1 1)
|
||||||
|
|
||||||
data Pos = Pos
|
|
||||||
{ posLine :: {-# UNPACK #-} !Int
|
|
||||||
, posCol :: {-# UNPACK #-} !Int
|
|
||||||
}
|
|
||||||
deriving (Eq, Ord, Show)
|
|
||||||
|
|
||||||
instance Pretty Pos where
|
|
||||||
pretty (Pos l c) = pretty l <> ":" <> pretty c
|
|
||||||
|
|
||||||
|
|
||||||
here :: HasCallStack => Maybe Loc
|
here :: HasCallStack => Maybe Loc
|
||||||
here = stackLoc callStack
|
here = stackLoc callStack
|
||||||
|
Loading…
Reference in New Issue
Block a user