Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- readTree :: FilePath -> IO (Either String FileSourcedTrees)
- runReadTree :: FilePath -> Text -> Either (ParseErrorBundle Text Error) FileSourcedTrees
- data ErrorRead
- readUtf8 :: FilePath -> IO (Either ErrorRead Text)
- type ReadTree e s a = ReadTreeConstraints e s a => ReaderT ReadTreeInh (Parsec e s) a
- type ReadTreeConstraints e s a = (Stream s, Token s ~ Char, Ord e, IsString (Tokens s), ShowErrorComponent e)
- data ReadTreeInh = ReadTreeInh {}
- defaultReadTreeInh :: ReadTreeInh
- p_Offset :: ReadTree e s Offset
- p_Sourced :: ReadTree e s a -> ReadTree e s (Sourced (FileSource Offset) a)
- setSource :: FileRange pos -> FileSource pos -> FileSource pos
- p_SourcedBegin :: ReadTree e s a -> ReadTree e s a
- p_SourcedEnd :: ReadTree e s (a -> Sourced (FileSource Offset) a)
- data Error
- = Error_CharRef_invalid Integer
- | Error_EntityRef_unknown NCName
- | Error_Closing_tag_unexpected QName QName
- | Error_Attribute_collision QName
- | Error_PI_reserved PName
- | Error_Namespace_prefix_unknown NCName
- | Error_Namespace_empty NCName
- | Error_Namespace_reserved Namespace
- | Error_Namespace_reserved_prefix NCName
- p_error :: e -> ReadTree e s a
- p_quoted :: Tokens s ~ Text => (Char -> ReadTree e s a) -> ReadTree e s a
- p_until :: Tokens s ~ Text => (Char -> Bool) -> (Char, Text) -> ReadTree e s Text
- p_until1 :: Tokens s ~ Text => (Char -> Bool) -> (Char, Text) -> ReadTree e s Text
- p_document :: Tokens s ~ Text => ReadTree Error s FileSourcedTrees
- p_prolog :: Tokens s ~ Text => ReadTree Error s FileSourcedTrees
- p_Miscs :: Tokens s ~ Text => ReadTree Error s FileSourcedTrees
- p_XMLDecl :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_VersionInfo :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_EncodingDecl :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_EncName :: Tokens s ~ Text => ReadTree Error s Text
- p_SDDecl :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_CharData :: Tokens s ~ Text => ReadTree e s EscapedText
- p_Comment :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_Comment_ :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_Comment__ :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_CDSect :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_CDSect_ :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_CDSect__ :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_PI :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_PI_ :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_PI__ :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_PITarget :: Tokens s ~ Text => ReadTree Error s PName
- p_Element :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_Element_ :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_STag :: Tokens s ~ Text => ReadTree Error s FileSourcedTree
- p_Attribute :: Tokens s ~ Text => ReadTree Error s (PName, FileSourced EscapedAttr)
- p_AttrValue :: Tokens s ~ Text => ReadTree Error s EscapedAttr
- p_AttrValueText :: Tokens s ~ Text => Char -> ReadTree Error s EscapedAttr
- p_content :: Tokens s ~ Text => ReadTree Error s FileSourcedTrees
- p_ETag :: Tokens s ~ Text => QName -> ReadTree Error s ()
- p_PName :: Tokens s ~ Text => ReadTree e s PName
- p_QName :: Tokens s ~ Text => ReadTree Error s QName
- p_NCName :: Tokens s ~ Text => ReadTree e s NCName
- p_Reference :: Tokens s ~ Text => ReadTree Error s Escaped
- p_EntityRef :: Tokens s ~ Text => ReadTree Error s EntityRef
- p_CharRef :: Tokens s ~ Text => ReadTree Error s CharRef
- readInt :: Integer -> String -> Integer
- readDecimal :: String -> Integer
- readHexadecimal :: String -> Integer
- p_Char :: Tokens s ~ Text => ReadTree e s Char
- p_CRLF :: Tokens s ~ Text => ReadTree e s Char
- p_Space :: Tokens s ~ Text => ReadTree e s Char
- p_Spaces :: Tokens s ~ Text => ReadTree e s ()
- p_Spaces1 :: Tokens s ~ Text => ReadTree e s ()
- p_separator :: Tokens s ~ Text => Char -> ReadTree e s ()
- p_Eq :: Tokens s ~ Text => ReadTree e s ()
Documentation
runReadTree :: FilePath -> Text -> Either (ParseErrorBundle Text Error) FileSourcedTrees Source #
Type ErrorRead
Type ReadTree
type ReadTree e s a = ReadTreeConstraints e s a => ReaderT ReadTreeInh (Parsec e s) a Source #
Convenient alias.
Type ReadTreeConstraints
type ReadTreeConstraints e s a = (Stream s, Token s ~ Char, Ord e, IsString (Tokens s), ShowErrorComponent e) Source #
Type ReadTreeInh
data ReadTreeInh Source #
Instances
Show ReadTreeInh Source # | |
Defined in Symantic.XML.Tree.Read showsPrec :: Int -> ReadTreeInh -> ShowS # show :: ReadTreeInh -> String # showList :: [ReadTreeInh] -> ShowS # |
setSource :: FileRange pos -> FileSource pos -> FileSource pos Source #
p_SourcedBegin :: ReadTree e s a -> ReadTree e s a Source #
Like p_Sourced
but uncoupled (through the use of p_SourcedEnd
) for more flexibility.
p_SourcedEnd :: ReadTree e s (a -> Sourced (FileSource Offset) a) Source #
WARNING: only to be used within a p_SourcedBegin
.
Type Error
Error_CharRef_invalid Integer | Well-formedness constraint: Legal Character. Characters referred to using character references MUST match the production for Char. |
Error_EntityRef_unknown NCName | Well-formedness constraint: Entity Declared In a document without any DTD, a document with only an internal DTD
subset which contains no parameter entity references, or a document
with " standalone= Note that non-validating processors are not obligated to read and
process entity declarations occurring in parameter entities or in the
external subset; for such documents, the define that an entity must be
declared is a well-formedness constraint only if standalone= |
Error_Closing_tag_unexpected QName QName | Well-formedness constraint: Element Type Match. The Name in an element's end-tag MUST match the element type in the start-tag. |
Error_Attribute_collision QName | Well-formedness constraint: Unique Att Spec. An attribute name MUST NOT appear more than once in the same start-tag or empty-element tag. |
Error_PI_reserved PName | The target names " XML ", " xml ", and so on are reserved for standardization. |
Error_Namespace_prefix_unknown NCName | Namespace constraint: Prefix Declared The namespace prefix, unless it is xml or xmlns, MUST have been declared in a namespace declaration attribute in either the start-tag of the element where the prefix is used or in an ancestor element (i.e., an element in whose content the prefixed markup occurs). |
Error_Namespace_empty NCName | Namespace constraint: No Prefix Undeclaring In a namespace declaration for a prefix (i.e., where the NSAttName is a PrefixedAttName), the attribute value MUST NOT be empty. |
Error_Namespace_reserved Namespace | |
Error_Namespace_reserved_prefix NCName | Namespace constraint: Reserved Prefixes and Namespace Names The prefix xml is by definition bound to the namespace name http://www.w3.org/XML/1998/namespace. It MAY, but need not, be declared, and MUST NOT be bound to any other namespace name. Other prefixes MUST NOT be bound to this namespace name, and it MUST NOT be declared as the default namespace. The prefix xmlns is used only to declare namespace bindings and is by definition bound to the namespace name http://www.w3.org/2000/xmlns/. It MUST NOT be declared . Other prefixes MUST NOT be bound to this namespace name, and it MUST NOT be declared as the default namespace. Element names MUST NOT have the prefix xmlns. All other prefixes beginning with the three-letter sequence x, m, l, in any case combination, are reserved. This means that:
|
Helpers
Document
p_document :: Tokens s ~ Text => ReadTree Error s FileSourcedTrees Source #
Prolog
Misc
XMLDecl
p_VersionInfo :: Tokens s ~ Text => ReadTree Error s FileSourcedTree Source #
p_EncodingDecl :: Tokens s ~ Text => ReadTree Error s FileSourcedTree Source #
SDDecl
CharData
p_CharData :: Tokens s ~ Text => ReadTree e s EscapedText Source #
Comment
p_Comment_ :: Tokens s ~ Text => ReadTree Error s FileSourcedTree Source #
p_Comment__ :: Tokens s ~ Text => ReadTree Error s FileSourcedTree Source #
CDATA
p_CDSect__ :: Tokens s ~ Text => ReadTree Error s FileSourcedTree Source #
PI
Element
p_Element_ :: Tokens s ~ Text => ReadTree Error s FileSourcedTree Source #
STag
Attribute
p_Attribute :: Tokens s ~ Text => ReadTree Error s (PName, FileSourced EscapedAttr) Source #
Note: despite the type, the returned FileSource
encompasses also the attribute PName
.
It is pushed in the attribute value to fit the insertion
of the attribute into a HashMap
.
p_AttrValue :: Tokens s ~ Text => ReadTree Error s EscapedAttr Source #
p_AttrValueText :: Tokens s ~ Text => Char -> ReadTree Error s EscapedAttr Source #
content
ETag
PName
QName
NCName
Reference
EntityRef
CharRef
readDecimal :: String -> Integer Source #
readHexadecimal :: String -> Integer Source #
Char
Space
p_CRLF :: Tokens s ~ Text => ReadTree e s Char Source #
Map '\r' and '\r\n' to '\n'. See: https://www.w3.org/TR/xml/#sec-line-ends