semantic-source-0.2.0.1: Types and functionality for working with source code
Safe HaskellSafe-Inferred
LanguageHaskell2010

Source.Span

Description

Source position and span information

Mostly taken from purescript's SourcePos definition.

Synopsis

Documentation

data Span Source #

A Span of position information

Constructors

Span 

Fields

Instances

Instances details
Semigroup Span Source # 
Instance details

Defined in Source.Span

Methods

(<>) :: Span -> Span -> Span #

sconcat :: NonEmpty Span -> Span #

stimes :: Integral b => b -> Span -> Span #

Generic Span Source # 
Instance details

Defined in Source.Span

Associated Types

type Rep Span :: Type -> Type #

Methods

from :: Span -> Rep Span x #

to :: Rep Span x -> Span #

Show Span Source # 
Instance details

Defined in Source.Span

Methods

showsPrec :: Int -> Span -> ShowS #

show :: Span -> String #

showList :: [Span] -> ShowS #

NFData Span Source # 
Instance details

Defined in Source.Span

Methods

rnf :: Span -> () #

Eq Span Source # 
Instance details

Defined in Source.Span

Methods

(==) :: Span -> Span -> Bool #

(/=) :: Span -> Span -> Bool #

Ord Span Source # 
Instance details

Defined in Source.Span

Methods

compare :: Span -> Span -> Ordering #

(<) :: Span -> Span -> Bool #

(<=) :: Span -> Span -> Bool #

(>) :: Span -> Span -> Bool #

(>=) :: Span -> Span -> Bool #

max :: Span -> Span -> Span #

min :: Span -> Span -> Span #

Hashable Span Source # 
Instance details

Defined in Source.Span

Methods

hashWithSalt :: Int -> Span -> Int #

hash :: Span -> Int #

HasSpan Span Source # 
Instance details

Defined in Source.Span

Methods

span_ :: Lens' Span Span Source #

start_ :: Lens' Span Pos Source #

end_ :: Lens' Span Pos Source #

FromJSON Span Source # 
Instance details

Defined in Source.Span

ToJSON Span Source # 
Instance details

Defined in Source.Span

type Rep Span Source # 
Instance details

Defined in Source.Span

type Rep Span = D1 ('MetaData "Span" "Source.Span" "semantic-source-0.2.0.1-inplace" 'False) (C1 ('MetaCons "Span" 'PrefixI 'True) (S1 ('MetaSel ('Just "start") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Pos) :*: S1 ('MetaSel ('Just "end") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Pos)))

point :: Pos -> Span Source #

Construct a Span with a given value for both its start and end positions.

data Pos Source #

Source position information. The Pos values associated with ASTs returned from tree-sitter Unmarshal instances are zero-indexed. Unless you are displaying span information to a user, you should write your code assuming zero-indexing.

Constructors

Pos 

Fields

Instances

Instances details
Generic Pos Source # 
Instance details

Defined in Source.Span

Associated Types

type Rep Pos :: Type -> Type #

Methods

from :: Pos -> Rep Pos x #

to :: Rep Pos x -> Pos #

Show Pos Source # 
Instance details

Defined in Source.Span

Methods

showsPrec :: Int -> Pos -> ShowS #

show :: Pos -> String #

showList :: [Pos] -> ShowS #

NFData Pos Source # 
Instance details

Defined in Source.Span

Methods

rnf :: Pos -> () #

Eq Pos Source # 
Instance details

Defined in Source.Span

Methods

(==) :: Pos -> Pos -> Bool #

(/=) :: Pos -> Pos -> Bool #

Ord Pos Source # 
Instance details

Defined in Source.Span

Methods

compare :: Pos -> Pos -> Ordering #

(<) :: Pos -> Pos -> Bool #

(<=) :: Pos -> Pos -> Bool #

(>) :: Pos -> Pos -> Bool #

(>=) :: Pos -> Pos -> Bool #

max :: Pos -> Pos -> Pos #

min :: Pos -> Pos -> Pos #

Hashable Pos Source # 
Instance details

Defined in Source.Span

Methods

hashWithSalt :: Int -> Pos -> Int #

hash :: Pos -> Int #

FromJSON Pos Source # 
Instance details

Defined in Source.Span

ToJSON Pos Source # 
Instance details

Defined in Source.Span

type Rep Pos Source # 
Instance details

Defined in Source.Span

type Rep Pos = D1 ('MetaData "Pos" "Source.Span" "semantic-source-0.2.0.1-inplace" 'False) (C1 ('MetaCons "Pos" 'PrefixI 'True) (S1 ('MetaSel ('Just "line") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "column") 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int)))

line_ :: Lens' Pos Int Source #

class HasSpan a where Source #

"Classy-fields" interface for data types that have spans.

Minimal complete definition

span_

Methods

span_ :: Lens' a Span Source #

start_ :: Lens' a Pos Source #

end_ :: Lens' a Pos Source #

Instances

Instances details
HasSpan Loc Source # 
Instance details

Defined in Source.Loc

Methods

span_ :: Lens' Loc Span Source #

start_ :: Lens' Loc Pos Source #

end_ :: Lens' Loc Pos Source #

HasSpan Span Source # 
Instance details

Defined in Source.Span

Methods

span_ :: Lens' Span Span Source #

start_ :: Lens' Span Pos Source #

end_ :: Lens' Span Pos Source #