Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
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 (State ParserState)
- data ParserState
- data Comment = Comment {
- commentLoc :: Loc
- commentText :: Text
- parse :: ParserMonad a -> FilePath -> Text -> Either SyntaxError a
- parseWithComments :: ParserMonad a -> FilePath -> Text -> Either SyntaxError (a, [Comment])
- lexer :: (L Token -> ParserMonad a) -> ParserMonad a
- mustBeEmpty :: Located loc => loc -> ValueType -> ParserMonad ()
- arrayFromList :: [a] -> Array Int a
- binOp :: UncheckedExp -> L Token -> UncheckedExp -> UncheckedExp
- binOpName :: L Token -> (QualName Name, Loc)
- mustBe :: L Token -> Text -> ParserMonad ()
- primNegate :: PrimValue -> PrimValue
- applyExp :: NonEmpty UncheckedExp -> ParserMonad UncheckedExp
- patternExp :: UncheckedPat t -> 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 Text -> ParserMonad a
- backOneCol :: Loc -> Loc
- data L a
- data Token
Documentation
type ParserMonad = ExceptT SyntaxError (State ParserState) Source #
data ParserState Source #
A comment consists of its starting and end position, as well as its text. The contents include the comment start marker.
Comment | |
|
parse :: ParserMonad a -> FilePath -> Text -> Either SyntaxError a Source #
parseWithComments :: ParserMonad a -> FilePath -> Text -> Either SyntaxError (a, [Comment]) Source #
lexer :: (L Token -> ParserMonad a) -> ParserMonad a Source #
mustBeEmpty :: Located loc => loc -> ValueType -> ParserMonad () Source #
arrayFromList :: [a] -> Array Int a Source #
binOp :: UncheckedExp -> L Token -> UncheckedExp -> UncheckedExp Source #
primNegate :: PrimValue -> PrimValue Source #
patternExp :: UncheckedPat t -> 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 Text -> 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 | |
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) # | |
Show x => Show (L x) | |
Eq x => Eq (L x) | |
Ord x => Ord (L x) | |
Pretty x => Pretty (L x) | |
Located (L a) | |
Relocatable (L a) | |