Regular expression-based parsing is slower than the use of Scanner, because the latter immediately uses the information about the data it has scanned.
Additionally, the current implementation crashes rarely in NSRegularExpression.firstMatch, which seems to be an issue with Apple's implementation. Although rare, it is noticeable.
All regular expressions (SVGParserRegexHelper) are removed. Parsing is built upon Scanner.
Also, re-parsing of XML during <tspan> processing is also dropped. Already existing XMLIndexer information is processed instead. The change does not affect the current behaviour for non-embedded tspans (tspans within another tspan, which are clearly not supported by the implementation at the moment). There are no new failing tests.
With the changes, SVG parsing is more efficient, shorter, a bit more resilient, has less branching and recursion, has shorter left indents. Although personally, the main reason for the minor refactoring is prevention of the rare crashes.
Regular expression-based parsing is slower than the use of
Scanner
, because the latter immediately uses the information about the data it has scanned.Additionally, the current implementation crashes rarely in
NSRegularExpression.firstMatch
, which seems to be an issue with Apple's implementation. Although rare, it is noticeable.All regular expressions (
SVGParserRegexHelper
) are removed. Parsing is built uponScanner
.Also, re-parsing of XML during
<tspan>
processing is also dropped. Already existingXMLIndexer
information is processed instead. The change does not affect the current behaviour for non-embedded tspans (tspans within another tspan, which are clearly not supported by the implementation at the moment). There are no new failing tests.With the changes, SVG parsing is more efficient, shorter, a bit more resilient, has less branching and recursion, has shorter left indents. Although personally, the main reason for the minor refactoring is prevention of the rare crashes.