Commit 008b97bb authored by Steffen Michels's avatar Steffen Michels

make XML lexer handle whitespace at end of input correctly & adapt test to...

make XML lexer handle whitespace at end of input correctly & adapt test to generate such whitespaces
parent 28784f9a
Pipeline #42937 passed with stage
in 2 minutes and 13 seconds
......@@ -278,6 +278,7 @@ where
where
lexCharData` :: !Int ![String] -> MaybeErrorString (![String], !Int)
lexCharData` offset accum
| offset >= size input = Ok (reverse accum, offset)
| input.[offset] == '&'
# end = findEnd (\c -> c <> ';') input (offset + 1)
| input.[end] <> ';' = Error $ "Missing ';' at end of character entity"
......
......@@ -9,7 +9,7 @@ import Control.GenBimap
ggen{|XMLDocWithString|} st =
[ docWithHexCharacterReferences
, docWithDecCharacterReferences
: (\doc -> {document = doc, stringRepresentation = toString doc}) <$> docs
: (\(doc, withWhite) -> {document = doc, stringRepresentation = toString doc +++ if withWhite " " ""}) <$> docs
]
where
// This cannot be generated by `toString`, as UTF-8 characters are included in the string representation unencoded.
......@@ -25,7 +25,7 @@ where
"<?xml version=\"1.0}\" standalone=\"no\"?><root a=\"&#195;&#179;\">&#84;&#101;&#115;&#116;</root>"
}
docs :: [XMLDoc]
docs :: [(XMLDoc, Bool)]
docs = ggen{|*|} st
// TODO: Generate URIs for namespaces, instead of using names.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment