futhark-0.25.32: An optimising compiler for a functional, array-oriented language.
Safe HaskellNone
LanguageGHC2021

Language.Futhark.Parser.Monad

Contents

Description

Utility functions and definitions used in the Happy-generated parser. They are defined here because the .y file is opaque to linters and other tools. In particular, we cannot enable warnings for that file, because Happy-generated code is very dirty by GHC's standards.

Synopsis

Documentation

type ParserMonad = ExceptT SyntaxError (State ParserState) Source #

data Comment Source #

A comment consists of its starting and end position, as well as its text. The contents include the comment start marker.

Constructors

Comment 

Fields

Instances

Instances details
Show Comment Source # 
Instance details

Defined in Language.Futhark.Parser.Monad

Methods

showsPrec :: Int -> Comment -> ShowS

show :: Comment -> String

showList :: [Comment] -> ShowS

Eq Comment Source # 
Instance details

Defined in Language.Futhark.Parser.Monad

Methods

(==) :: Comment -> Comment -> Bool

(/=) :: Comment -> Comment -> Bool

Ord Comment Source # 
Instance details

Defined in Language.Futhark.Parser.Monad

Methods

compare :: Comment -> Comment -> Ordering

(<) :: Comment -> Comment -> Bool

(<=) :: Comment -> Comment -> Bool

(>) :: Comment -> Comment -> Bool

(>=) :: Comment -> Comment -> Bool

max :: Comment -> Comment -> Comment

min :: Comment -> Comment -> Comment

Located Comment Source # 
Instance details

Defined in Language.Futhark.Parser.Monad

parse :: ParserMonad a -> FilePath -> Text -> Either SyntaxError a Source #

parseWithComments :: ParserMonad a -> FilePath -> Text -> Either SyntaxError (a, [Comment]) Source #

arrayFromList :: [a] -> Array Int a Source #

mustBe :: L Token -> Text -> ParserMonad () Source #

addDocSpec :: DocComment -> SpecBase (NoInfo :: Type -> Type) Name -> SpecBase (NoInfo :: Type -> Type) Name Source #

data SyntaxError Source #

A syntax error.

Constructors

SyntaxError 

Fields

parseError :: (L Token, [String]) -> ParserMonad a Source #

parseErrorAt :: Located loc => loc -> Maybe Text -> ParserMonad a Source #

backOneCol :: Loc -> Loc Source #

Move the end position back one column.

Reexports

data L a Source #

A value of type L a is a value of type a with an associated Loc, but this location is ignored when performing comparisons.

Instances

Instances details
Functor L 
Instance details

Defined in Data.Loc

Methods

fmap :: (a -> b) -> L a -> L b

(<$) :: a -> L b -> L a

Data a => Data (L a) 
Instance details

Defined in Data.Loc

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> L a -> c (L a)

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (L a)

toConstr :: L a -> Constr

dataTypeOf :: L a -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (L a))

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (L a))

gmapT :: (forall b. Data b => b -> b) -> L a -> L a

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> L a -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> L a -> r

gmapQ :: (forall d. Data d => d -> u) -> L a -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> L a -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> L a -> m (L a)

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> L a -> m (L a)

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> L a -> m (L a)

Show x => Show (L x) 
Instance details

Defined in Data.Loc

Methods

showsPrec :: Int -> L x -> ShowS

show :: L x -> String

showList :: [L x] -> ShowS

Eq x => Eq (L x) 
Instance details

Defined in Data.Loc

Methods

(==) :: L x -> L x -> Bool

(/=) :: L x -> L x -> Bool

Ord x => Ord (L x) 
Instance details

Defined in Data.Loc

Methods

compare :: L x -> L x -> Ordering

(<) :: L x -> L x -> Bool

(<=) :: L x -> L x -> Bool

(>) :: L x -> L x -> Bool

(>=) :: L x -> L x -> Bool

max :: L x -> L x -> L x

min :: L x -> L x -> L x

Pretty x => Pretty (L x) 
Instance details

Defined in Text.PrettyPrint.Mainland.Class

Methods

ppr :: L x -> Doc Source #

pprPrec :: Int -> L x -> Doc Source #

pprList :: [L x] -> Doc Source #

Located (L a) 
Instance details

Defined in Data.Loc

Methods

locOf :: L a -> Loc Source #

locOfList :: [L a] -> Loc Source #

Relocatable (L a) 
Instance details

Defined in Data.Loc

Methods

reloc :: Loc -> L a -> L a Source #

data Token Source #

A lexical token. It does not itself contain position information, so in practice the parser will consume tokens tagged with a source position.

Instances

Instances details
Show Token Source # 
Instance details

Defined in Language.Futhark.Parser.Lexer.Tokens

Methods

showsPrec :: Int -> Token -> ShowS

show :: Token -> String

showList :: [Token] -> ShowS

Eq Token Source # 
Instance details

Defined in Language.Futhark.Parser.Lexer.Tokens

Methods

(==) :: Token -> Token -> Bool

(/=) :: Token -> Token -> Bool

Ord Token Source # 
Instance details

Defined in Language.Futhark.Parser.Lexer.Tokens

Methods

compare :: Token -> Token -> Ordering

(<) :: Token -> Token -> Bool

(<=) :: Token -> Token -> Bool

(>) :: Token -> Token -> Bool

(>=) :: Token -> Token -> Bool

max :: Token -> Token -> Token

min :: Token -> Token -> Token