Closed MF42-DZH closed 1 year ago
Just line lengths now left to fix :)
Code Climate has analyzed commit 2364448d and detected 0 issues on this pull request.
The test coverage on the diff in this pull request is 95.8% (50% is the threshold).
This pull request will bring the total coverage in the repository to 91.9% (0.2% change).
View more on Code Climate.
Indentation to 4-space and underscores removed from visitor method names
These should both be done (if I haven't missed any!), and some of the shortened names have been restored to the original names from the class parameters.
This PR adds the abstract classes
LazyParsleyIVisitor
and an abstract subclassGenericLazyParsleyIVisitor
into the deep-embedding frontend. They are used for processing trees ofLazyParsley
parsers without needing to use manual exhaustive matching onLazyParsley
types, which can be tedious to maintain if newLazyParsley
subclasses are added. These visitors are also indexed, to preserve the generic return types of parsers while minimising uses of.asInstanceOf[X]
.However, all
LazyParsley
instances now have an additional requirement for a method,visit
, which when given a visitor instance and a context argument, must call its respectivevisit
method within the visitor. If a newLazyParsley
subclass is added, a newvisit
method must be added toLazyParsleyIVisitor
(and if it conforms to eitherSingleton
,Unary
,Binary
orTernary
, a respective default override must be added toGenericLazyParsleyIVisitor
) so that all parser analytics that use the visitors are forced to update their implementations to handle this new parser class.