Safe Haskell | None |
---|---|
Language | Haskell98 |
The Parser monad.
- type Parser a = ReaderT ParseContext (Except ParseError) a
- type ParseError = Text
- parseError :: ParseError -> Parser a
- runParser :: Text -> Map Alias Type -> Element -> Parser a -> Either ParseError a
- parseName :: Parser Name
- parseDeprecation :: Parser (Maybe DeprecationInfo)
- parseDocumentation :: Parser Documentation
- parseIntegral :: Integral a => Text -> Parser a
- parseBool :: Text -> Parser Bool
- parseChildrenWithLocalName :: Text -> Parser a -> Parser [a]
- parseAllChildrenWithLocalName :: Text -> Parser a -> Parser [a]
- parseChildrenWithNSName :: GIRXMLNamespace -> Text -> Parser a -> Parser [a]
- getAttr :: Name -> Parser Text
- getAttrWithNamespace :: GIRXMLNamespace -> Name -> Parser Text
- queryAttr :: Name -> Parser (Maybe Text)
- queryAttrWithNamespace :: GIRXMLNamespace -> Name -> Parser (Maybe Text)
- optionalAttr :: Name -> a -> (Text -> Parser a) -> Parser a
- currentNamespace :: Parser Text
- qualifyName :: Text -> Parser Name
- resolveQualifiedTypeName :: Name -> Parser Type
- data Name = Name {}
- data Element :: *
- data GIRXMLNamespace
- data DeprecationInfo
- data Documentation
Documentation
type Parser a = ReaderT ParseContext (Except ParseError) a Source #
Monad where parsers live: we carry a context around, and can throw errors that abort the parsing.
type ParseError = Text Source #
A message describing a parsing error in human readable form.
parseError :: ParseError -> Parser a Source #
Throw a parse error.
runParser :: Text -> Map Alias Type -> Element -> Parser a -> Either ParseError a Source #
Run the given parser, returning either success or an error.
parseDeprecation :: Parser (Maybe DeprecationInfo) Source #
Parse the deprecation text, if present.
parseDocumentation :: Parser Documentation Source #
Parse the documentation info for the current node.
parseChildrenWithLocalName :: Text -> Parser a -> Parser [a] Source #
Parse all the introspectable subelements with the given local name.
parseAllChildrenWithLocalName :: Text -> Parser a -> Parser [a] Source #
Parse all subelements with the given local name.
parseChildrenWithNSName :: GIRXMLNamespace -> Text -> Parser a -> Parser [a] Source #
Parse all introspectable children with the given namespace and local name.
getAttr :: Name -> Parser Text Source #
Return the value of an attribute for the given element. If the attribute is not present this throws an error.
getAttrWithNamespace :: GIRXMLNamespace -> Name -> Parser Text Source #
Like getAttr
, but allow for specifying the namespace.
queryAttr :: Name -> Parser (Maybe Text) Source #
Return the value of an attribute if it is present, and Nothing otherwise.
queryAttrWithNamespace :: GIRXMLNamespace -> Name -> Parser (Maybe Text) Source #
Like queryAttr
, but allow for specifying the namespace.
optionalAttr :: Name -> a -> (Text -> Parser a) -> Parser a Source #
Ask for an optional attribute, applying the given parser to it. If the argument does not exist return the default value provided.
currentNamespace :: Parser Text Source #
Return the current namespace.
qualifyName :: Text -> Parser Name Source #
Build a Name
out of the (possibly qualified) supplied name. If
the supplied name is unqualified we qualify with the current
namespace, and otherwise we simply parse it.
resolveQualifiedTypeName :: Name -> Parser Type Source #
Check whether there is an alias for the given name, and return the corresponding type in case it exists, and otherwise a TInterface.
Name for a symbol in the GIR file.
data GIRXMLNamespace Source #
GIR namespaces we know about.
data DeprecationInfo Source #
Deprecation information on a symbol.
data Documentation Source #
Documentation for a given element. The documentation text is
typically encoded in the gtk-doc format, see
https://developer.gnome.org/gtk-doc-manual/ . This can be parsed
with parseGtkDoc
.