Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- type ParserMonad = ExceptT SyntaxError (StateT ParserState ReadLineMonad)
- data ParserState
- data ReadLineMonad a
- = Value a
- | GetLine (Maybe Text -> ReadLineMonad a)
- parseInMonad :: ParserMonad a -> FilePath -> Text -> ReadLineMonad (Either SyntaxError a)
- parse :: ParserMonad a -> FilePath -> Text -> Either SyntaxError a
- getLinesFromM :: Monad m => m Text -> ReadLineMonad a -> m a
- lexer :: (L Token -> ParserMonad a) -> ParserMonad a
- mustBeEmpty :: Located loc => loc -> ValueType -> ParserMonad ()
- arrayFromList :: [a] -> Array Int a
- combArrayElements :: Value -> [Value] -> Either SyntaxError Value
- binOp :: UncheckedExp -> L Token -> UncheckedExp -> UncheckedExp
- binOpName :: L Token -> (QualName Name, Loc)
- mustBe :: L Token -> String -> ParserMonad ()
- floatNegate :: FloatValue -> FloatValue
- intNegate :: IntValue -> IntValue
- primNegate :: PrimValue -> PrimValue
- primTypeFromName :: Loc -> Name -> ParserMonad PrimType
- applyExp :: [UncheckedExp] -> ParserMonad UncheckedExp
- patternExp :: UncheckedPat -> ParserMonad UncheckedExp
- addDocSpec :: DocComment -> SpecBase NoInfo Name -> SpecBase NoInfo Name
- addAttrSpec :: AttrInfo Name -> UncheckedSpec -> UncheckedSpec
- addDoc :: DocComment -> UncheckedDec -> UncheckedDec
- addAttr :: AttrInfo Name -> UncheckedDec -> UncheckedDec
- twoDotsRange :: Loc -> ParserMonad a
- data SyntaxError = SyntaxError {}
- emptyArrayError :: Loc -> ParserMonad a
- parseError :: (L Token, [String]) -> ParserMonad a
- parseErrorAt :: Located loc => loc -> Maybe String -> ParserMonad a
- backOneCol :: Loc -> Loc
- data L a
- data Token
Documentation
data ParserState Source #
data ReadLineMonad a Source #
Value a | |
GetLine (Maybe Text -> ReadLineMonad a) |
Instances
Monad ReadLineMonad Source # | |
Defined in Language.Futhark.Parser.Monad (>>=) :: ReadLineMonad a -> (a -> ReadLineMonad b) -> ReadLineMonad b # (>>) :: ReadLineMonad a -> ReadLineMonad b -> ReadLineMonad b # return :: a -> ReadLineMonad a # | |
Functor ReadLineMonad Source # | |
Defined in Language.Futhark.Parser.Monad fmap :: (a -> b) -> ReadLineMonad a -> ReadLineMonad b # (<$) :: a -> ReadLineMonad b -> ReadLineMonad a # | |
Applicative ReadLineMonad Source # | |
Defined in Language.Futhark.Parser.Monad pure :: a -> ReadLineMonad a # (<*>) :: ReadLineMonad (a -> b) -> ReadLineMonad a -> ReadLineMonad b # liftA2 :: (a -> b -> c) -> ReadLineMonad a -> ReadLineMonad b -> ReadLineMonad c # (*>) :: ReadLineMonad a -> ReadLineMonad b -> ReadLineMonad b # (<*) :: ReadLineMonad a -> ReadLineMonad b -> ReadLineMonad a # |
parseInMonad :: ParserMonad a -> FilePath -> Text -> ReadLineMonad (Either SyntaxError a) Source #
parse :: ParserMonad a -> FilePath -> Text -> Either SyntaxError a Source #
getLinesFromM :: Monad m => m Text -> ReadLineMonad a -> m a Source #
lexer :: (L Token -> ParserMonad a) -> ParserMonad a Source #
mustBeEmpty :: Located loc => loc -> ValueType -> ParserMonad () Source #
arrayFromList :: [a] -> Array Int a Source #
combArrayElements :: Value -> [Value] -> Either SyntaxError Value Source #
binOp :: UncheckedExp -> L Token -> UncheckedExp -> UncheckedExp Source #
floatNegate :: FloatValue -> FloatValue Source #
primNegate :: PrimValue -> PrimValue Source #
primTypeFromName :: Loc -> Name -> ParserMonad PrimType Source #
applyExp :: [UncheckedExp] -> ParserMonad UncheckedExp Source #
addDocSpec :: DocComment -> SpecBase NoInfo Name -> SpecBase NoInfo Name Source #
addAttrSpec :: AttrInfo Name -> UncheckedSpec -> UncheckedSpec Source #
addDoc :: DocComment -> UncheckedDec -> UncheckedDec Source #
addAttr :: AttrInfo Name -> UncheckedDec -> UncheckedDec Source #
twoDotsRange :: Loc -> ParserMonad a Source #
emptyArrayError :: Loc -> ParserMonad a Source #
parseError :: (L Token, [String]) -> ParserMonad a Source #
parseErrorAt :: Located loc => loc -> Maybe String -> ParserMonad a Source #
backOneCol :: Loc -> Loc Source #
Move the end position back one column.
Reexports
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
Functor L | |
Eq x => Eq (L x) | |
Data a => Data (L a) | |
Defined in Data.Loc 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) # 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) # | |
Ord x => Ord (L x) | |
Show x => Show (L x) | |
Pretty x => Pretty (L x) | |
Located (L a) | |
Relocatable (L a) | |